Removed #ifdef CA_INTs and other code cleanup.
authorSashi Penta <sashi.kumar.penta@intel.com>
Sun, 1 Feb 2015 21:24:27 +0000 (13:24 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Mon, 2 Feb 2015 20:56:50 +0000 (20:56 +0000)
Change-Id: I664f0e2e500ba60ed35f2bd8c000ab3988672733
Signed-off-by: Sashi Penta <sashi.kumar.penta@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/281
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
68 files changed:
examples/OICMiddle/SConscript
resource/csdk/SConscript
resource/csdk/makefile
resource/csdk/occoap/include/occoap.h
resource/csdk/occoap/include/occoaphelper.h
resource/csdk/occoap/src/occoap.c
resource/csdk/occoap/src/occoaphelper.c
resource/csdk/stack/include/internal/occlientcb.h
resource/csdk/stack/include/internal/ocobserve.h
resource/csdk/stack/include/internal/ocresourcehandler.h
resource/csdk/stack/include/internal/ocserverrequest.h
resource/csdk/stack/include/internal/ocstackinternal.h
resource/csdk/stack/include/ocstack.h
resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
resource/csdk/stack/samples/linux/SimpleClientServer/makefile
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp
resource/csdk/stack/samples/linux/secure/SConscript
resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp
resource/csdk/stack/src/occlientcb.c
resource/csdk/stack/src/occollection.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocserverrequest.c
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/src/oicgroup.c
resource/examples/SConscript
resource/examples/devicediscoveryclient.cpp
resource/examples/fridgeclient.cpp
resource/examples/garageclient.cpp
resource/examples/groupclient.cpp
resource/examples/groupserver.cpp
resource/examples/makefile
resource/examples/presenceclient.cpp
resource/examples/roomclient.cpp
resource/examples/simpleclient.cpp
resource/examples/simpleclientHQ.cpp
resource/examples/simpleclientserver.cpp
resource/examples/threadingsample.cpp
resource/include/IClientWrapper.h
resource/include/InProcClientWrapper.h
resource/include/OCPlatform.h
resource/include/OCPlatform_impl.h
resource/include/OCResource.h
resource/include/OCSerialization.h
resource/include/OutOfProcClientWrapper.h
resource/makefile
resource/src/InProcClientWrapper.cpp
resource/src/OCPlatform.cpp
resource/src/OCPlatform_impl.cpp
resource/src/OCResource.cpp
resource/src/SConscript
resource/unittests/makefile
service/protocol-plugin/sample-app/linux/SConscript
service/protocol-plugin/sample-app/linux/mqtt/mqttclient.cpp
service/soft-sensor-manager/SConscript
service/soft-sensor-manager/SSMCore/src/SensorProcessor/ResourceFinder.cpp
service/things-manager/SConscript
service/things-manager/sampleapp/linux/groupaction/SConscript
service/things-manager/sampleapp/linux/groupaction/groupserver.cpp
service/things-manager/sampleapp/linux/groupsyncaction/SConscript
service/things-manager/sampleapp/linux/groupsyncaction/group.cpp
service/things-manager/sdk/src/GroupManager.cpp
service/things-manager/sdk/src/GroupSynchronization.cpp
service/things-manager/sdk/src/ThingsConfiguration.cpp

index 56c42ea..b4a32e3 100644 (file)
@@ -47,8 +47,6 @@ if target_os == 'android':
 if target_os in ['darwin', 'ios']:
        examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
 
-examples_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index d218c26..67c4ce8 100644 (file)
@@ -59,8 +59,6 @@ if target_os in ['darwin', 'ios']:
 if not env.get('RELEASE'):
        liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
-liboctbstack_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index 3f028ea..57ad7e8 100644 (file)
@@ -125,10 +125,9 @@ INC_DIRS   += -I$(CONNECTIVITY_INC)
 INC_DIRS       += -I$(CONNECTIVITY_DIR)/api
 
 # TODO-CA Remove -fstack-protector-all before merging to master
-# TODO-CA Remove CA_INT flag after CA merging is finalized
-CC_FLAGS.debug         := -O0 -g3 -Wall -fstack-protector-all -c -fmessage-length=0 -pedantic -fpic -DTB_LOG -DCA_INT
+CC_FLAGS.debug         := -O0 -g3 -Wall -fstack-protector-all -c -fmessage-length=0 -pedantic -fpic -DTB_LOG 
 # TODO-CA Remove -fstack-protector-all before merging to master
-CC_FLAGS.release       := -Os -Wall -fstack-protector-all -c -fmessage-length=0 -fpic -DCA_INT
+CC_FLAGS.release       := -Os -Wall -fstack-protector-all -c -fmessage-length=0 -fpic 
 
 CFLAGS         += $(CC_FLAGS.$(BUILD)) $(INC_DIRS) $(CFLAGS_PLATFORM) $(INC_DIR_PLATFORM)
 LDLIBS         += -lcoap
index 568eb66..94f0e11 100644 (file)
 
 uint32_t GetTime(float afterSeconds);
 
-/**
- * Initialize the CoAP client or server with the its IPv4 address and CoAP port
- *
- * @param ipAddr
- *     IP Address of host device
- * @param port
- *     Port of host device
- * @param mode
- *     Host device is client, server, or client-server
- *
- * @return
- *   0   - success
- *   TBD - TBD error
- */
-OCStackResult OCInitCoAP(const char *address, uint16_t port, OCMode mode);
-
-/**
- * Discover OC resources
- *
- * @param method          - method to perform on the resource
- * @param qos             - CON or NON requests
- * @param token           - pointer to the token data structure
- * @param Uri             - URI of the resource to interact with
- * @param payload         - CoAP PDU payload
- * @param options         - The address of an array containing the vendor specific
- *                          header options to be sent with the request
- * @param numOptions      - The number of header options to be included
- * @return
- *   0   - success
- *   TBD - TBD error
- */
-#ifdef CA_INT
-OCStackResult OCDoCoAPResource(OCMethod method, OCQualityOfService qos, CAToken_t * token,
-        const char *Uri, const char *payload, OCHeaderOption * options, uint8_t numOptions);
-#else
-OCStackResult OCDoCoAPResource(OCMethod method, OCQualityOfService qos, OCCoAPToken * token,
-        const char *Uri, const char *payload, OCHeaderOption * options, uint8_t numOptions);
-#endif
-
-/**
- * Send a response to a request.
- *
- * @param response - pointer to OCServerProtocolResponse that contains all request and
- *                   response info necessary to send the response to the client
- * @return
- *     OC_STACK_OK               - No errors; Success
- *     OC_STACK_ERROR            - Error sending response
- */
-OCStackResult OCDoCoAPResponse(OCServerProtocolResponse *response);
-
-/**
- * Stop the CoAP client or server processing
- *
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCStopCoAP();
-
-/**
- * Called in main loop of CoAP client or server.  Allows low-level CoAP processing of
- * send, receive, timeout, discovery, callbacks, etc.
- *
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCProcessCoAP();
-
-/**
- * This method is called to generate a token of MAX_TOKEN_LENGTH.
- * This token is used to co-relate client requests with server responses.
- *
- */
-void OCGenerateCoAPToken(OCCoAPToken * token);
-
-/**
- * Retrieve the end-point info where resource is being hosted.
- * Currently, this method only provides the IP port with which the socket
- * is bound. This internal method may be extended in future to retrieve
- * more info (such as IP address, transport technology) about the hosting end-point.
- *
- * @param resPtr    - pointer to the resource
- * @param info      - pointer to 16-bit integer to hold port number
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCGetResourceEndPointInfo (OCResource *resPtr, void *info);
-
 #endif /* OCCOAP_H_ */
index 0b35716..8341e86 100644 (file)
 #define MAX_URI_QUERY_BUF_SIZE ((MAX_URI_LENGTH) >= (MAX_QUERY_LENGTH) ?\
                             (MAX_URI_LENGTH) : (MAX_QUERY_LENGTH))
 
-#define COAP_WK_IPAddr_0 (224)
-#define COAP_WK_IPAddr_1 (0)
-#define COAP_WK_IPAddr_2 (1)
-#define COAP_WK_IPAddr_3 (187)
-
 // checks if optionID is within vendor specific range
 OCStackResult isVendorSpecific(uint16_t optionID);
 
-// Convert OCStack code to CoAP code
-uint8_t OCToCoAPResponseCode(OCStackResult result);
-
-//Convert OCQualityOfService to coap NON vs CON
-uint8_t OCToCoAPQoS(OCQualityOfService qos, uint8_t * ipAddr);
-
-// Convert CoAP code to OCStack code
-OCStackResult CoAPToOCResponseCode(uint8_t coapCode);
-
-// Internal function to generate a coap pdu based on passed parameters
-#ifdef CA_INT
-coap_pdu_t *
-GenerateCoAPPdu(uint8_t msgType, uint8_t code, unsigned short id,
-        CAToken_t * token, unsigned char * payloadJSON,
-        coap_list_t *options);
-#else
-coap_pdu_t *
-GenerateCoAPPdu(uint8_t msgType, uint8_t code, unsigned short id,
-        OCCoAPToken * token, unsigned char * payloadJSON,
-        coap_list_t *options);
-#endif
-
-// Internal function to send a coap pdu, it also handles NON and CON
-OCStackResult
-SendCoAPPdu(coap_context_t * gCoAPCtx, coap_address_t* dst, coap_pdu_t * pdu,
-        coap_send_flags_t flag);
-
-// Call back function used by libcoap to order option in coap pdu
-int OrderOptions(void *a, void *b);
-
-// Internal function to create an option node for coap pdu
-coap_list_t *
-CreateNewOptionNode(unsigned short key, unsigned int length,
-        unsigned char *data);
-
-// Internal function to retrieve Uri and Query from received coap pdu
-OCStackResult ParseCoAPPdu(coap_pdu_t * pdu, unsigned char * uriBuf,
-        unsigned char * queryBuf, uint32_t * observeOption,
-        uint32_t * maxAgeOption,
-        uint8_t * numVendorSpecificHeaderOptions,
-        OCHeaderOption * vendorSpecificHeaderOptions,
-        coap_block_t * block1, coap_block_t * block2,
-        uint16_t * size1, uint16_t * size2,
-        unsigned char * payload);
-
-#ifdef CA_INT
-void RetrieveOCCoAPToken(const coap_pdu_t * pdu, CAToken_t * rcvdToken);
-#else
-void RetrieveOCCoAPToken(const coap_pdu_t * pdu, OCCoAPToken * rcvdToken);
-#endif
-
-// Internal function to create OCResponse struct at the client from a received coap pdu
-#ifdef CA_INT
 OCStackResult FormOCResponse(OCResponse * * responseLoc,  ClientCB * cbNode, uint32_t maxAge,
         unsigned char * fullUri, unsigned char * rcvdUri, CAToken_t * rcvdToken,
         OCClientResponse * clientResponse, unsigned char * bufRes);
-#else
-OCStackResult FormOCResponse(OCResponse * * responseLoc,  ClientCB * cbNode, uint32_t maxAge,
-        unsigned char * fullUri, unsigned char * rcvdUri, OCCoAPToken * rcvdToken,
-        OCClientResponse * clientResponse, unsigned char * bufRes);
-#endif
 
 // Internal function to create OCClientResponse struct at the client from a received coap pdu
 OCStackResult FormOCClientResponse(OCClientResponse * clientResponse,
         OCStackResult result, OCDevAddr * remote, uint32_t seqNum,
         const unsigned char * resJSONPayload);
 
-// Internal function to handle the queued pdus in the send queue
-void HandleSendQueue(coap_context_t * gCoAPCtx);
-
-// Internal function to form the standard response option list
-OCStackResult FormOptionList(coap_list_t * * optListLoc, uint8_t * addMediaType,
-        uint32_t * addMaxAge, uint32_t * observeOptionPtr,
-        uint16_t * addPortNumber, uint8_t uriLength, unsigned char * uri,
-        uint8_t queryLength, unsigned char * query, OCHeaderOption * vendorSpecificHeaderOptions,
-        uint8_t numVendorSpecificHeaderOptions);
-
-// Internal function to retransmit a queue
-OCStackResult ReTXCoAPQueue(coap_context_t * ctx, coap_queue_t * queue);
-
-// Internal function called when sending/retransmission fails
-OCStackResult HandleFailedCommunication(coap_context_t * ctx, coap_queue_t * queue);
 #endif /* OCCOAPHELPER_H_ */
index 412b8af..15a8a4c 100644 (file)
 //=============================================================================
 #define COAP_BLOCK_FILL_VALUE   (0xFF)
 
-//=============================================================================
-// Private Variables
-//=============================================================================
-
-static coap_context_t *gCoAPCtx = NULL;
-
-//=============================================================================
-// Helper Functions
-//=============================================================================
-
-//generate a coap token
-void OCGenerateCoAPToken(OCCoAPToken * token)
-{
-    if (token)
-    {
-        token->tokenLength = MAX_TOKEN_LENGTH;
-        OCFillRandomMem((uint8_t*)token->token, token->tokenLength);
-    }
-}
-
-//This function is called back by libcoap when ack or rst are received
-static void HandleCoAPAckRst(struct coap_context_t * ctx, uint8_t msgType,
-        const coap_queue_t * sentQueue){
-
-    // silence warnings
-    (void) ctx;
-    coap_pdu_t * sentPdu = sentQueue->pdu;
-    OCStackResult result = OC_STACK_ERROR;
-    uint32_t observationOption = OC_OBSERVE_NO_OPTION;
-    // {{0}} to eliminate warning for known compiler bug 53119
-    // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
-
-#ifdef CA_INT
-    CAToken_t  sentToken = NULL;
-#else // CA_INT
-    OCCoAPToken sentToken = {{0}};
-#endif // CA_INT
-
-    result = ParseCoAPPdu(sentPdu, NULL, NULL, &observationOption, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL, NULL);
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-    // fill OCCoAPToken structure
-    RetrieveOCCoAPToken(sentPdu, &sentToken);
-
-    if(msgType == COAP_MESSAGE_RST)
-    {
-        if(myStackMode != OC_CLIENT)
-        {
-            result = OCStackFeedBack(&sentToken, OC_OBSERVER_NOT_INTERESTED);
-            if(result == OC_STACK_OK)
-            {
-#ifdef CA_INT
-                OC_LOG_V(DEBUG, TAG,
-                        "Received RST, removing all queues associated with Token %d bytes",
-                        CA_MAX_TOKEN_LEN);
-                OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)sentToken, CA_MAX_TOKEN_LEN);
-                coap_cancel_all_messages(ctx, &sentQueue->remote, (unsigned char *)sentToken,
-                        CA_MAX_TOKEN_LEN);
-#else
-                OC_LOG_V(DEBUG, TAG,
-                        "Received RST, removing all queues associated with Token %d bytes",
-                        sentToken.tokenLength);
-                OC_LOG_BUFFER(INFO, TAG, sentToken.token, sentToken.tokenLength);
-                coap_cancel_all_messages(ctx, &sentQueue->remote, sentToken.token,
-                        sentToken.tokenLength);
-#endif
-            }
-        }
-    }
-    else if(observationOption != OC_OBSERVE_NO_OPTION && msgType == COAP_MESSAGE_ACK)
-    {
-#ifdef CA_INT
-#else
-        OC_LOG_V(DEBUG, TAG, "Received ACK, for Token %d bytes",sentToken.tokenLength);
-        OC_LOG_BUFFER(INFO, TAG, sentToken.token, sentToken.tokenLength);
-#endif
-        // now the observer is still interested
-        if(myStackMode != OC_CLIENT)
-        {
-            OCStackFeedBack(&sentToken, OC_OBSERVER_STILL_INTERESTED);
-        }
-    }
-exit:
-    return;
-}
-
-//This function is called back by libcoap when a request is received
-static void HandleCoAPRequests(struct coap_context_t *ctx,
-        const coap_queue_t * rcvdRequest)
-{
-    // silence warnings
-    (void) ctx;
-    OCServerProtocolRequest protocolRequest = {(OCMethod)0};
-    coap_block_t rcvdBlock1;
-    coap_block_t rcvdBlock2;
-    memset(&rcvdBlock1, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
-    memset(&rcvdBlock2, COAP_BLOCK_FILL_VALUE, sizeof(coap_block_t));
-    uint16_t rcvdSize1 = 0;
-    coap_pdu_t * rcvdPdu = rcvdRequest->pdu;
-    coap_pdu_t * sendPdu = NULL;
-    coap_send_flags_t sendFlag;
-    OCStackResult result = OC_STACK_ERROR;
-    OCStackResult requestResult = OC_STACK_ERROR;
-
-    if(myStackMode == OC_CLIENT)
-    {
-        //TODO: should the client be responding to requests?
-        return;
-    }
-
-    protocolRequest.observationOption = OC_OBSERVE_NO_OPTION;
-    protocolRequest.qos = (rcvdPdu->hdr->type == COAP_MESSAGE_CON) ?
-            OC_HIGH_QOS : OC_LOW_QOS;
-    protocolRequest.coapID = rcvdPdu->hdr->id;
-    protocolRequest.delayedResNeeded = rcvdRequest->delayedResNeeded;
-    protocolRequest.secured = rcvdRequest->secure;
-
-    // fill OCCoAPToken structure
-    RetrieveOCCoAPToken(rcvdPdu, &protocolRequest.requestToken);
-#ifdef CA_INT
-#else
-    OC_LOG_V(INFO, TAG, " Token received %d bytes",
-            protocolRequest.requestToken.tokenLength);
-    OC_LOG_BUFFER(INFO, TAG, protocolRequest.requestToken.token,
-            protocolRequest.requestToken.tokenLength);
-#endif
-
-    // fill OCDevAddr
-    memcpy(&protocolRequest.requesterAddr, (OCDevAddr *) &rcvdRequest->remote,
-            sizeof(OCDevAddr));
-
-    // Retrieve Uri and Query from received coap pdu
-    result =  ParseCoAPPdu(rcvdPdu, protocolRequest.resourceUrl,
-            protocolRequest.query,
-            &(protocolRequest.observationOption), NULL,
-            &(protocolRequest.numRcvdVendorSpecificHeaderOptions),
-            protocolRequest.rcvdVendorSpecificHeaderOptions,
-            &rcvdBlock1, &rcvdBlock2, &rcvdSize1, NULL,
-            protocolRequest.reqJSONPayload);
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-    switch (rcvdPdu->hdr->code)
-    {
-        case COAP_REQUEST_GET:
-        {
-            protocolRequest.method = OC_REST_GET;
-            break;
-        }
-        case COAP_REQUEST_POST:
-        {
-            protocolRequest.method = OC_REST_POST;
-            break;
-        }
-        case COAP_REQUEST_DELETE:
-        {
-            protocolRequest.method = OC_REST_DELETE;
-            break;
-        }
-        case COAP_REQUEST_PUT:
-        {
-            protocolRequest.method = OC_REST_PUT;
-            break;
-        }
-        default:
-        {
-            OC_LOG_V(ERROR, TAG, "Received CoAP method %d not supported",
-                    rcvdPdu->hdr->code);
-            goto exit;
-        }
-    }
-
-    if(rcvdBlock1.szx != 7)
-    {
-        protocolRequest.reqPacketSize = 1 << (rcvdBlock1.szx + 4);
-        protocolRequest.reqMorePacket = rcvdBlock1.m;
-        protocolRequest.reqPacketNum  = rcvdBlock1.num;
-    }
-    else
-    {
-        // No block1 received
-        rcvdSize1= strlen((const char*)protocolRequest.reqJSONPayload)+1;
-        protocolRequest.reqTotalSize = rcvdSize1;
-    }
-
-    if(rcvdBlock2.szx != 7)
-    {
-        protocolRequest.resPacketSize = 1 << (rcvdBlock2.szx + 4);
-        protocolRequest.resPacketNum  = rcvdBlock2.num;
-    }
-
-    requestResult = HandleStackRequests(&protocolRequest);
-
-    if(requestResult == OC_STACK_VIRTUAL_DO_NOT_HANDLE ||
-            requestResult == OC_STACK_OK ||
-            requestResult == OC_STACK_RESOURCE_CREATED ||
-            requestResult == OC_STACK_RESOURCE_DELETED ||
-            requestResult == OC_STACK_INVALID_DEVICE_INFO)
-    {
-        goto exit;
-    }
-    else if(requestResult == OC_STACK_NO_MEMORY ||
-            requestResult == OC_STACK_ERROR ||
-            requestResult == OC_STACK_NOTIMPL ||
-            requestResult == OC_STACK_NO_RESOURCE ||
-            requestResult == OC_STACK_RESOURCE_ERROR)
-    {
-        // TODO: should we send an error also when we receive a non-secured request to a secure resource?
-        // TODO: should we consider some sort of error response
-        OC_LOG(DEBUG, TAG, PCF("We should send some sort of error message"));
-        // generate the pdu, if the request was CON, then the response is ACK, otherwire NON
-        sendPdu = GenerateCoAPPdu((rcvdPdu->hdr->type == COAP_MESSAGE_CON)? COAP_MESSAGE_ACK : COAP_MESSAGE_NON,
-                OCToCoAPResponseCode(requestResult), rcvdPdu->hdr->id,
-                &protocolRequest.requestToken, NULL, NULL);
-        VERIFY_NON_NULL(sendPdu);
-        coap_show_pdu(sendPdu);
-        sendFlag = (coap_send_flags_t)(rcvdRequest->secure ? SEND_SECURE_PORT : 0);
-        if(SendCoAPPdu(gCoAPCtx, (coap_address_t*) &(rcvdRequest->remote), sendPdu,
-                sendFlag)
-                != OC_STACK_OK){
-            OC_LOG(DEBUG, TAG, PCF("A problem occurred in sending a pdu"));
-        }
-        goto exit;
-    }
-    else if(requestResult == OC_STACK_SLOW_RESOURCE)
-    {
-        if(rcvdPdu->hdr->type == COAP_MESSAGE_CON)
-        {
-            // generate the pdu, if the request was CON, then the response is ACK, otherwire NON
-            sendPdu = GenerateCoAPPdu(COAP_MESSAGE_ACK, 0, rcvdPdu->hdr->id,
-                    NULL, NULL, NULL);
-            VERIFY_NON_NULL(sendPdu);
-            coap_show_pdu(sendPdu);
-
-            sendFlag = (coap_send_flags_t)(rcvdRequest->secure ? SEND_SECURE_PORT : 0);
-            if(SendCoAPPdu(gCoAPCtx, (coap_address_t*) &(rcvdRequest->remote), sendPdu,
-                    sendFlag)
-                    != OC_STACK_OK){
-                OC_LOG(DEBUG, TAG, PCF("A problem occurred in sending a pdu"));
-            }
-        }
-        else
-        {
-            goto exit;
-        }
-    }
-exit:
-    return;
-}
-
 uint32_t GetTime(float afterSeconds)
 {
     coap_tick_t now;
@@ -308,433 +58,3 @@ uint32_t GetTime(float afterSeconds)
     return now + (uint32_t)(afterSeconds * COAP_TICKS_PER_SECOND);
 }
 
-//This function is called back by libcoap when a response is received
-static void HandleCoAPResponses(struct coap_context_t *ctx,
-        const coap_queue_t * rcvdResponse) {
-    OCStackResult result = OC_STACK_OK;
-#ifdef CA_INT
-    CAToken_t  rcvdToken = NULL;
-#else // CA_INT
-    OCCoAPToken rcvdToken = {{0}};
-#endif // CA_INT
-    OCResponse * response = NULL;
-    OCClientResponse * clientResponse = NULL;
-    unsigned char bufRes[MAX_RESPONSE_LENGTH] = {0};
-    coap_pdu_t * sendPdu = NULL;
-    coap_pdu_t * recvPdu = NULL;
-    uint8_t remoteIpAddr[4] = {0};
-    uint16_t remotePortNu = 0;
-    uint32_t sequenceNumber = OC_OBSERVE_NO_OPTION;
-    uint32_t maxAge = 0;
-    unsigned char fullUri[MAX_URI_LENGTH] = { 0 };
-    unsigned char rcvdUri[MAX_URI_LENGTH] = { 0 };
-    coap_block_t rcvdBlock1 = {COAP_BLOCK_FILL_VALUE};
-    coap_block_t rcvdBlock2 = {COAP_BLOCK_FILL_VALUE};
-    uint16_t rcvdSize2 = 0;
-
-    VERIFY_NON_NULL(ctx);
-    VERIFY_NON_NULL(rcvdResponse);
-    recvPdu = rcvdResponse->pdu;
-
-    clientResponse = (OCClientResponse *) OCCalloc(1, sizeof(OCClientResponse));
-
-    result = ParseCoAPPdu(recvPdu, rcvdUri, NULL, &sequenceNumber, &maxAge,
-            &(clientResponse->numRcvdVendorSpecificHeaderOptions),
-            clientResponse->rcvdVendorSpecificHeaderOptions,
-            &rcvdBlock1, &rcvdBlock2, NULL, &rcvdSize2, bufRes);
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-    // get the address of the remote
-    OCDevAddrToIPv4Addr((OCDevAddr *) &(rcvdResponse->remote), remoteIpAddr,
-            remoteIpAddr + 1, remoteIpAddr + 2, remoteIpAddr + 3);
-    OCDevAddrToPort((OCDevAddr *) &(rcvdResponse->remote), &remotePortNu);
-    snprintf((char *)fullUri, MAX_URI_LENGTH, "coap://%d.%d.%d.%d:%d%s",
-            remoteIpAddr[0],remoteIpAddr[1],remoteIpAddr[2],remoteIpAddr[3],
-            remotePortNu,rcvdUri);
-
-    // fill OCCoAPToken structure
-    RetrieveOCCoAPToken(recvPdu, &rcvdToken);
-#ifdef CA_INT
-#else
-    OC_LOG_V(INFO, TAG,"Received a pdu with Token", rcvdToken.tokenLength);
-    OC_LOG_BUFFER(INFO, TAG, rcvdToken.token, rcvdToken.tokenLength);
-#endif
-
-    // fill OCClientResponse structure
-    result = FormOCClientResponse(clientResponse, CoAPToOCResponseCode(recvPdu->hdr->code),
-            (OCDevAddr *) &(rcvdResponse->remote), sequenceNumber, NULL);
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-
-    result = FormOCResponse(&response, NULL, maxAge, fullUri, rcvdUri,
-            &rcvdToken, clientResponse, bufRes);
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-    result = HandleStackResponses(response);
-
-    if(result == OC_STACK_ERROR)
-    {
-        OC_LOG(INFO, TAG, PCF("Received a notification or response that is malformed or incorrect \
-                         ------------ sending RESET"));
-        sendPdu = GenerateCoAPPdu(COAP_MESSAGE_RST, 0,
-                recvPdu->hdr->id, NULL, NULL, NULL);
-        VERIFY_NON_NULL(sendPdu);
-        result = SendCoAPPdu(gCoAPCtx, (coap_address_t*) &rcvdResponse->remote, sendPdu,
-                     (coap_send_flags_t)(rcvdResponse->secure ? SEND_SECURE_PORT : 0));
-        VERIFY_SUCCESS(result, OC_STACK_OK);
-    }
-    else if(result == OC_STACK_NO_MEMORY)
-    {
-        OC_LOG(ERROR, TAG, PCF("Received a notification or response. While processing, local " \
-                "platform or memory pool ran out memory."));
-    }
-
-    if(recvPdu->hdr->type == COAP_MESSAGE_CON)
-    {
-        sendPdu = GenerateCoAPPdu(COAP_MESSAGE_ACK, 0,
-                recvPdu->hdr->id, NULL, NULL, NULL);
-        VERIFY_NON_NULL(sendPdu);
-        result = SendCoAPPdu(gCoAPCtx, (coap_address_t*) &rcvdResponse->remote,
-                sendPdu,
-                (coap_send_flags_t)(rcvdResponse->secure ? SEND_SECURE_PORT : 0));
-        VERIFY_SUCCESS(result, OC_STACK_OK);
-    }
-
-    exit:
-        OCFree(response);
-        OCFree(clientResponse);
-}
-
-//=============================================================================
-// Functions
-//=============================================================================
-
-/**
- * Initialize the CoAP client or server with its IPv4 address and CoAP port
- *
- * @param ipAddr
- *     IP Address of host device
- * @param port
- *     Port of host device
- * @param mode
- *     Host device is client, server, or client-server
- *
- * @return
- *   0   - success
- *   TBD - TBD error
- */
-OCStackResult OCInitCoAP(const char *address, uint16_t port, OCMode mode) {
-
-    OCStackResult ret = OC_STACK_ERROR;
-
-    TODO ("Below should go away and be replaced by OC_LOG");
-    coap_log_t log_level = (coap_log_t)(LOG_DEBUG + 1);
-    OCDevAddr mcastAddr;
-    uint8_t ipAddr[4] = { 0 };
-    uint16_t parsedPort = 0;
-
-    OC_LOG(INFO, TAG, PCF("Entering OCInitCoAP"));
-
-    coap_set_log_level(log_level);
-
-    if (address)
-    {
-        if (!ParseIPv4Address((unsigned char *) address, ipAddr, &parsedPort))
-        {
-            ret = OC_STACK_ERROR;
-            goto exit;
-        }
-
-        OC_LOG_V(INFO, TAG, "Parsed IP Address %d.%d.%d.%d",
-                               ipAddr[0],ipAddr[1],ipAddr[2],ipAddr[3]);
-    }
-
-    gCoAPCtx = coap_new_context(ipAddr, port);
-    VERIFY_NON_NULL(gCoAPCtx);
-
-    // To allow presence notification work we need to init socket gCoAPCtx->sockfd_wellknown
-    // for servers as well as clients
-    OCBuildIPv4Address(COAP_WK_IPAddr_0, COAP_WK_IPAddr_1, COAP_WK_IPAddr_2,
-            COAP_WK_IPAddr_3, COAP_DEFAULT_PORT, &mcastAddr);
-    VERIFY_SUCCESS(
-            coap_join_wellknown_group(gCoAPCtx,
-                    (coap_address_t* )&mcastAddr), 0);
-
-    coap_register_request_handler(gCoAPCtx, HandleCoAPRequests);
-    coap_register_response_handler(gCoAPCtx, HandleCoAPResponses);
-    coap_register_ack_rst_handler(gCoAPCtx, HandleCoAPAckRst);
-
-    ret = OC_STACK_OK;
-
-exit:
-    if (ret != OC_STACK_OK)
-    {
-        OCStopCoAP();
-    }
-    return ret;
-}
-
-/**
- * Discover OC resources
- *
- * @param method          - method to perform on the resource
- * @param qos             - Quality of Service the request will be sent on
- * @param token           - token which will added to the request
- * @param Uri             - URI of the resource to interact with
- * @param payload         - the request payload to be added to the request before sending
- *                          by the stack when discovery or resource interaction is complete
- * @param options         - The address of an array containing the vendor specific
- *                          header options to be sent with the request
- * @return
- *   0   - success
- *   TBD - TBD error
- */
-#ifdef CA_INT
-OCStackResult OCDoCoAPResource(OCMethod method, OCQualityOfService qos, CAToken_t * token,
-                     const char *Uri, const char *payload, OCHeaderOption * options, uint8_t numOptions)
-#else
-OCStackResult OCDoCoAPResource(OCMethod method, OCQualityOfService qos, OCCoAPToken * token,
-                     const char *Uri, const char *payload, OCHeaderOption * options, uint8_t numOptions)
-#endif
-{
-
-    OCStackResult ret = OC_STACK_ERROR;
-    coap_pdu_t *pdu = NULL;
-    coap_uri_t uri;
-    OCDevAddr dst;
-    uint8_t ipAddr[4] = { 0 };
-    uint16_t port = 0;
-    coap_list_t *optList = NULL;
-    uint8_t coapMsgType;
-    uint8_t coapMethod;
-    uint32_t observeOption;
-    coap_send_flags_t flag = (coap_send_flags_t)0;
-
-    OC_LOG(INFO, TAG, PCF("Entering OCDoCoAPResource"));
-
-    if (Uri) {
-        OC_LOG_V(INFO, TAG, "URI = %s", Uri);
-        VERIFY_SUCCESS(coap_split_uri((unsigned char * )Uri, strlen(Uri), &uri), OC_STACK_OK);
-
-        // Generate the destination address
-        if (uri.host.length && ParseIPv4Address(uri.host.s, ipAddr, &port)) {
-            OCBuildIPv4Address(ipAddr[0], ipAddr[1], ipAddr[2], ipAddr[3], uri.port,
-                    &dst);
-        } else {
-            goto exit;
-        }
-
-        VERIFY_SUCCESS(FormOptionList(&optList, NULL, NULL, NULL,
-                (uint16_t*)&uri.port, uri.path.length, uri.path.s, uri.query.length,
-                uri.query.s, options, numOptions), OC_STACK_OK);
-
-        //TODO : Investigate the scenario where there will be no uri for OCDoCoAPResource
-        flag = (coap_send_flags_t) (uri.secure ? SEND_SECURE_PORT : 0);
-        OC_LOG_V(DEBUG, TAG, "uri.host.s %s", uri.host.s);
-        OC_LOG_V(DEBUG, TAG, "uri.path.s %s", uri.path.s);
-        OC_LOG_V(DEBUG, TAG, "uri.port %d", uri.port);
-        OC_LOG_V(DEBUG, TAG, "uri.query.s %s", uri.query.s);
-        OC_LOG_V(DEBUG, TAG, "secure uri %d", uri.secure);
-    }
-
-    coapMsgType = OCToCoAPQoS(qos, ipAddr);
-
-    // Decide method type
-    switch (method) {
-        case OC_REST_GET:
-            coapMethod = COAP_REQUEST_GET;
-            break;
-        case OC_REST_PUT:
-            coapMethod = COAP_REQUEST_PUT;
-            break;
-        case OC_REST_POST:
-            coapMethod = COAP_REQUEST_POST;
-            break;
-        case OC_REST_DELETE:
-            coapMethod = COAP_REQUEST_DELETE;
-            break;
-        case OC_REST_OBSERVE_ALL:
-        case OC_REST_OBSERVE:
-        case OC_REST_CANCEL_OBSERVE:
-            coapMethod = COAP_REQUEST_GET;
-            observeOption = (method == OC_REST_CANCEL_OBSERVE)?
-                    OC_OBSERVE_DEREGISTER:OC_OBSERVE_REGISTER;
-            coap_insert(&optList, CreateNewOptionNode(COAP_OPTION_OBSERVE,
-                        sizeof(observeOption), (uint8_t *)&observeOption), OrderOptions);
-            break;
-        default:
-            coapMethod = OC_REST_NOMETHOD;
-            OC_LOG(FATAL, TAG, PCF("OCDoCoAPResource only supports GET, PUT, & OBSERVE methods"));
-            break;
-    }
-
-    VERIFY_NON_NULL(gCoAPCtx);
-    pdu = GenerateCoAPPdu(coapMsgType, coapMethod,
-            coap_new_message_id(gCoAPCtx), token,
-            (unsigned char*) payload, optList);
-    VERIFY_NON_NULL(pdu);
-
-    ret = SendCoAPPdu(gCoAPCtx, (coap_address_t*) &dst, pdu, flag);
-
-exit:
-    if (ret!= OC_STACK_OK)
-    {
-        OC_LOG(DEBUG, TAG, PCF("A problem occurred in sending a pdu"));
-    }
-    return ret;
-}
-
-OCStackResult OCDoCoAPResponse(OCServerProtocolResponse *response)
-{
-    OCStackResult result = OC_STACK_ERROR;
-    coap_pdu_t * sendPdu = NULL;
-    coap_list_t *optList = NULL;
-    uint8_t msgType = COAP_MESSAGE_NON;
-    uint8_t mediaType = COAP_MEDIATYPE_APPLICATION_JSON;
-    uint32_t maxAge = 0x2ffff;
-    coap_send_flags_t sendFlag = (coap_send_flags_t)0;
-
-    //uint32_t observeOption = OC_OBSERVE_NO_OPTION;
-    //OCStackResult responseResult;
-
-    OC_LOG(INFO, TAG, PCF("Entering OCDoCoAPResponse"));
-
-    if(response->notificationFlag && response->qos == OC_HIGH_QOS)
-    {
-        msgType = COAP_MESSAGE_CON;
-    }
-    else if(response->notificationFlag && response->qos != OC_HIGH_QOS)
-    {
-        msgType = COAP_MESSAGE_NON;
-    }
-    else if(!response->notificationFlag && !response->slowFlag && response->qos == OC_HIGH_QOS)
-    {
-        msgType = COAP_MESSAGE_ACK;
-    }
-    else if(!response->notificationFlag && response->slowFlag && response->qos == OC_HIGH_QOS)
-    {
-        msgType = COAP_MESSAGE_CON;
-    }
-    else if(!response->notificationFlag)
-    {
-        msgType = COAP_MESSAGE_NON;
-    }
-
-    if(response->coapID == 0)
-    {
-        response->coapID = coap_new_message_id(gCoAPCtx);
-    }
-
-    if (response->observationOption != OC_OBSERVE_NO_OPTION)
-    {
-        result = FormOptionList(&optList, &mediaType, &maxAge,
-                &response->observationOption, NULL,
-                strlen((char *)response->resourceUri), response->resourceUri,
-                0, NULL,
-                response->sendVendorSpecificHeaderOptions,
-                response->numSendVendorSpecificHeaderOptions);
-    }
-    else
-    {
-        result = FormOptionList(&optList, &mediaType, &maxAge,
-                NULL, NULL,
-                strlen((char *)response->resourceUri), response->resourceUri,
-                0, NULL,
-                response->sendVendorSpecificHeaderOptions,
-                response->numSendVendorSpecificHeaderOptions);
-    }
-    VERIFY_SUCCESS(result, OC_STACK_OK);
-
-    sendPdu = GenerateCoAPPdu(msgType, OCToCoAPResponseCode(response->result),
-            response->coapID, response->requestToken, (unsigned char *)response->payload,
-            optList);
-
-    VERIFY_NON_NULL(sendPdu);
-    coap_show_pdu(sendPdu);
-
-    sendFlag = (coap_send_flags_t)(response->delayedResNeeded ? SEND_DELAYED : 0);
-    sendFlag = (coap_send_flags_t)( sendFlag | (response->secured ? SEND_SECURE_PORT : 0));
-
-    if (SendCoAPPdu(gCoAPCtx, (coap_address_t *) (response->requesterAddr), sendPdu, sendFlag)
-            != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, TAG, PCF("A problem occurred in sending a pdu"));
-        return OC_STACK_ERROR;
-    }
-    return OC_STACK_OK;
-exit:
-    OC_LOG(ERROR, TAG, PCF("Error formatting server response"));
-    return OC_STACK_ERROR;
-}
-
-/**
- * Stop the CoAP client or server processing
- *
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCStopCoAP() {
-    OC_LOG(INFO, TAG, PCF("Entering OCStopCoAP"));
-    coap_free_context(gCoAPCtx);
-    gCoAPCtx = NULL;
-    return OC_STACK_OK;
-}
-
-/**
- * Called in main loop of CoAP client or server.  Allows low-level CoAP processing of
- * send, receive, timeout, discovery, callbacks, etc.
- *
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCProcessCoAP() {
-    int read = 0;
-    read = coap_read(gCoAPCtx, gCoAPCtx->sockfd);
-    if(read > 0) {
-        OC_LOG(INFO, TAG, PCF("This is a Unicast<============"));
-    }
-    if (-1 != gCoAPCtx->sockfd_wellknown) {
-        read = coap_read(gCoAPCtx, gCoAPCtx->sockfd_wellknown);
-        if(read > 0)
-        {
-            OC_LOG(INFO, TAG, PCF("This is a Multicast<==========="));
-        }
-    }
-    if (-1 != gCoAPCtx->sockfd_dtls) {
-        read = coap_read(gCoAPCtx, gCoAPCtx->sockfd_dtls);
-        if(read > 0)
-        {
-            OC_LOG(INFO, TAG, PCF("This is a Secure packet<==========="));
-        }
-    }
-    coap_dispatch(gCoAPCtx);
-
-    HandleSendQueue(gCoAPCtx);
-
-    return OC_STACK_OK;
-}
-
-
-/**
- * Retrieve the info about the end-point where resource is being hosted.
- * Currently, this method only provides the IP port with which the socket
- * is bound.
- *
- * @return 0 - success, else - TBD error
- */
-OCStackResult OCGetResourceEndPointInfo (OCResource *resPtr, void *info) {
-
-    OCStackResult result = OC_STACK_ERROR;
-    int sfd;
-    OC_LOG(INFO, TAG, PCF("Entering OCGetResourceEndPointInfo"));
-    VERIFY_NON_NULL(resPtr);
-    VERIFY_NON_NULL(info);
-
-    sfd = (resPtr->resourceProperties & OC_SECURE) ? gCoAPCtx->sockfd_dtls :
-            gCoAPCtx->sockfd;
-
-    if (OCGetSocketInfo(sfd, (uint16_t*)info) == ERR_SUCCESS)
-        result = OC_STACK_OK;
-exit:
-    return result;
-}
-
-
index 3a5c861..d3ccc06 100644 (file)
@@ -27,9 +27,7 @@
 #include "coap_time.h"
 #include "ocmalloc.h"
 
-#ifdef CA_INT
 #include "cacommon.h"
-#endif
 
 //-----------------------------------------------------------------------------
 // Macros
@@ -50,331 +48,9 @@ OCStackResult isVendorSpecific(uint16_t optionID)
     return OC_STACK_INVALID_OPTION;
 }
 
-// Convert OCStack code to CoAP code
-uint8_t OCToCoAPResponseCode(OCStackResult result)
-{
-    uint8_t ret;
-    switch(result)
-    {
-        case OC_STACK_OK :
-            ret = COAP_RESPONSE_200;
-            break;
-
-        case OC_STACK_RESOURCE_CREATED:
-            ret = COAP_RESPONSE_201;
-            break;
-
-        case OC_STACK_RESOURCE_DELETED:
-            ret = COAP_RESPONSE_202;
-            break;
-
-        case OC_STACK_INVALID_QUERY :
-            ret = COAP_RESPONSE_400;
-            break;
-
-        case OC_STACK_RESOURCE_ERROR:
-            return COAP_RESPONSE_403;
-            break;
-
-        case OC_STACK_NO_RESOURCE :
-            ret = COAP_RESPONSE_404;
-            break;
-
-        case OC_STACK_INVALID_METHOD :
-            ret = COAP_RESPONSE_405;
-            break;
-
-        case OC_STACK_NOTIMPL :
-            ret = COAP_RESPONSE_501;
-            break;
-
-        default:
-            ret = COAP_RESPONSE_500;
-    }
-    return ret;
-}
-
-uint8_t OCToCoAPQoS(OCQualityOfService qos, uint8_t * ipAddr)
-{
-    if(ipAddr[0] == COAP_WK_IPAddr_0 && ipAddr[1] == COAP_WK_IPAddr_1 &&
-            ipAddr[2] == COAP_WK_IPAddr_2 && ipAddr[3] == COAP_WK_IPAddr_3)
-    {
-        return COAP_MESSAGE_NON;
-    }
-    switch (qos)
-    {
-        case OC_HIGH_QOS:
-            return COAP_MESSAGE_CON;
-            break;
-        case OC_MEDIUM_QOS:
-        case OC_LOW_QOS:
-        case OC_NA_QOS:
-        default:
-            return COAP_MESSAGE_NON;
-            break;
-    }
-}
-
-OCQualityOfService CoAPToOCQoS(uint8_t qos)
-{
-    switch (qos)
-    {
-        case COAP_MESSAGE_CON:
-            return OC_HIGH_QOS;
-        case COAP_MESSAGE_NON:
-            return OC_LOW_QOS;
-        default:
-            return OC_NA_QOS;
-    }
-}
-// Convert CoAP code to OCStack code
-OCStackResult CoAPToOCResponseCode(uint8_t coapCode)
-{
-    OCStackResult ret;
-    int decimal;
-    switch(coapCode)
-    {
-        case COAP_RESPONSE_200 :
-            ret = OC_STACK_OK;
-            break;
-
-        case COAP_RESPONSE_201 :
-            ret = OC_STACK_RESOURCE_CREATED;
-            break;
-
-        case COAP_RESPONSE_202 :
-            ret = OC_STACK_RESOURCE_DELETED;
-            break;
-
-        case COAP_RESPONSE_400 :
-            ret = OC_STACK_INVALID_QUERY;
-            break;
-
-        case COAP_RESPONSE_403 :
-            ret = OC_STACK_RESOURCE_ERROR;
-            break;
-
-        case COAP_RESPONSE_404 :
-            ret = OC_STACK_NO_RESOURCE;
-            break;
-
-        case COAP_RESPONSE_405 :
-            ret = OC_STACK_INVALID_METHOD;
-            break;
-
-        case COAP_RESPONSE_501 :
-            ret = OC_STACK_NOTIMPL;
-            break;
-
-        default:
-            decimal = ((coapCode >> 5) * 100) + (coapCode & 31);
-            if (decimal >= 200 && decimal <= 231)
-            {
-                ret = OC_STACK_OK;
-            }
-            else
-            {
-                ret = OC_STACK_ERROR;
-            }
-    }
-    return ret;
-}
-
-// Retrieve Uri and Query from received coap pdu
-OCStackResult ParseCoAPPdu(coap_pdu_t * pdu, unsigned char * uriBuf,
-        unsigned char * queryBuf, uint32_t * observeOption,
-        uint32_t * maxAgeOption,
-        uint8_t * numVendorSpecificHeaderOptions,
-        OCHeaderOption * vendorSpecificHeaderOptions,
-        coap_block_t * block1, coap_block_t * block2,
-        uint16_t * size1, uint16_t * size2,
-        unsigned char * payload)
-{
-    coap_opt_filter_t filter;
-    coap_opt_iterator_t opt_iter;
-    coap_opt_t *option = NULL;
-    size_t optLen = 0;
-    unsigned char * optVal = NULL;
-    size_t uriBufLen = 0;
-    size_t queryBufLen = 0;
-    unsigned char * payloadLoc = NULL;
-    size_t payloadLength = 0;
-
-    coap_option_filter_clear(filter);
-    if(uriBuf)
-    {
-        coap_option_setb(filter, COAP_OPTION_URI_PATH);
-    }
-    if(queryBuf)
-    {
-        coap_option_setb(filter, COAP_OPTION_URI_QUERY);
-    }
-    if(observeOption)
-    {
-        coap_option_setb(filter, COAP_OPTION_OBSERVE);
-    }
-    if(maxAgeOption)
-    {
-        coap_option_setb(filter, COAP_OPTION_MAXAGE);
-    }
-    if(block1)
-    {
-        coap_option_setb(filter, COAP_OPTION_BLOCK1);
-    }
-    if(block2)
-    {
-        coap_option_setb(filter, COAP_OPTION_BLOCK2);
-    }
-    if(size1)
-    {
-        coap_option_setb(filter, COAP_OPTION_SIZE1);
-    }
-    if(size2)
-    {
-        coap_option_setb(filter, COAP_OPTION_SIZE2);
-    }
-    if(vendorSpecificHeaderOptions)
-    {
-        coap_option_setbVendor(filter);
-    }
-    if(payload)
-    {
-        coap_get_data(pdu, &payloadLength, &payloadLoc);
-        memcpy(payload, payloadLoc, payloadLength);
-    }
-    coap_option_iterator_init(pdu, &opt_iter, filter);
-
-    while ((option = coap_option_next(&opt_iter)))
-    {
-        optLen = COAP_OPT_LENGTH(option);
-        optVal = COAP_OPT_VALUE(option);
-        switch(opt_iter.type)
-        {
-        case COAP_OPTION_URI_PATH:
-            if (uriBufLen + 1 + optLen < MAX_URI_LENGTH)
-            {
-                //we still have room in the buffer
-                uriBuf[uriBufLen++] = '/';
-                memcpy(uriBuf + uriBufLen, optVal, optLen);
-                uriBufLen += optLen;
-            }
-            else
-            {
-                return OC_STACK_NO_MEMORY;
-            }
-            break;
-        case COAP_OPTION_URI_QUERY:
-            if (queryBufLen + 1 + optLen < MAX_QUERY_LENGTH)
-            {
-                //we still have room in the buffer
-                memcpy(queryBuf + queryBufLen, optVal, optLen);
-                queryBufLen += optLen;
-                queryBuf[queryBufLen++] = '&';
-            }
-            else
-            {
-                // TODO: we should check that resources do not have long uri
-                // at the resource creation
-                return OC_STACK_NO_MEMORY;
-            }
-            break;
-        case COAP_OPTION_OBSERVE:
-            memcpy(observeOption, optVal, optLen);
-            OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^Parsing the observe option %u",
-                    *observeOption);
-            break;
-        case COAP_OPTION_MAXAGE:
-            memcpy(maxAgeOption, optVal, optLen);
-            OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^Parsing the max age option %u",
-                    *maxAgeOption);
-            break;
-        case COAP_OPTION_BLOCK1:
-            block1->szx = COAP_OPT_BLOCK_SZX(option);
-            block1->num = coap_opt_block_num(option);
-            block1->m = 0;
-            if(COAP_OPT_BLOCK_MORE(option))
-            {
-                block1->m = 1;
-            }
-            OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^Parsing block1 %u:%u:%u",
-                    block1->num, block1->m, block1->szx);
-            break;
-        case COAP_OPTION_BLOCK2:
-            block2->szx = COAP_OPT_BLOCK_SZX(option);
-            block2->num = coap_opt_block_num(option);
-            block2->m = 0;
-            if(COAP_OPT_BLOCK_MORE(option))
-            {
-                block2->m = 1;
-            }
-            OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^Parsing block2 %u:%u:%u",
-                    block1->num, block1->m, block1->szx);
-            break;
-        case COAP_OPTION_SIZE1:
-            break;
-        case COAP_OPTION_SIZE2:
-            break;
-        default:
-            if(*numVendorSpecificHeaderOptions >= MAX_HEADER_OPTIONS ||
-                    optLen > MAX_HEADER_OPTION_DATA_LENGTH)
-            {
-                return OC_STACK_NO_MEMORY;
-            }
-            vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].protocolID = OC_COAP_ID;
-            vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionID = opt_iter.type;
-            vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionLength = optLen;
-            memcpy(vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionData, optVal, optLen);
-            OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^Parsing vendor specific option %u",
-                    vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionID);
-            OC_LOG_BUFFER(DEBUG, TAG, vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionData,
-                    vendorSpecificHeaderOptions[*numVendorSpecificHeaderOptions].optionLength);
-            (*numVendorSpecificHeaderOptions)++;
-        }
-    }
-
-    if(uriBuf)
-    {
-        uriBuf[uriBufLen] = '\0';
-    }
-    // delete last '&' in the query
-    if(queryBuf)
-    {
-        queryBuf[queryBufLen?queryBufLen-1:queryBufLen] = '\0';
-    }
-
-    OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^The final parsed uri is %s", uriBuf);
-    OC_LOG_V(DEBUG, TAG, "^^^^^^^^^^^^The final parsed query is %s", queryBuf);
-    return OC_STACK_OK;
-}
-
-// Retrieve the token from the PDU
-#ifdef CA_INT
-void RetrieveOCCoAPToken(const coap_pdu_t * pdu, CAToken_t * rcvdToken)
-#else
-void RetrieveOCCoAPToken(const coap_pdu_t * pdu, OCCoAPToken * rcvdToken)
-#endif
-{
-    if (pdu && rcvdToken)
-    {
-#ifdef CA_INT
-        memcpy(*rcvdToken, pdu->hdr->token, CA_MAX_TOKEN_LEN);
-#else
-        rcvdToken->tokenLength = pdu->hdr->token_length;
-        memcpy(rcvdToken->token, pdu->hdr->token,
-            rcvdToken->tokenLength);
-#endif
-    }
-}
-
-#ifdef CA_INT
 OCStackResult FormOCResponse(OCResponse * * responseLoc,  ClientCB * cbNode, uint32_t maxAge,
         unsigned char * fullUri, unsigned char * rcvdUri, CAToken_t * rcvdToken,
         OCClientResponse * clientResponse, unsigned char * bufRes)
-#else
-OCStackResult FormOCResponse(OCResponse * * responseLoc,  ClientCB * cbNode, uint32_t maxAge,
-        unsigned char * fullUri, unsigned char * rcvdUri, OCCoAPToken * rcvdToken,
-        OCClientResponse * clientResponse, unsigned char * bufRes)
-#endif
 {
     OCResponse * response = (OCResponse *) OCMalloc(sizeof(OCResponse));
     if (!response)
@@ -405,376 +81,3 @@ OCStackResult FormOCClientResponse(OCClientResponse * clientResponse,
     return OC_STACK_OK;
 }
 
-OCStackResult FormOptionList(coap_list_t * * optListLoc, uint8_t * addMediaType,
-        uint32_t * addMaxAge, uint32_t * observeOptionPtr,
-        uint16_t * addPortNumber, uint8_t uriLength, unsigned char * uri,
-        uint8_t queryLength, unsigned char * query,
-        OCHeaderOption * vendorSpecificHeaderOptions,
-        uint8_t numVendorSpecificHeaderOptions)
-{
-    coap_list_t * optNode = NULL;
-    int res;
-    size_t buflen;
-    unsigned char _buf[MAX_URI_QUERY_BUF_SIZE];
-    unsigned char *buf = _buf;
-
-    if(addMediaType)
-    {
-        optNode = CreateNewOptionNode(COAP_OPTION_CONTENT_TYPE,
-                sizeof(*addMediaType), addMediaType);
-        VERIFY_NON_NULL(optNode);
-        coap_insert(optListLoc, optNode, OrderOptions);
-    }
-
-    if(addMaxAge)
-    {
-        optNode = CreateNewOptionNode(COAP_OPTION_MAXAGE,
-                sizeof(*addMaxAge), (uint8_t *)addMaxAge);
-        VERIFY_NON_NULL(optNode);
-        coap_insert(optListLoc, optNode, OrderOptions);
-    }
-
-    if(observeOptionPtr)
-    {
-        optNode = CreateNewOptionNode(COAP_OPTION_OBSERVE,
-                sizeof(*observeOptionPtr), (uint8_t *)observeOptionPtr);
-
-        VERIFY_NON_NULL(optNode);
-        coap_insert(optListLoc, optNode, OrderOptions);
-    }
-    if(addPortNumber && *addPortNumber != COAP_DEFAULT_PORT)
-    {
-        optNode = CreateNewOptionNode(COAP_OPTION_URI_PORT,
-                sizeof(*addPortNumber), (uint8_t *)addPortNumber);
-        VERIFY_NON_NULL(optNode);
-        coap_insert(optListLoc, optNode, OrderOptions);
-    }
-
-    if(uri && uriLength)
-    {
-        buf = _buf;
-        buflen = MAX_URI_QUERY_BUF_SIZE;
-        res = coap_split_path(uri, uriLength, buf, &buflen);
-        while (res--) {
-            optNode = CreateNewOptionNode(COAP_OPTION_URI_PATH,
-                    COAP_OPT_LENGTH(buf), COAP_OPT_VALUE(buf));
-            VERIFY_NON_NULL(optNode);
-            coap_insert(optListLoc, optNode, OrderOptions);
-            buf += COAP_OPT_SIZE(buf);
-        }
-    }
-
-    if(query && queryLength)
-    {
-        buf = _buf;
-        buflen = MAX_URI_QUERY_BUF_SIZE;
-        res = coap_split_query(query, queryLength, buf, &buflen);
-        while (res--) {
-            optNode = CreateNewOptionNode(COAP_OPTION_URI_QUERY,
-                    COAP_OPT_LENGTH(buf), COAP_OPT_VALUE(buf));
-            VERIFY_NON_NULL(optNode);
-            coap_insert(optListLoc, optNode, OrderOptions);
-            buf += COAP_OPT_SIZE(buf);
-        }
-    }
-
-    // make sure that options are valid
-    if(vendorSpecificHeaderOptions && numVendorSpecificHeaderOptions)
-    {
-        uint8_t i = 0;
-        for( i = 0; i < numVendorSpecificHeaderOptions; i++)
-        {
-            if(vendorSpecificHeaderOptions[i].protocolID == OC_COAP_ID)
-            {
-                if(isVendorSpecific(vendorSpecificHeaderOptions[i].optionID)
-                        == OC_STACK_OK &&
-                        vendorSpecificHeaderOptions[i].optionLength <=
-                        MAX_HEADER_OPTION_DATA_LENGTH)
-                {
-                    OC_LOG_V(INFO, TAG, " Adding option %d with",
-                            vendorSpecificHeaderOptions[i].optionID);
-                    OC_LOG_BUFFER(INFO, TAG, vendorSpecificHeaderOptions[i].optionData,
-                            vendorSpecificHeaderOptions[i].optionLength);
-                    optNode = CreateNewOptionNode(vendorSpecificHeaderOptions[i].optionID,
-                            vendorSpecificHeaderOptions[i].optionLength,
-                            vendorSpecificHeaderOptions[i].optionData);
-                    VERIFY_NON_NULL(optNode);
-                    coap_insert(optListLoc, optNode, OrderOptions);
-                }
-                else
-                {
-                    coap_delete_list(*optListLoc);
-                    return OC_STACK_INVALID_OPTION;
-                }
-            }
-        }
-    }
-
-    return OC_STACK_OK;
-    exit:
-        coap_delete_list(*optListLoc);
-        return OC_STACK_NO_MEMORY;
-}
-
-//Send a coap pdu
-OCStackResult
-SendCoAPPdu(coap_context_t * gCoAPCtx, coap_address_t* dst, coap_pdu_t * pdu,
-        coap_send_flags_t flag)
-{
-    coap_tid_t tid = COAP_INVALID_TID;
-    OCStackResult res = OC_STACK_COMM_ERROR;
-    uint8_t cache = 0;
-
-    if (!(flag & SEND_DELAYED))
-    {
-        flag = (coap_send_flags_t)( flag |
-            ((pdu->hdr->type == COAP_MESSAGE_CON) ? SEND_NOW_CON : SEND_NOW));
-    }
-
-    tid = coap_send(gCoAPCtx, dst, pdu, flag, &cache);
-    OC_LOG_V(INFO, TAG, "TID %d", tid);
-    if(tid != COAP_INVALID_TID)
-    {
-        OC_LOG(INFO, TAG, PCF("Sending a pdu with Token:"));
-        OC_LOG_BUFFER(INFO,TAG, pdu->hdr->token, pdu->hdr->token_length);
-        res = OC_STACK_OK;
-    }
-
-    if (( (pdu->hdr->type != COAP_MESSAGE_CON) && (!(flag & SEND_DELAYED)) && (!cache))
-        || (tid == COAP_INVALID_TID))
-    {
-        OC_LOG(INFO, TAG, PCF("Deleting PDU"));
-        coap_delete_pdu(pdu);
-    }
-    else
-    {
-        OC_LOG(INFO, TAG, PCF("Keeping PDU, we will handle the retry/delay of this pdu"));
-    }
-
-    return res;
-}
-
-//generate a coap message
-#ifdef CA_INT
-coap_pdu_t *
-GenerateCoAPPdu(uint8_t msgType, uint8_t code, unsigned short id,
-        CAToken_t * token, unsigned char * payloadJSON,
-        coap_list_t *options)
-#else
-coap_pdu_t *
-GenerateCoAPPdu(uint8_t msgType, uint8_t code, unsigned short id,
-        OCCoAPToken * token, unsigned char * payloadJSON,
-        coap_list_t *options)
-#endif
-{
-    coap_pdu_t *pdu;
-    coap_list_t *opt;
-
-    if(token)
-    {
-        pdu = coap_pdu_init(msgType, code, id, COAP_MAX_PDU_SIZE);
-        VERIFY_NON_NULL(pdu);
-#ifdef CA_INT
-        pdu->hdr->token_length = CA_MAX_TOKEN_LEN;
-        if (!coap_add_token(pdu, CA_MAX_TOKEN_LEN, (const unsigned char *)*token))
-        {
-            OC_LOG(FATAL, TAG, PCF("coap_add_token failed"));
-        }
-#else
-        pdu->hdr->token_length = token->tokenLength;
-        if (!coap_add_token(pdu, token->tokenLength, token->token))
-        {
-            OC_LOG(FATAL, TAG, PCF("coap_add_token failed"));
-        }
-#endif
-    }
-    else
-    {
-        pdu = coap_pdu_init(msgType, code, id, sizeof(coap_pdu_t));
-        VERIFY_NON_NULL(pdu);
-    }
-
-    for (opt = options; opt; opt = opt->next)
-    {
-        coap_add_option(pdu, COAP_OPTION_KEY(*(coap_option *) opt->data),
-                COAP_OPTION_LENGTH(*(coap_option *) opt->data),
-                COAP_OPTION_DATA(*(coap_option *) opt->data));
-    }
-
-    if (payloadJSON)
-    {
-        coap_add_data(pdu, strlen((const char *) payloadJSON) + 1,
-                (unsigned char*) payloadJSON);
-    }
-
-    // display the pdu for debugging purposes
-    coap_show_pdu(pdu);
-
-    // clean up
-    coap_delete_list(options);
-    return pdu;
-
-    exit:
-    coap_delete_list(options);
-    return NULL;
-}
-
-//a function to help in ordering coap options
-int OrderOptions(void *a, void *b)
-{
-    if (!a || !b)
-    {
-        return a < b ? -1 : 1;
-    }
-
-    if (COAP_OPTION_KEY(*(coap_option *)a)
-            < COAP_OPTION_KEY(*(coap_option *)b) )
-    {
-        return -1;
-    }
-
-    return COAP_OPTION_KEY(*(coap_option *)a)
-            == COAP_OPTION_KEY(*(coap_option *)b) ;
-}
-
-//a function to create a coap option
-coap_list_t *
-CreateNewOptionNode(unsigned short key, unsigned int length, unsigned char *data)
-{
-    coap_option *option = NULL;
-    coap_list_t *node;
-
-    VERIFY_NON_NULL(data);
-    option = (coap_option *)coap_malloc(sizeof(coap_option) + length);
-    VERIFY_NON_NULL(option);
-
-    COAP_OPTION_KEY(*option) = key;
-    COAP_OPTION_LENGTH(*option) = length;
-    memcpy(COAP_OPTION_DATA(*option), data, length);
-
-    /* we can pass NULL here as delete function since option is released automatically  */
-    node = coap_new_listnode(option, NULL);
-
-    if (node)
-    {
-        return node;
-    }
-
-exit:
-    OC_LOG(ERROR,TAG, PCF("new_option_node: malloc: was not created"));
-    coap_free(option);
-    return NULL;
-}
-
-OCStackResult ReTXCoAPQueue(coap_context_t * ctx, coap_queue_t * queue)
-{
-    coap_tid_t tid = COAP_INVALID_TID;
-    OCStackResult result = OC_STACK_ERROR;
-    tid = coap_retransmit( ctx, queue);
-    if(tid == COAP_INVALID_TID)
-    {
-        OC_LOG_V(DEBUG, TAG, "Retransmission Failed TID %d",
-                queue->id);
-        result = OC_STACK_COMM_ERROR;
-    }
-    else
-    {
-        OC_LOG_V(DEBUG, TAG, "Retransmission TID %d, this is attempt %d",
-                queue->id, queue->retransmit_cnt);
-        result = OC_STACK_OK;
-    }
-    return result;
-}
-
-OCStackResult HandleFailedCommunication(coap_context_t * ctx, coap_queue_t * queue)
-{
-    //TODO: this function should change to only use OCStackFeedBack
-    OCResponse * response = NULL;
-    ClientCB * cbNode = NULL;
-    OCClientResponse clientResponse;
-
-    #ifdef CA_INT
-    //token for the observe request
-    CAToken_t token;
-    #else // CA_INT
-    // CoAP token for the observe request
-    OCCoAPToken token;
-    #endif // CA_INT
-
-    OCStackResult result = OC_STACK_OK;
-
-    RetrieveOCCoAPToken(queue->pdu, &token);
-
-    cbNode = GetClientCB(&token, NULL, NULL);
-    if(!cbNode)
-    {
-        goto observation;
-    }
-    result = FormOCClientResponse(&clientResponse, OC_STACK_COMM_ERROR,
-            (OCDevAddr *) &(queue->remote), 0, NULL);
-    if(result != OC_STACK_OK)
-    {
-        goto observation;
-    }
-    result = FormOCResponse(&response, cbNode, 0, NULL, NULL, &token, &clientResponse, NULL);
-    if(result != OC_STACK_OK)
-    {
-        goto observation;
-    }
-    HandleStackResponses(response);
-
-observation:
-    result = OCStackFeedBack(&token, OC_OBSERVER_FAILED_COMM);
-#ifdef CA_INT
-    if(result == OC_STACK_OK)
-    {
-        coap_cancel_all_messages(ctx, &queue->remote, (unsigned char *)token, CA_MAX_TOKEN_LEN);
-    }
-#else
-    if(result == OC_STACK_OK)
-    {
-        coap_cancel_all_messages(ctx, &queue->remote, token.token, token.tokenLength);
-    }
-#endif
-    OCFree(response);
-    return result;
-}
-
-// a function to handle the send queue in the passed context
-void HandleSendQueue(coap_context_t * ctx)
-{
-    coap_tick_t now;
-    coap_queue_t *nextQueue = NULL;
-
-    coap_ticks(&now);
-    nextQueue = coap_peek_next( ctx );
-    while (nextQueue && nextQueue->t <= now - ctx->sendqueue_basetime)
-    {
-        nextQueue = coap_pop_next( ctx );
-        if((uint8_t)nextQueue->delayedResNeeded)
-        {
-            OC_LOG_V(DEBUG, TAG, "Sending Delayed response TID %d",
-                    nextQueue->id);
-            if(SendCoAPPdu(ctx, &nextQueue->remote, nextQueue->pdu,
-                 (coap_send_flags_t)(nextQueue->secure ? SEND_SECURE_PORT : 0))
-                    == OC_STACK_COMM_ERROR)
-            {
-                OC_LOG(DEBUG, TAG, PCF("A problem occurred in sending a pdu"));
-                HandleFailedCommunication(ctx, nextQueue);
-            }
-            nextQueue->pdu = NULL;
-            coap_delete_node(nextQueue);
-        }
-        else
-        {
-            OC_LOG_V(DEBUG, TAG, "Retrying a CON pdu TID %d",nextQueue->id);
-            if(ReTXCoAPQueue(ctx, nextQueue) == OC_STACK_COMM_ERROR)
-            {
-                OC_LOG(DEBUG, TAG, PCF("A problem occurred in retransmitting a pdu"));
-                HandleFailedCommunication(ctx, nextQueue);
-                coap_delete_node(nextQueue);
-            }
-        }
-        nextQueue = coap_peek_next( ctx );
-    }
-}
index 7ee14b8..2bc2355 100644 (file)
 #include <ocstack.h>
 
 #include <ocresource.h>
-#ifdef CA_INT
 #include "cacommon.h"
-#else
-#include "occoaptoken.h"
-#endif
 
 typedef struct OCPresence {
     // This is the TTL associated with presence
@@ -54,11 +50,7 @@ typedef struct ClientCB {
     // callback method to delete context data
     OCClientContextDeleter deleteCallback;
     //  when a response is recvd with this token, above callback will be invoked
-#ifdef CA_INT
     CAToken_t token;
-#else // CA_INT
-    OCCoAPToken token;
-#endif // CA_INT
     // Invocation handle tied to original call to OCDoResource()
     OCDoHandle handle;
     // This is used to determine if all responses should be consumed or not.
@@ -103,15 +95,9 @@ extern struct ClientCB *cbList;
  */
 //------------------------------------------------------------------------
 OCStackResult
-#ifdef CA_INT
 AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
              CAToken_t * token, OCDoHandle *handle, OCMethod method,
              unsigned char * requestUri, unsigned char * resourceTypeName);
-#else // CA_INT
-AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
-             OCCoAPToken * token, OCDoHandle *handle, OCMethod method,
-             unsigned char * requestUri, unsigned char * resourceTypeName);
-#endif // CA_INT
 
 //-- DeleteClientCB -----------------------------------------------------------
 /** @ingroup ocstack
@@ -142,12 +128,7 @@ void DeleteClientCB(ClientCB *cbNode);
  * @retval address of the node if found, otherwise NULL
  */
 //------------------------------------------------------------------------
-#ifdef CA_INT
 ClientCB* GetClientCB(const CAToken_t * token, OCDoHandle handle, const unsigned char * requestUri);
-#else // CA_INT
-ClientCB* GetClientCB(OCCoAPToken * token, OCDoHandle handle, const unsigned char * requestUri);
-#endif // CA_INT
-
 
 /**
  * Inserts a new resource type filter into this clientCB node.
index 0b2713e..b9a88ff 100644 (file)
@@ -35,23 +35,16 @@ typedef struct ResourceObserver {
     unsigned char *resUri;
     // Query
     unsigned char *query;
-#ifdef CA_INT
     //token for the observe request
     CAToken_t token;
-#else // CA_INT
-    // CoAP token for the observe request
-    OCCoAPToken token;
-#endif // CA_INT
     // Resource handle
     OCResource *resource;
     // IP address & port of client registered for observe
     OCDevAddr *addr;
-#ifdef CA_INT
     /** Remote Endpoint address **/
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
     CAConnectivityType_t connectivityType;
-#endif
     // Quality of service of the request
     OCQualityOfService qos;
     // number of times the server failed to reach the observer
@@ -80,9 +73,6 @@ void DeleteObserverList();
 
 OCStackResult GenerateObserverId (OCObservationId *observationId);
 
-
-
-#ifdef CA_INT
 OCStackResult AddObserver (const char         *resUri,
                            const char         *query,
                            OCObservationId    obsId,
@@ -95,23 +85,9 @@ OCStackResult AddObserver (const char         *resUri,
 
 OCStackResult DeleteObserverUsingToken (CAToken_t * token);
 ResourceObserver* GetObserverUsingToken (const CAToken_t * token);
-#else
-OCStackResult AddObserver (const char         *resUri,
-                           const char         *query,
-                           OCObservationId    obsId,
-                           OCCoAPToken        *token,
-                           OCDevAddr          *addr,
-                           OCResource         *resHandle,
-                           OCQualityOfService qos);
-
-OCStackResult DeleteObserverUsingToken (OCCoAPToken * token);
-ResourceObserver* GetObserverUsingToken (const OCCoAPToken * token);
-#endif
 
 ResourceObserver* GetObserverUsingId (const OCObservationId observeId);
 
-#ifdef CA_INT
-
 OCStackResult
 CreateObserveHeaderOption (CAHeaderOption_t **caHdrOpt,
                            OCHeaderOption *ocHdrOpt,
@@ -121,6 +97,5 @@ OCStackResult
 GetObserveHeaderOption (uint32_t * observationOption,
                         CAHeaderOption_t *options,
                         uint8_t * numOptions);
-#endif // CA_INT
 
 #endif //OC_OBSERVE_H
index 14794b6..caa0f24 100644 (file)
@@ -89,16 +89,10 @@ OCStackResult SaveDeviceInfo(OCDeviceInfo deviceInfo);
 
 void DeleteDeviceInfo();
 
-#ifdef CA_INT
 OCStackResult
 BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
                         char *filterValue, char * out, uint16_t *remaining,
                         CAConnectivityType_t connType );
-#else
-OCStackResult
-BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
-                        char *filterValue, char * out, uint16_t *remaining);
-#endif
 
 OCStackResult EntityHandlerCodeToOCStackCode(OCEntityHandlerResult ehResult);
 
index 08a4c98..2e452dc 100644 (file)
 
 #include "occoap.h"
 
-#ifdef CA_INT
-    #include "cacommon.h"
-    #include "cainterface.h"
-#endif
+#include "cacommon.h"
+#include "cainterface.h"
 /**
  * The signature of the internal call back functions to handle responses from entity handler
  */
@@ -50,22 +48,15 @@ typedef struct OCServerRequest {
     OCStackResult observeResult;
     uint8_t numResponses;
     OCEHResponseHandler ehResponseHandler;
-#ifdef CA_INT
     /** Remote Endpoint address **/
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
     CAConnectivityType_t connectivityType;
-#endif
     //////////////////////////////////////////////////////////
     // IP address & port of client registered for observe   //These
     OCDevAddr requesterAddr;                                //Members
-#ifdef CA_INT
     // token for the observe request
     CAToken_t requestToken;
-#else
-    // CoAP token for the observe request                   //Might
-    OCCoAPToken requestToken;                               //Be
-#endif // CA_INT
     // The ID of CoAP pdu                                   //Kept in
     uint16_t coapID;                                        //CoAP
     uint8_t delayedResNeeded;
@@ -92,17 +83,12 @@ typedef struct OCServerResponse {
     OCRequestHandle requestHandle;
 } OCServerResponse;
 
-#ifdef CA_INT
 OCServerRequest * GetServerRequestUsingToken (const CAToken_t token);
-#else
-OCServerRequest * GetServerRequestUsingToken (const OCCoAPToken token);
-#endif // CA_INT
 
 OCServerRequest * GetServerRequestUsingHandle (const OCServerRequest * handle);
 
 OCServerResponse * GetServerResponseUsingHandle (const OCServerRequest * handle);
 
-#ifdef CA_INT
 OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         uint8_t delayedResNeeded, uint8_t secured, uint8_t notificationFlag, OCMethod method,
         uint8_t numRcvdVendorSpecificHeaderOptions, uint32_t observationOption,
@@ -111,15 +97,6 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         unsigned char * reqJSONPayload, CAToken_t * requestToken,
         OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize,
         CAAddress_t *addressInfo, CAConnectivityType_t connectivityType);
-#else
-OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
-        uint8_t delayedResNeeded, uint8_t secured, uint8_t notificationFlag, OCMethod method,
-        uint8_t numRcvdVendorSpecificHeaderOptions, uint32_t observationOption,
-        OCQualityOfService qos, unsigned char * query,
-        OCHeaderOption * rcvdVendorSpecificHeaderOptions,
-        unsigned char * reqJSONPayload, OCCoAPToken * requestToken,
-        OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize);
-#endif // CA_INT
 
 OCStackResult AddServerResponse (OCServerResponse ** response, OCRequestHandle requestHandle);
 
index fd769a2..bd44976 100644 (file)
 #include <logger.h>
 #include <ocrandom.h>
 
-#ifdef CA_INT
 #include "cacommon.h"
 #include "cainterface.h"
-#else
-#include "occoaptoken.h"
-#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -64,12 +60,7 @@ typedef struct {
     // IP address & port of client registered for observe
     OCDevAddr *subAddr;
 
-#ifdef CA_INT
     CAToken_t *token;
-#else // CA_INT
-    // token for the observe request
-    OCCoAPToken *token;
-#endif // CA_INT
 
     // The result of the observe request
     OCStackResult result;
@@ -92,24 +83,17 @@ typedef struct {
     // An array of the received vendor specific header options
     uint8_t numRcvdVendorSpecificHeaderOptions;
     OCHeaderOption rcvdVendorSpecificHeaderOptions[MAX_HEADER_OPTIONS];
-#ifdef CA_INT
     /** Remote Endpoint address **/
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
     CAConnectivityType_t connectivityType;
-#endif
     //////////////////////////////////////////////////////////
     // TODO: Consider moving these member to CoAP
     // IP address & port of client registered for observe
     OCDevAddr requesterAddr;
 
-#ifdef CA_INT
     //token for the observe request
     CAToken_t requestToken;
-#else // CA_INT
-    // CoAP token for the observe request
-    OCCoAPToken requestToken;
-#endif // CA_INT
 
     // The ID of CoAP pdu
     uint16_t coapID;
@@ -135,12 +119,7 @@ typedef struct
     // IP address & port of client registered for observe
     OCDevAddr *requesterAddr;
 
-#ifdef CA_INT
     CAToken_t *requestToken;
-#else // CA_INT
-    // CoAP token for the observe request
-    OCCoAPToken *requestToken;
-#endif // CA_INT
 
     // The ID of CoAP pdu
     uint16_t coapID;
@@ -173,13 +152,8 @@ typedef struct {
     // This is the received payload.
     unsigned char * bufRes;
 
-#ifdef CA_INT
     // This is the token received OTA.
     CAToken_t * rcvdToken;
-#else // CA_INT
-   // This is the token received OTA.
-    OCCoAPToken * rcvdToken;
-#endif // CA_INT
 
     // this structure will be passed to client
     OCClientResponse * clientResponse;
@@ -192,11 +166,7 @@ typedef uint32_t ServerID;
 // Internal function prototypes
 //-----------------------------------------------------------------------------
 
-#ifdef CA_INT
 OCStackResult OCStackFeedBack(CAToken_t * token, uint8_t status);
-#else // CA_INT
-OCStackResult OCStackFeedBack(OCCoAPToken * token, uint8_t status);
-#endif // CA_INT
 
 OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest);
 OCStackResult HandleStackResponses(OCResponse * response);
index 83e18a2..541177e 100644 (file)
@@ -35,19 +35,11 @@ extern "C" {
 //TODO: May want to refactor this in upcoming sprints.
 //Don't want to expose to application layer that lower level stack is using CoAP.
 
-#ifdef CA_INT
 #define OC_WELL_KNOWN_QUERY                  "224.0.1.187:5683/oc/core"
 #define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "224.0.1.187:5683/oc/core/d?rt=core.led"
 #define OC_MULTICAST_PREFIX                  "224.0.1.187:5683"
 #define OC_MULTICAST_IP                      "224.0.1.187"
 
-#else
-#define OC_WELL_KNOWN_QUERY                  "coap://224.0.1.187:5683/oc/core"
-#define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "coap://224.0.1.187:5683/oc/core/d?rt=core.led"
-#define OC_MULTICAST_PREFIX                  "coap://224.0.1.187:5683"
-#define OC_MULTICAST_IP                      "coap://224.0.1.187"
-#endif
-
 #define USE_RANDOM_PORT (0)
 #ifdef WITH_PRESENCE
 #define OC_DEFAULT_PRESENCE_TTL (60)
@@ -142,7 +134,6 @@ typedef enum {
     OC_COAP_ID      = (1 << 1)
 } OCTransportProtocolID;
 
-#ifdef CA_INT
 /**
  * Adaptor types
  */
@@ -153,7 +144,6 @@ typedef enum {
     OC_LE,
     OC_ALL //Multicast message: send over all the interfaces.
 } OCConnectivityType;
-#endif
 
 /**
  * Declares Stack Results & Errors
@@ -290,10 +280,8 @@ typedef struct {
 typedef struct {
     // Address of remote server
     OCDevAddr * addr;
-    #ifdef CA_INT
     // Indicates adaptor type on which the response was received
     OCConnectivityType connType;
-    #endif
     // the is the result of our stack, OCStackResult should contain coap/other error codes;
     OCStackResult result;
     // If associated with observe, this will represent the sequence of notifications from server.
@@ -475,16 +463,10 @@ OCStackResult OCProcess();
  *     OC_STACK_INVALID_QUERY    - number of resource types specified for filtering presence
  *                                 notifications exceeds @ref MAX_PRESENCE_FILTERS.
  */
-#ifdef CA_INT
 OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requiredUri,
             const char *referenceUri, const char *request, OCConnectivityType conType,
             OCQualityOfService qos, OCCallbackData *cbData,
             OCHeaderOption * options, uint8_t numOptions);
-#else
-    OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char  *requiredUri,
-            const char  *referenceUri, const char *request, OCQualityOfService qos,
-            OCCallbackData *cbData, OCHeaderOption * options, uint8_t numOptions);
-#endif
 
 /**
  * Cancel a request associated with a specific @ref OCDoResource invocation.
index 924212d..8b29377 100644 (file)
@@ -22,7 +22,7 @@ if env.get('SECURED') == '1':
     samples_env.AppendUnique(LIBS = ['tinydtls'])
 samples_env.ParseConfig('pkg-config --libs glib-2.0');
 
-samples_env.AppendUnique(CPPDEFINES = ['CA_INT', 'TB_LOG'])
+samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
 ######################################################################
 # Source files and Targets
index bc3a0e5..94ca9d4 100644 (file)
@@ -67,10 +67,10 @@ INC_DIRS    += -I$(CJSON_INC)
 
 # TODO-CA Remove -fstack-protector-all before merging to master
 CC_FLAGS.debug   := -O0 -g3 -Wall -fstack-protector-all -ffunction-sections -fdata-sections -fno-exceptions \
-                        -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG -DCA_INT
+                        -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG 
 # TODO-CA Remove -fstack-protector-all before merging to master
 CC_FLAGS.release := -Os -Wall -fstack-protector-all -fdata-sections -Wl,--gc-sections -Wl,-s -fno-exceptions \
-                        -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG -DCA_INT
+                        -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG 
 
 LDLIBS         += -loctbstack -lpthread -L$(CONNECTIVITY_DIR)/build/out -lconnectivity_abstraction
 CPPFLAGS       += $(CC_FLAGS.$(BUILD)) $(LDLIBS)
index fe363cf..d74aa68 100644 (file)
@@ -34,18 +34,12 @@ static int TEST_CASE = 0;
 static const char * TEST_APP_UNICAST_DISCOVERY_QUERY = "coap://0.0.0.0:5683/oc/core";
 static const char * TEST_APP_UNICAST_DEVICE_DISCOVERY_QUERY = "coap://0.0.0.0:5683/oc/core/d";
 
-#ifdef CA_INT
 static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d";
-#else //CA_INT
-static const char * TEST_APP_MULTICAST_DEVICE_DISCOVERY_QUERY = "coap://224.0.1.187:5683/oc/core/d";
-#endif //CA_INT
 
-#ifdef CA_INT
 static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
 //The following variable determines the interface (wifi, ethernet etc.)
 //to be used for sending unicast messages. Default set to WIFI.
 static OCConnectivityType OC_CONNTYPE = OC_WIFI;
-#endif
 static std::string putPayload = "{\"state\":\"on\",\"power\":5}";
 static std::string coapServerIP = "255.255.255.255";
 static std::string coapServerPort = "5683";
@@ -74,15 +68,9 @@ void handleSigInt(int signum) {
 
 static void PrintUsage()
 {
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3|4|5|6|7> -c <0|1>");
-#else
-     OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3|4|5|6|7>");
-#endif
     OC_LOG(INFO, TAG, "-u <0|1> : Perform multicast/unicast discovery of resources");
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI");
-#endif
     OC_LOG(INFO, TAG, "-t 1  :  Discover Resources");
     OC_LOG(INFO, TAG, "-t 2  :  Discover Resources and Initiate Nonconfirmable Get Request");
     OC_LOG(INFO, TAG, "-t 3  :  Discover Resources and Initiate Nonconfirmable Put Requests");
@@ -123,15 +111,9 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, method, query.str().c_str(), 0,
                        (method == OC_REST_PUT) ? putPayload.c_str() : NULL,
                        (OC_CONNTYPE), qos, &cbData, options, numOptions);
-#else
-    ret = OCDoResource(&handle, method, query.str().c_str(), 0,
-                       (method == OC_REST_PUT) ? putPayload.c_str() : NULL,
-                       qos, &cbData, options, numOptions);
-#endif
 
     if (ret != OC_STACK_OK)
     {
@@ -314,10 +296,8 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
                 remoteIpAddr + 1, remoteIpAddr + 2, remoteIpAddr + 3);
         OCDevAddrToPort((OCDevAddr *) clientResponse->addr, &remotePortNu);
 
-#ifdef CA_INT
         std::string connectionType = getConnectivityType (clientResponse->connType);
         OC_LOG_V(INFO, TAG, "Discovered on %s", connectionType.c_str());
-#endif
         OC_LOG_V(INFO, TAG,
                 "Device =============> Discovered %s @ %d.%d.%d.%d:%d",
                 clientResponse->resJSONPayload, remoteIpAddr[0], remoteIpAddr[1],
@@ -376,12 +356,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
                 break;
         }
     }
-#ifdef CA_INT
     return OC_STACK_KEEP_TRANSACTION;
-#else
-    return (UNICAST_DISCOVERY) ? OC_STACK_DELETE_TRANSACTION : OC_STACK_KEEP_TRANSACTION ;
-#endif
-
 }
 
 OCStackApplicationResult DeviceDiscoveryReqCB (void* ctx, OCDoHandle handle,
@@ -598,17 +573,10 @@ int InitDeviceDiscovery()
 
     else
     {
-#ifdef CA_INT
         strncpy(szQueryUri, MULTICAST_DEVICE_DISCOVERY_QUERY,
                 (strlen(MULTICAST_DEVICE_DISCOVERY_QUERY) + 1));
-
-#else
-        strncpy(szQueryUri, TEST_APP_MULTICAST_DEVICE_DISCOVERY_QUERY,
-                (strlen(TEST_APP_MULTICAST_DEVICE_DISCOVERY_QUERY) + 1));
-#endif
     }
 
-#ifdef CA_INT
     if(UNICAST_DISCOVERY)
     {
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_CONNTYPE,
@@ -619,9 +587,6 @@ int InitDeviceDiscovery()
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ALL),
                 OC_LOW_QOS, &cbData, NULL, 0);
     }
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
-#endif
 
     if (ret != OC_STACK_OK)
     {
@@ -645,17 +610,12 @@ int InitDiscovery()
     }
     else
     {
-#ifdef CA_INT
         strcpy(szQueryUri, MULTICAST_RESOURCE_DISCOVERY_QUERY);
-#else
-        strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
-#endif
     }
 
     cbData.cb = discoveryReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
-#ifdef CA_INT
     if(UNICAST_DISCOVERY)
     {
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_CONNTYPE,
@@ -666,9 +626,6 @@ int InitDiscovery()
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ALL),
                 OC_LOW_QOS, &cbData, NULL, 0);
     }
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -683,11 +640,7 @@ int main(int argc, char* argv[]) {
     uint8_t ifname[] = "eth0";
     int opt;
 
-#ifdef CA_INT
     while ((opt = getopt(argc, argv, "u:t:c:")) != -1)
-#else
-    while ((opt = getopt(argc, argv, "u:t:")) != -1)
-#endif
     {
         switch(opt)
         {
@@ -697,11 +650,9 @@ int main(int argc, char* argv[]) {
             case 't':
                 TEST_CASE = atoi(optarg);
                 break;
-            #ifdef CA_INT
             case 'c':
                 OC_CONNTYPE = OCConnectivityType(atoi(optarg));
                 break;
-            #endif
             default:
                 PrintUsage();
                 return -1;
index 58f04fd..b1fe562 100644 (file)
@@ -70,9 +70,7 @@ int InitPresence();
 //----------------------------------------------------------------------------
 // Function prototype
 //----------------------------------------------------------------------------
-#ifdef CA_INT
 std::string getConnectivityType (OCConnectivityType connType);
-#endif
 
 /* call getResult in common.cpp to get the result in string format. */
 const char *getResult(OCStackResult result);
index 1b6ab41..e3a60ec 100644 (file)
@@ -44,12 +44,10 @@ static std::string coapServerIP = "255.255.255.255";
 static std::string coapServerPort = "5683";
 static std::string coapServerResource = "/a/led";
 
-#ifdef CA_INT
 //The following variable determines the interface (wifi, ethernet etc.)
 //to be used for sending unicast messages. Default set to WIFI.
 static OCConnectivityType OC_CONNTYPE = OC_WIFI;
 static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
-#endif
 
 int gQuitFlag = 0;
 
@@ -72,15 +70,9 @@ void handleSigInt(int signum)
 
 static void PrintUsage()
 {
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3> -c <0|1>");
-#else
-    OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3>");
-#endif
     OC_LOG(INFO, TAG, "-u <0|1> : Perform multicast/unicast discovery of resources");
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI");
-#endif
     OC_LOG(INFO, TAG, "-t 1 : Discover Resources");
     OC_LOG(INFO, TAG, "-t 2 : Discover Resources and"
             " Initiate Nonconfirmable Get/Put/Post Requests");
@@ -99,15 +91,9 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, method, query.str().c_str(), 0,
             (method == OC_REST_PUT || method == OC_REST_POST) ? putPayload.c_str() : NULL,
             OC_CONNTYPE, qos, &cbData, options, numOptions);
-#else
-    ret = OCDoResource(&handle, method, query.str().c_str(), 0,
-            (method == OC_REST_PUT || method == OC_REST_POST) ? putPayload.c_str() : NULL,
-            qos, &cbData, options, numOptions);
-#endif
 
     if (ret != OC_STACK_OK)
     {
@@ -295,16 +281,11 @@ int InitDiscovery()
     }
     else
     {
-#ifdef CA_INT
         strcpy(szQueryUri, MULTICAST_RESOURCE_DISCOVERY_QUERY);
-#else
-        strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
-#endif
     }
     cbData.cb = discoveryReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
-#ifdef CA_INT
     if (UNICAST_DISCOVERY)
     {
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_CONNTYPE),
@@ -315,9 +296,6 @@ int InitDiscovery()
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ALL),
                 OC_LOW_QOS, &cbData, NULL, 0);
     }
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -333,11 +311,7 @@ int main(int argc, char* argv[])
     uint8_t ifname[] = "eth0";
     int opt;
 
-#ifdef CA_INT
     while ((opt = getopt(argc, argv, "u:t:c:")) != -1)
-#else
-    while ((opt = getopt(argc, argv, "u:t:")) != -1)
-#endif
     {
         switch(opt)
         {
@@ -347,11 +321,9 @@ int main(int argc, char* argv[])
             case 't':
                 TEST_CASE = atoi(optarg);
                 break;
-            #ifdef CA_INT
             case 'c':
                 OC_CONNTYPE = OCConnectivityType(atoi(optarg));
                 break;
-            #endif
             default:
                 PrintUsage();
                 return -1;
index 70cfe4a..7b27e76 100644 (file)
@@ -75,12 +75,10 @@ testToTextMap queryInterface[] = {
 
 static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}";
 
-#ifdef CA_INT
 //The following variable determines the interface (wifi, ethernet etc.)
 //to be used for sending unicast messages. Default set to WIFI.
 static OCConnectivityType OC_CONNTYPE = OC_WIFI;
 static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
-#endif
 
 // The handle for the observe registration
 OCDoHandle gObserveDoHandle;
@@ -105,12 +103,8 @@ int InitDiscovery();
 
 void PrintUsage()
 {
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case> -c <CA connectivity Type>");
     OC_LOG(INFO, TAG, "-c <0|1> : Send messages over Ethernet or WIFI");
-#else
-    OC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case>");
-#endif
     OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an"\
             "available resource using default interface.");
     OC_LOG(INFO, TAG, "Test Case 2 : Discover Resources && Initiate GET Request on an"\
@@ -222,13 +216,8 @@ int InitGetRequestToUnavailableResource(OCClientResponse * clientResponse)
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_CONNTYPE, OC_LOW_QOS,
             &cbData, NULL, 0);
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_LOW_QOS,
-            &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -249,13 +238,8 @@ int InitObserveRequest(OCClientResponse * clientResponse)
     cbData.cd = NULL;
     OC_LOG_V(INFO, TAG, "OBSERVE payload from client = %s ", putPayload.c_str());
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, OC_REST_OBSERVE, obsReg.str().c_str(), 0, 0, OC_CONNTYPE,
             OC_LOW_QOS, &cbData, NULL, 0);
-#else
-    ret = OCDoResource(&handle, OC_REST_OBSERVE, obsReg.str().c_str(), 0, 0, OC_LOW_QOS,
-            &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -282,13 +266,8 @@ int InitPutRequest(OCClientResponse * clientResponse)
     cbData.cd = NULL;
     OC_LOG_V(INFO, TAG, "PUT payload from client = %s ", putPayload.c_str());
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, OC_REST_PUT, getQuery.str().c_str(), 0, putPayload.c_str(),
                         OC_CONNTYPE, OC_LOW_QOS, &cbData, NULL, 0);
-#else
-    ret = OCDoResource(&handle, OC_REST_PUT, getQuery.str().c_str(), 0, putPayload.c_str(),
-            OC_LOW_QOS, &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -320,13 +299,8 @@ int InitGetRequest(OCClientResponse * clientResponse)
     cbData.cb = getReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
-#ifdef CA_INT
     ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_CONNTYPE, OC_LOW_QOS,
             &cbData, NULL, 0);
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_LOW_QOS,
-            &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -342,23 +316,14 @@ int InitDiscovery()
     /* Start a discovery query*/
     char szQueryUri[64] = { 0 };
 
-#ifdef CA_INT
     strcpy(szQueryUri, MULTICAST_RESOURCE_DISCOVERY_QUERY);
-#else
-    strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
-#endif
 
     cbData.cb = discoveryReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
-#ifdef CA_INT
     ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_ALL,
                         OC_LOW_QOS,
             &cbData, NULL, 0);
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS,
-            &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -373,22 +338,16 @@ int main(int argc, char* argv[]) {
     uint8_t ifname[] = "eth0";
     int opt;
 
-#ifdef CA_INT
     while ((opt = getopt(argc, argv, "t:c:")) != -1)
-#else
-    while ((opt = getopt(argc, argv, "t:")) != -1)
-#endif
     {
         switch(opt)
         {
         case 't':
             TEST = atoi(optarg);
             break;
-        #ifdef CA_INT
         case 'c':
             OC_CONNTYPE = OCConnectivityType(atoi(optarg));
             break;
-        #endif
         default:
             PrintUsage();
             return -1;
index f27c2d9..9f12159 100644 (file)
@@ -37,12 +37,10 @@ static std::string coapServerIP = "255.255.255.255";
 static std::string coapServerPort = "5683";
 static std::string coapServerResource = "/a/led";
 
-#ifdef CA_INT
 //The following variable determines the interface (wifi, ethernet etc.)
 //to be used for sending unicast messages. Default set to WIFI.
 static OCConnectivityType OC_CONNTYPE = OC_WIFI;
 static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
-#endif
 
 int gQuitFlag = 0;
 
@@ -57,12 +55,8 @@ void handleSigInt(int signum)
 
 static void PrintUsage()
 {
-#ifdef CA_INT
     OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3> -c <0|1>");
     OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI");
-#else
-    OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1|2|3>");
-#endif
     OC_LOG(INFO, TAG, "-u <0|1> : Perform multicast/unicast discovery of resources");
     OC_LOG(INFO, TAG, "-t 1 : Discover Resources");
     OC_LOG(INFO, TAG, "-t 2 : Discover Resources and Initiate Nonconfirmable Get Request");
@@ -81,13 +75,8 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
 
-#ifdef CA_INT
     ret = OCDoResource(&handle, method, query.str().c_str(), 0,
             NULL, OC_CONNTYPE, qos, &cbData, options, numOptions);
-#else
-    ret = OCDoResource(&handle, method, query.str().c_str(), 0,
-            NULL, qos, &cbData, options, numOptions);
-#endif
 
     if (ret != OC_STACK_OK)
     {
@@ -202,16 +191,11 @@ int InitDiscovery()
     }
     else
     {
-#ifdef CA_INT
         strcpy(szQueryUri, MULTICAST_RESOURCE_DISCOVERY_QUERY);
-#else
-        strcpy(szQueryUri, OC_WELL_KNOWN_QUERY);
-#endif
     }
     cbData.cb = discoveryReqCB;
     cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
-#ifdef CA_INT
     if(UNICAST_DISCOVERY)
     {
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_CONNTYPE,
@@ -222,9 +206,6 @@ int InitDiscovery()
         ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_ALL,
                 OC_LOW_QOS, &cbData, NULL, 0);
     }
-#else
-    ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
-#endif
     if (ret != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack resource error");
@@ -240,11 +221,7 @@ int main(int argc, char* argv[])
     uint8_t ifname[] = "eth0";
     int opt;
 
-#ifdef CA_INT
     while ((opt = getopt(argc, argv, "u:t:c:")) != -1)
-#else
-    while ((opt = getopt(argc, argv, "u:t:")) != -1)
-#endif
     {
         switch(opt)
         {
@@ -254,11 +231,9 @@ int main(int argc, char* argv[])
             case 't':
                 TEST_CASE = atoi(optarg);
                 break;
-            #ifdef CA_INT
             case 'c':
                 OC_CONNTYPE = OCConnectivityType(atoi(optarg));
                 break;
-            #endif
             default:
                 PrintUsage();
                 return -1;
index af98e0e..a27c565 100644 (file)
@@ -42,7 +42,7 @@ if target_os == 'android':
 if target_os in ['darwin', 'ios']:
        samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
 
-samples_env.AppendUnique(CPPDEFINES = ['CA_INT', 'CA_INT_DTLS', 'TB_LOG'])
+samples_env.AppendUnique(CPPDEFINES = ['CA_INT_DTLS', 'TB_LOG'])
 
 ######################################################################
 # Source files and Targets
index 3cf8256..bcf20f6 100644 (file)
@@ -87,9 +87,7 @@ OCStackResult InvokeOCDoResource(std::ostringstream &query,
 
     ret = OCDoResource(&handle, method, query.str().c_str(), 0,
             (method == OC_REST_PUT || method == OC_REST_POST) ? putPayload.c_str() : NULL,
-#ifdef CA_INT
             (OC_WIFI),
-#endif
             qos, &cbData, options, numOptions);
 
     if (ret != OC_STACK_OK)
@@ -264,9 +262,7 @@ int InitDiscovery()
     cbData.context = NULL;
     cbData.cd = NULL;
     ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0,
-#ifdef CA_INT
             (OC_WIFI),
-#endif
             OC_LOW_QOS, &cbData, NULL, 0);
     if (ret != OC_STACK_OK)
     {
index 509b5f1..0bb05f1 100644 (file)
 #include "ocmalloc.h"
 #include <string.h>
 
-#ifdef CA_INT
 #include "cacommon.h"
 #include "cainterface.h"
-#endif
 
 /// Module Name
 #define TAG PCF("occlientcb")
@@ -40,15 +38,9 @@ struct ClientCB *cbList = NULL;
 OCMulticastNode * mcPresenceNodes = NULL;
 
 OCStackResult
-#ifdef CA_INT
 AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
              CAToken_t * token, OCDoHandle *handle, OCMethod method,
              unsigned char * requestUri, unsigned char * resourceTypeName)
-#else // CA_INT
-AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
-             OCCoAPToken * token, OCDoHandle *handle, OCMethod method,
-             unsigned char * requestUri, unsigned char * resourceTypeName)
-#endif // CA_INT
 {
 
     ClientCB *cbNode = NULL;
@@ -73,13 +65,9 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
             cbNode->callBack = cbData->cb;
             cbNode->context = cbData->context;
             cbNode->deleteCallback = cbData->cd;
-#ifdef CA_INT
             //Note: token memory is allocated in the caller OCDoResource
             //but freed in DeleteClientCB
             cbNode->token = *token;
-#else // CA_INT
-            memcpy(&(cbNode->token), token, sizeof(OCCoAPToken));
-#endif // CA_INT
             cbNode->handle = *handle;
             cbNode->method = method;
             cbNode->sequenceNumber = 0;
@@ -119,12 +107,8 @@ void DeleteClientCB(ClientCB * cbNode) {
     if(cbNode) {
         LL_DELETE(cbList, cbNode);
         OC_LOG(INFO, TAG, PCF("deleting tokens"));
-#ifdef CA_INT
         CADestroyToken (cbNode->token);
         OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)cbNode->token, CA_MAX_TOKEN_LEN);
-#else
-        OC_LOG_BUFFER(INFO, TAG, cbNode->token.token, cbNode->token.tokenLength);
-#endif // CA_INT
         OCFree(cbNode->handle);
         OCFree(cbNode->requestUri);
         if(cbNode->deleteCallback)
@@ -155,31 +139,18 @@ void DeleteClientCB(ClientCB * cbNode) {
     }
 }
 
-#ifdef CA_INT
 ClientCB* GetClientCB(const CAToken_t * token, OCDoHandle handle, const unsigned char * requestUri)
-#else // CA_INT
-ClientCB* GetClientCB(OCCoAPToken * token, OCDoHandle handle, const unsigned char * requestUri)
-#endif // CA_INT
 {
     ClientCB* out = NULL;
     if(token) {
         LL_FOREACH(cbList, out) {
             OC_LOG(INFO, TAG, PCF("comparing tokens"));
-#ifdef CA_INT
             OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)*token, CA_MAX_TOKEN_LEN);
             OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)out->token, CA_MAX_TOKEN_LEN);
             if(memcmp(out->token, *token, CA_MAX_TOKEN_LEN) == 0)
             {
                 return out;
             }
-#else // CA_INT
-            OC_LOG_BUFFER(INFO, TAG, token->token, token->tokenLength);
-            OC_LOG_BUFFER(INFO, TAG, out->token.token, out->token.tokenLength);
-            if((out->token.tokenLength == token->tokenLength) &&
-                (memcmp(out->token.token, token->token, token->tokenLength) == 0) ) {
-                return out;
-            }
-#endif // CA_INT
         }
     }
     else if(handle) {
index a529b0f..3c8f113 100644 (file)
@@ -252,15 +252,10 @@ HandleLinkedListInterface(OCEntityHandlerRequest *ehRequest,
             OCResource* temp = collResource->rsrcResources[i];
             if (temp)
             {
-#ifdef CA_INT
                 //TODO : Update needed here to get correct connectivity type
                 //from ServerRequest data structure
                 ret = BuildVirtualResourceResponse(temp, filterOn, filterValue,
                          (char*)ptr, &remaining, CA_WIFI );
-#else
-                ret = BuildVirtualResourceResponse(temp, filterOn, filterValue,
-                         (char*)ptr, &remaining);
-#endif
                 if (ret != OC_STACK_OK)
                 {
                     break;
index f167da3..778433a 100644 (file)
@@ -108,20 +108,12 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
             #endif
                 qos = DetermineObserverQoS(method, resourceObserver, qos);
 
-#ifdef CA_INT
                 result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
                         0, resPtr->sequenceNum, qos, resourceObserver->query,
                         NULL, NULL,
                         &resourceObserver->token, resourceObserver->addr,
                         resourceObserver->resUri, 0,
                         &(resourceObserver->addressInfo), resourceObserver->connectivityType);
-#else
-                result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
-                        0, resPtr->sequenceNum, qos, resourceObserver->query,
-                        NULL, NULL,
-                        &resourceObserver->token, resourceObserver->addr,
-                        resourceObserver->resUri, 0);
-#endif // CA_INT
 
                 request->observeResult = OC_STACK_OK;
                 if(request && result == OC_STACK_OK)
@@ -147,7 +139,6 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
                 unsigned char presenceResBuf[MAX_RESPONSE_LENGTH] = {0};
                 //This is effectively the implementation for the presence entity handler.
                 OC_LOG(DEBUG, TAG, PCF("This notification is for Presence"));
-#ifdef CA_INT
                 result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
                         0, resPtr->sequenceNum, qos, resourceObserver->query,
                         NULL, NULL,
@@ -155,12 +146,6 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
                         resourceObserver->resUri, 0,
                         &(resourceObserver->addressInfo), resourceObserver->connectivityType);
 
-#else
-                result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
-                        0, OC_OBSERVE_NO_OPTION, OC_LOW_QOS,
-                        NULL, NULL, NULL, &resourceObserver->token,
-                        resourceObserver->addr, resourceObserver->resUri, 0);
-#endif
                 if(result == OC_STACK_OK)
                 {
                     // we create the payload here
@@ -222,18 +207,11 @@ OCStackResult SendListObserverNotification (OCResource * resource,
                 qos = DetermineObserverQoS(OC_REST_GET, observation, qos);
 
 
-#ifdef CA_INT
                 result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
                         0, resource->sequenceNum, qos, observation->query,
                         NULL, NULL, &observation->token,
                         observation->addr, observation->resUri, 0,
                         &(observation->addressInfo), observation->connectivityType);
-#else
-                result = AddServerRequest(&request, 0, 0, 0, 1, OC_REST_GET,
-                        0, resource->sequenceNum, qos, observation->query,
-                        NULL, NULL, &observation->token,
-                        observation->addr, observation->resUri, 0);
-#endif //CA_INT
 
                 request->observeResult = OC_STACK_OK;
                 if(request && result == OC_STACK_OK)
@@ -306,7 +284,6 @@ exit:
     return OC_STACK_ERROR;
 }
 
-#ifdef CA_INT
 OCStackResult AddObserver (const char         *resUri,
                            const char         *query,
                            OCObservationId    obsId,
@@ -316,15 +293,6 @@ OCStackResult AddObserver (const char         *resUri,
                            OCQualityOfService qos,
                            CAAddress_t          *addressInfo,
                            CAConnectivityType_t connectivityType)
-#else
-OCStackResult AddObserver (const char         *resUri,
-                           const char         *query,
-                           OCObservationId    obsId,
-                           OCCoAPToken        *token,
-                           OCDevAddr          *addr,
-                           OCResource         *resHandle,
-                           OCQualityOfService qos)
-#endif // CA_INT
 {
     ResourceObserver *obsNode = NULL;
 
@@ -345,23 +313,16 @@ OCStackResult AddObserver (const char         *resUri,
             memcpy (obsNode->query, query, strlen(query)+1);
         }
 
-#ifdef CA_INT
         obsNode->token = (CAToken_t)OCMalloc(CA_MAX_TOKEN_LEN+1);
         VERIFY_NON_NULL (obsNode->token);
         memset(obsNode->token, 0, CA_MAX_TOKEN_LEN + 1);
         memcpy(obsNode->token, *token, CA_MAX_TOKEN_LEN);
-#else
-        obsNode->token.tokenLength = token->tokenLength;
-        memcpy (obsNode->token.token, token->token, token->tokenLength);
-#endif // CA_INT
 
         obsNode->addr = (OCDevAddr *)OCMalloc(sizeof(OCDevAddr));
         VERIFY_NON_NULL (obsNode->addr);
         memcpy (obsNode->addr, addr, sizeof(OCDevAddr));
-#ifdef CA_INT
         obsNode->addressInfo = *addressInfo;
         obsNode->connectivityType = connectivityType;
-#endif
         obsNode->resource = resHandle;
         LL_APPEND (serverObsList, obsNode);
         return OC_STACK_OK;
@@ -396,11 +357,7 @@ ResourceObserver* GetObserverUsingId (const OCObservationId observeId)
     return NULL;
 }
 
-#ifdef CA_INT
 ResourceObserver* GetObserverUsingToken (const CAToken_t * token)
-#else
-ResourceObserver* GetObserverUsingToken (const OCCoAPToken * token)
-#endif
 {
     ResourceObserver *out = NULL;
 
@@ -408,7 +365,6 @@ ResourceObserver* GetObserverUsingToken (const OCCoAPToken * token)
     {
         LL_FOREACH (serverObsList, out)
         {
-#ifdef CA_INT
             OC_LOG(INFO, TAG,PCF("comparing tokens"));
             OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, CA_MAX_TOKEN_LEN);
             OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)out->token, CA_MAX_TOKEN_LEN);
@@ -416,27 +372,13 @@ ResourceObserver* GetObserverUsingToken (const OCCoAPToken * token)
             {
                 return out;
             }
-#else
-            OC_LOG(INFO, TAG,PCF("comparing tokens"));
-            OC_LOG_BUFFER(INFO, TAG, token->token, token->tokenLength);
-            OC_LOG_BUFFER(INFO, TAG, out->token.token, out->token.tokenLength);
-            if((out->token.tokenLength == token->tokenLength) &&
-               (memcmp(out->token.token, token->token, token->tokenLength) == 0))
-            {
-                return out;
-            }
-#endif // CA_INT
         }
     }
     OC_LOG(INFO, TAG, PCF("Observer node not found!!"));
     return NULL;
 }
 
-#ifdef CA_INT
 OCStackResult DeleteObserverUsingToken (CAToken_t * token)
-#else
-OCStackResult DeleteObserverUsingToken (OCCoAPToken * token)
-#endif
 {
     ResourceObserver *obsNode = NULL;
 
@@ -444,11 +386,7 @@ OCStackResult DeleteObserverUsingToken (OCCoAPToken * token)
     if (obsNode)
     {
         OC_LOG_V(INFO, TAG, PCF("deleting tokens"));
-#ifdef CA_INT
         OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)obsNode->token, CA_MAX_TOKEN_LEN);
-#else
-        OC_LOG_BUFFER(INFO, TAG, obsNode->token.token, obsNode->token.tokenLength);
-#endif
         LL_DELETE (serverObsList, obsNode);
         OCFree(obsNode->resUri);
         OCFree(obsNode->query);
@@ -470,7 +408,6 @@ void DeleteObserverList()
     serverObsList = NULL;
 }
 
-#ifdef CA_INT
 OCStackResult
 CreateObserveHeaderOption (CAHeaderOption_t **caHdrOpt,
                            OCHeaderOption *ocHdrOpt,
@@ -526,4 +463,3 @@ GetObserveHeaderOption (uint32_t * observationOption,
     }
     return OC_STACK_OK;
 }
-#endif // CA_INT
index 6481d01..480cdf0 100644 (file)
 #include "debug.h"
 #include "cJSON.h"
 
-#ifdef CA_INT
-    #include "cacommon.h"
-    #include "cainterface.h"
-#endif
+#include "cacommon.h"
+#include "cainterface.h"
 
 
 /// Module Name
@@ -69,7 +67,6 @@ OCEntityHandlerResult defaultResourceEHandler(OCEntityHandlerFlag flag,
     return  OC_EH_OK; // Making sure that the Default EH and the Vendor EH have matching signatures
 }
 
-#ifdef CA_INT
 /* This method  will return the port at which the secure resource is hosted */
 static OCStackResult GetSecurePortInfo(CAConnectivityType_t connType, uint32_t *port)
 {
@@ -98,7 +95,6 @@ static OCStackResult GetSecurePortInfo(CAConnectivityType_t connType, uint32_t *
     free(info);
     return ret;
 }
-#endif
 
 static OCStackResult ValidateUrlQuery (unsigned char *url, unsigned char *query,
                                 uint8_t *filterOn, char **filterValue)
@@ -152,16 +148,10 @@ static OCStackResult ValidateUrlQuery (unsigned char *url, unsigned char *query,
 }
 
 
-#ifdef CA_INT
 OCStackResult
 BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
                         char *filterValue, char * out, uint16_t *remaining,
                         CAConnectivityType_t connType )
-#else
-OCStackResult
-BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
-                        char *filterValue, char * out, uint16_t *remaining)
-#endif
 {
     OCResourceType *resourceTypePtr;
     OCResourceInterface *interfacePtr;
@@ -239,13 +229,8 @@ BuildVirtualResourceResponse(OCResource *resourcePtr, uint8_t filterOn,
             if (resourcePtr->resourceProperties & OC_SECURE) {
                 cJSON_AddNumberToObject (propObj, OC_RSRVD_SECURE, OC_RESOURCE_SECURE);
                 //Set the IP port also as secure resources are hosted on a different port
-#ifdef CA_INT
                 uint32_t port;
                 if (GetSecurePortInfo (connType, &port) == OC_STACK_OK) {
-#else
-                uint16_t port;
-                if (OCGetResourceEndPointInfo (resourcePtr, &port) == OC_STACK_OK) {
-#endif
                     cJSON_AddNumberToObject (propObj, OC_RSRVD_HOSTING_PORT, port);
                 }
             }
@@ -540,13 +525,8 @@ HandleVirtualResource (OCServerRequest *request, OCResource* resource)
                         remaining--;
                     }
                     firstLoopDone = 1;
-#ifdef CA_INT
                     result = BuildVirtualResourceResponse(resource, filterOn, filterValue,
                             (char*)ptr, &remaining, request->connectivityType );
-#else
-                    result = BuildVirtualResourceResponse(resource, filterOn, filterValue,
-                            (char*)ptr, &remaining);
-#endif
 
                     if (result != OC_STACK_OK)
                     {
@@ -681,18 +661,11 @@ HandleResourceWithEntityHandler (OCServerRequest *request,
         OC_LOG(INFO, TAG, PCF("Registering observation requested"));
         result = GenerateObserverId(&ehRequest.obsInfo.obsId);
         VERIFY_SUCCESS(result, OC_STACK_OK);
-#ifdef CA_INT
         result = AddObserver ((const char*)(request->resourceUrl),
                 (const char *)(request->query),
                 ehRequest.obsInfo.obsId, &request->requestToken,
                 &request->requesterAddr, resource, request->qos,
                 &request->addressInfo, request->connectivityType);
-#else
-        result = AddObserver ((const char*)(request->resourceUrl),
-                (const char *)(request->query),
-                ehRequest.obsInfo.obsId, &request->requestToken,
-                &request->requesterAddr, resource, request->qos);
-#endif //CA_INT
         if(result == OC_STACK_OK)
         {
             OC_LOG(DEBUG, TAG, PCF("Added observer successfully"));
index b9ee789..43cf963 100644 (file)
 #include "ocresourcehandler.h"
 
 
-#ifdef CA_INT
 #include "cacommon.h"
 #include "cainterface.h"
-#endif
 
 // Module Name
 #define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG(FATAL, TAG, #arg " is NULL"); goto exit;} }
 static struct OCServerRequest * serverRequestList = NULL;
 static struct OCServerResponse * serverResponseList = NULL;
 
-#ifdef CA_INT
 OCServerRequest * GetServerRequestUsingToken (const CAToken_t token)
-#else // CA_INT
-OCServerRequest * GetServerRequestUsingToken (const OCCoAPToken token)
-#endif // CA_INT
 {
     OCServerRequest * out = NULL;
     LL_FOREACH (serverRequestList, out)
     {
-#ifdef CA_INT
         OC_LOG(INFO, TAG,PCF("comparing tokens"));
         OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, CA_MAX_TOKEN_LEN);
         OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)out->requestToken, CA_MAX_TOKEN_LEN);
@@ -53,16 +46,6 @@ OCServerRequest * GetServerRequestUsingToken (const OCCoAPToken token)
         {
             return out;
         }
-#else // CA_INT
-        OC_LOG(INFO, TAG,PCF("comparing tokens"));
-        OC_LOG_BUFFER(INFO, TAG, token.token, token.tokenLength);
-        OC_LOG_BUFFER(INFO, TAG, out->requestToken.token, out->requestToken.tokenLength);
-        if((out->requestToken.tokenLength == token.tokenLength) &&
-                (memcmp(out->requestToken.token, token.token, token.tokenLength) == 0))
-        {
-            return out;
-        }
-#endif // CA_INT
     }
     OC_LOG(INFO, TAG, PCF("Server Request not found!!"));
     return NULL;
@@ -96,7 +79,6 @@ OCServerResponse * GetServerResponseUsingHandle (const OCServerRequest * handle)
     return NULL;
 }
 
-#ifdef CA_INT
 OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         uint8_t delayedResNeeded, uint8_t secured, uint8_t notificationFlag, OCMethod method,
         uint8_t numRcvdVendorSpecificHeaderOptions, uint32_t observationOption,
@@ -105,15 +87,6 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         unsigned char * reqJSONPayload, CAToken_t * requestToken,
         OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize,
         CAAddress_t *addressInfo, CAConnectivityType_t connectivityType)
-#else // CA_INT
-OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
-        uint8_t delayedResNeeded, uint8_t secured, uint8_t notificationFlag, OCMethod method,
-        uint8_t numRcvdVendorSpecificHeaderOptions, uint32_t observationOption,
-        OCQualityOfService qos, unsigned char * query,
-        OCHeaderOption * rcvdVendorSpecificHeaderOptions,
-        unsigned char * reqJSONPayload, OCCoAPToken * requestToken,
-        OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize)
-#endif // CA_INT
 {
     OCServerRequest * serverRequest = NULL;
 
@@ -154,14 +127,10 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
     serverRequest->requestComplete = 0;
     if(requestToken)
     {
-#ifdef CA_INT
         serverRequest->requestToken = (CAToken_t)OCMalloc(CA_MAX_TOKEN_LEN+1);
         VERIFY_NON_NULL (serverRequest->requestToken);
         memset(serverRequest->requestToken, 0, CA_MAX_TOKEN_LEN + 1);
         memcpy(serverRequest->requestToken, *requestToken, CA_MAX_TOKEN_LEN);
-#else // CA_INT
-        memcpy(&serverRequest->requestToken, requestToken, sizeof(OCCoAPToken));
-#endif // CA_INT
     }
     if(requesterAddr)
     {
@@ -171,13 +140,11 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
     {
         memcpy(serverRequest->resourceUrl, resourceUrl, strlen((const char *)resourceUrl) + 1);
     }
-#ifdef CA_INT
     if (addressInfo)
     {
         serverRequest->addressInfo = *addressInfo;
     }
     serverRequest->connectivityType = connectivityType;
-#endif
 
     *request = serverRequest;
     OC_LOG(INFO, TAG, PCF("Server Request Added!!"));
@@ -302,7 +269,6 @@ void DeleteServerRequest(OCServerRequest * serverRequest)
 
 OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
 {
-#ifdef CA_INT
     OCStackResult result = OC_STACK_ERROR;
     CARemoteEndpoint_t responseEndpoint;
     CAResponseInfo_t responseInfo;
@@ -441,64 +407,6 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
     //Delete the request
     FindAndDeleteServerRequest(serverRequest);
     return result;
-#else
-    OCStackResult result = OC_STACK_ERROR;
-    OCServerProtocolResponse protocolResponse;
-    memset(&protocolResponse, 0, sizeof(OCServerProtocolResponse));
-
-    OC_LOG_V(INFO, TAG, "Inside HandleSingleResponse: %s", ehResponse->payload);
-
-    OCServerRequest *serverRequest = (OCServerRequest *)ehResponse->requestHandle;
-    // Format protocol response structure with data needed for
-    // sending the response
-    protocolResponse.qos = serverRequest->qos;
-
-    if((OCResource *)ehResponse->resourceHandle &&
-            ((OCResource *)ehResponse->resourceHandle)->resourceProperties == (OCResourceProperty) 0)
-    {
-        ehResponse->ehResult = OC_EH_RESOURCE_DELETED;
-    }
-    protocolResponse.result = EntityHandlerCodeToOCStackCode(ehResponse->ehResult);
-    protocolResponse.requesterAddr = &serverRequest->requesterAddr;
-    protocolResponse.requestToken = &serverRequest->requestToken;
-    protocolResponse.numSendVendorSpecificHeaderOptions = ehResponse->numSendVendorSpecificHeaderOptions;
-    protocolResponse.sendVendorSpecificHeaderOptions = ehResponse->sendVendorSpecificHeaderOptions;
-    protocolResponse.resourceUri = ehResponse->resourceUri;
-    protocolResponse.delayedResNeeded = serverRequest->delayedResNeeded;
-    protocolResponse.secured = serverRequest->secured;
-    protocolResponse.slowFlag = serverRequest->slowFlag;
-    protocolResponse.notificationFlag = serverRequest->notificationFlag;
-
-    //should we put the prefix and suffix here?
-    protocolResponse.payload = (unsigned char *) OCMalloc(MAX_RESPONSE_LENGTH);
-    if(!protocolResponse.payload)
-    {
-        return OC_STACK_NO_MEMORY;
-    }
-    strcpy((char *)protocolResponse.payload, (const char *)OC_JSON_PREFIX);
-    strcat((char *)protocolResponse.payload, (const char *)ehResponse->payload);
-    strcat((char *)protocolResponse.payload, (const char *)OC_JSON_SUFFIX);
-    protocolResponse.payloadSize = strlen((const char *)protocolResponse.payload) + 1;
-    protocolResponse.resourceUri = ehResponse->resourceUri;
-
-    //revise the following
-    protocolResponse.coapID = serverRequest->coapID;
-    if(serverRequest->observeResult == OC_STACK_OK)
-    {
-        protocolResponse.observationOption = serverRequest->observationOption;
-    }
-    else
-    {
-        protocolResponse.observationOption = OC_OBSERVE_NO_OPTION;
-    }
-    // Make call to OCCoAP layer
-    result = OCDoCoAPResponse(&protocolResponse);
-
-    OCFree(protocolResponse.payload);
-    //Delete the request
-    FindAndDeleteServerRequest(serverRequest);
-    return result;
-#endif
 }
 
 OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse)
index 2dd5070..81c3e52 100644 (file)
 #include "ocmalloc.h"
 #include "ocserverrequest.h"
 
-#ifdef CA_INT
-    #include "cacommon.h"
-    #include "cainterface.h"
-    #include <arpa/inet.h>
-#endif
+#include "cacommon.h"
+#include "cainterface.h"
+#include <arpa/inet.h>
 
 
 //-----------------------------------------------------------------------------
@@ -92,11 +90,7 @@ OCStackResult getQueryFromUri(const char * uri, unsigned char** resourceType, ch
 
 // This internal function is called to update the stack with the status of
 // observers and communication failures
-#ifdef CA_INT
 OCStackResult OCStackFeedBack(CAToken_t * token, uint8_t status)
-#else // CA_INT
-OCStackResult OCStackFeedBack(OCCoAPToken * token, uint8_t status)
-#endif // CA_INT
 {
     OCStackResult result = OC_STACK_ERROR;
     ResourceObserver * observer = NULL;
@@ -191,7 +185,6 @@ OCStackResult OCStackFeedBack(OCCoAPToken * token, uint8_t status)
     return result;
 }
 
-#ifdef CA_INT
 OCStackResult CAToOCStackResult(CAResponseResult_t caCode)
 {
     OCStackResult ret = OC_STACK_ERROR;
@@ -768,8 +761,6 @@ void HandleCARequests(const CARemoteEndpoint_t* endPoint, const CARequestInfo_t*
     OC_LOG(INFO, TAG, PCF("Exit HandleCARequests"));
 }
 
-#endif // CA_INT
-
 //This function will be called back by occoap layer when a request is received
 OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest)
 {
@@ -787,7 +778,6 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest)
     if(!request)
     {
         OC_LOG(INFO, TAG, PCF("This is a new Server Request"));
-#ifdef CA_INT
         result = AddServerRequest(&request, protocolRequest->coapID,
                 protocolRequest->delayedResNeeded, protocolRequest->secured, 0,
                 protocolRequest->method, protocolRequest->numRcvdVendorSpecificHeaderOptions,
@@ -797,16 +787,6 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest)
                 &protocolRequest->requesterAddr, protocolRequest->resourceUrl,
                 protocolRequest->reqTotalSize,
                 &protocolRequest->addressInfo, protocolRequest->connectivityType);
-#else
-        result = AddServerRequest(&request, protocolRequest->coapID,
-                protocolRequest->delayedResNeeded, protocolRequest->secured, 0,
-                protocolRequest->method, protocolRequest->numRcvdVendorSpecificHeaderOptions,
-                protocolRequest->observationOption, protocolRequest->qos,
-                protocolRequest->query, protocolRequest->rcvdVendorSpecificHeaderOptions,
-                protocolRequest->reqJSONPayload, &protocolRequest->requestToken,
-                &protocolRequest->requesterAddr, protocolRequest->resourceUrl,
-                protocolRequest->reqTotalSize);
-#endif
         if (OC_STACK_OK != result)
         {
             OC_LOG(ERROR, TAG, PCF("Error adding server request"));
@@ -1239,7 +1219,6 @@ OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode)
     }
 
     OCSeedRandom();
-#ifdef CA_INT
     CAInitialize();
     //It is ok to select network to CA_WIFI for now
     CAResult_t caResult = CASelectNetwork(CA_WIFI|CA_ETHERNET);
@@ -1285,35 +1264,15 @@ OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode)
             result = OC_STACK_ERROR;
         }
     }
-#else
-    switch (mode)
-    {
-    case OC_CLIENT:
-        OC_LOG(INFO, TAG, PCF("Client mode"));
-        break;
-    case OC_SERVER:
-        OC_LOG(INFO, TAG, PCF("Server mode"));
-        break;
-    case OC_CLIENT_SERVER:
-        OC_LOG(INFO, TAG, PCF("Client-server mode"));
-        break;
-    default:
-        OC_LOG(ERROR, TAG, PCF("Invalid mode"));
-        return OC_STACK_ERROR;
-        break;
-    }
-
-    // Make call to OCCoAP layer
-    result = OCInitCoAP(ipAddr, (uint16_t) port, myStackMode);
-#endif //CA_INT
 
     myStackMode = mode;
     defaultDeviceHandler = NULL;
 
-#if defined(CA_INT) && defined(__WITH_DTLS__)
+#if defined(__WITH_DTLS__)
     caResult = CARegisterDTLSCredentialsHandler(GetDtlsPskCredentials);
     result = (caResult == CA_STATUS_OK) ? OC_STACK_OK : OC_STACK_ERROR;
-#endif //(CA_INT) && (__WITH_DTLS__)
+#endif // (__WITH_DTLS__)
+
 #ifdef WITH_PRESENCE
     PresenceTimeOutSize = sizeof(PresenceTimeOut)/sizeof(PresenceTimeOut[0]) - 1;
 #endif // WITH_PRESENCE
@@ -1368,13 +1327,9 @@ OCStackResult OCStop()
     // Free memory dynamically allocated for resources
     deleteAllResources();
     DeleteDeviceInfo();
-#ifdef CA_INT
     CATerminate();
     //CATerminate does not return any error code. It is OK to assign result to OC_STACK_OK.
     result = OC_STACK_OK;
-#else //CA_INT
-    result = OCStopCoAP();
-#endif //CA_INT
 
     if (result == OC_STACK_OK)
     {
@@ -1478,17 +1433,10 @@ OCStackResult verifyUriQueryLength(const char *inputUri, uint16_t uriLen)
  * Note: IN case of CA, when using multicast, the required URI should not contain IP address.
  *       Instead, it just contains the URI to the resource such as "/oc/core".
  */
-#ifdef CA_INT
 OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requiredUri,
             const char *referenceUri, const char *request, OCConnectivityType conType,
             OCQualityOfService qos, OCCallbackData *cbData,
             OCHeaderOption * options, uint8_t numOptions)
-#else
-OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requiredUri,
-                           const char *referenceUri, const char *request,
-                           OCQualityOfService qos, OCCallbackData *cbData,
-                           OCHeaderOption * options, uint8_t numOptions)
-#endif
 {
     OCStackResult result = OC_STACK_ERROR;
     ClientCB *clientCB = NULL;
@@ -1497,7 +1445,6 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requ
     unsigned char * query = NULL;
     char * newUri = (char *)requiredUri;
     (void) referenceUri;
-#ifdef CA_INT
     CARemoteEndpoint_t* endpoint = NULL;
     CAResult_t caResult;
     CAToken_t token = NULL;
@@ -1507,9 +1454,6 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requ
 
     // To track if memory is allocated for additional header options
     uint8_t hdrOptionMemAlloc = 0;
-#else
-OCCoAPToken token;
-#endif // CA_INT
 
     OC_LOG(INFO, TAG, PCF("Entering OCDoResource"));
 
@@ -1598,7 +1542,6 @@ OCCoAPToken token;
         goto exit;
     }
 
-#ifdef CA_INT
     memset(&requestData, 0, sizeof(CAInfo_t));
     memset(&requestInfo, 0, sizeof(CARequestInfo_t));
     memset(&grpEnd, 0, sizeof(CAGroupEndpoint_t));
@@ -1725,23 +1668,6 @@ OCCoAPToken token;
         goto exit;
     }
 
-#else // CA_INT
-
-    // Generate token which will be used by OCStack to match responses received
-    // with the request
-    OCGenerateCoAPToken(&token);
-
-    if((result = AddClientCB(&clientCB, cbData, &token, handle, method, requestUri, resourceType))
-            != OC_STACK_OK)
-    {
-        result = OC_STACK_NO_MEMORY;
-        goto exit;
-    }
-
-    // Make call to OCCoAP layer
-    result = OCDoCoAPResource(method, qos, &token, newUri, request, options, numOptions);
-#endif // CA_INT
-
 exit:
     if(newUri != requiredUri)
     {
@@ -1752,14 +1678,12 @@ exit:
         OC_LOG(ERROR, TAG, PCF("OCDoResource error"));
         FindAndDeleteClientCB(clientCB);
     }
-#ifdef CA_INT
     CADestroyRemoteEndpoint(endpoint);
     OCFree(grpEnd.resourceUri);
     if (hdrOptionMemAlloc)
     {
         OCFree(requestData.options);
     }
-#endif // CA_INT
     return result;
 }
 
@@ -1797,14 +1721,12 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption
      *      Remove the callback associated on client side.
      */
     OCStackResult ret = OC_STACK_OK;
-#ifdef CA_INT
     CARemoteEndpoint_t* endpoint = NULL;
     CAResult_t caResult;
     CAInfo_t requestData;
     CARequestInfo_t requestInfo;
     // Track if memory is allocated for additional header options
     uint8_t hdrOptionMemAlloc = 0;
-#endif // CA_INT
 
     if(!handle) {
         return OC_STACK_INVALID_PARAM;
@@ -1819,7 +1741,6 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption
         {
             case OC_REST_OBSERVE:
             case OC_REST_OBSERVE_ALL:
-                #ifdef CA_INT
                 //TODO-CA : Why CA_WIFI alone?
                 caResult = CACreateRemoteEndpoint((char *)clientCB->requestUri, CA_WIFI,
                                                   &endpoint);
@@ -1852,19 +1773,6 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption
                 {
                     ret = OC_STACK_OK;
                 }
-                #else // CA_INT
-                if(qos == OC_HIGH_QOS)
-                {
-                    ret = OCDoCoAPResource(OC_REST_CANCEL_OBSERVE, qos,
-                            &(clientCB->token), (const char *) clientCB->requestUri, NULL, options,
-                            numOptions);
-                }
-                else
-                {
-                    FindAndDeleteClientCB(clientCB);
-                }
-                break;
-                #endif // CA_INT
             #ifdef WITH_PRESENCE
             case OC_REST_PRESENCE:
                 FindAndDeleteClientCB(clientCB);
@@ -1874,19 +1782,16 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption
                 return OC_STACK_INVALID_METHOD;
         }
     }
-#ifdef CA_INT
     CADestroyRemoteEndpoint(endpoint);
     if (hdrOptionMemAlloc)
     {
         OCFree(requestData.options);
     }
-#endif // CA_INT
 
     return ret;
 }
 
 #ifdef WITH_PRESENCE
-#ifdef CA_INT
 OCStackResult OCProcessPresence()
 {
     OCStackResult result = OC_STACK_OK;
@@ -2009,109 +1914,6 @@ exit:
     }
     return result;
 }
-#else
-OCStackResult OCProcessPresence()
-{
-    OCStackResult result = OC_STACK_OK;
-    uint8_t ipAddr[4] = { 0 };
-    uint16_t port = 0;
-
-    ClientCB* cbNode = NULL;
-    OCDevAddr dst;
-    OCClientResponse clientResponse;
-    OCResponse * response = NULL;
-
-    LL_FOREACH(cbList, cbNode) {
-        if(OC_REST_PRESENCE == cbNode->method)
-        {
-            if(cbNode->presence)
-            {
-                uint32_t now = GetTime(0);
-                OC_LOG_V(DEBUG, TAG, "----------------this TTL level %d", cbNode->presence->TTLlevel);
-                OC_LOG_V(DEBUG, TAG, "----------------current ticks %d", now);
-
-
-                if(cbNode->presence->TTLlevel >= (PresenceTimeOutSize + 1))
-                {
-                    goto exit;
-                }
-
-                if(cbNode->presence->TTLlevel < PresenceTimeOutSize){
-                    OC_LOG_V(DEBUG, TAG, "----------------timeout ticks %d",
-                            cbNode->presence->timeOut[cbNode->presence->TTLlevel]);
-                }
-
-                if(cbNode->presence->TTLlevel >= PresenceTimeOutSize)
-                {
-                    OC_LOG(DEBUG, TAG, PCF("----------------No more timeout ticks"));
-                    if (ParseIPv4Address( cbNode->requestUri, ipAddr, &port))
-                    {
-                        OCBuildIPv4Address(ipAddr[0], ipAddr[1], ipAddr[2], ipAddr[3], port,
-                                &dst);
-                        result = FormOCClientResponse(&clientResponse, OC_STACK_PRESENCE_TIMEOUT,
-                                (OCDevAddr *) &dst, 0, NULL);
-                        if(result != OC_STACK_OK)
-                        {
-                            goto exit;
-                        }
-                        result = FormOCResponse(&response, cbNode, 0, NULL, NULL,
-                                &cbNode->token, &clientResponse, NULL);
-                        if(result != OC_STACK_OK)
-                        {
-                            goto exit;
-                        }
-
-                        // Increment the TTLLevel (going to a next state), so we don't keep
-                        // sending presence notification to client.
-                        cbNode->presence->TTLlevel++;
-                        OC_LOG_V(DEBUG, TAG, "----------------moving to TTL level %d",
-                                                cbNode->presence->TTLlevel);
-                    }
-                    else
-                    {
-                        result = OC_STACK_INVALID_IP;
-                        goto exit;
-                    }
-                    HandleStackResponses(response);
-                }
-                if(now >= cbNode->presence->timeOut[cbNode->presence->TTLlevel])
-                {
-                    OC_LOG(DEBUG, TAG, PCF("time to test server presence =========="));
-
-#ifdef CA_INT
-                    CAToken_t token = NULL;
-                    CAResult_t caResult = CAGenerateToken(&token);
-                    if (caResult != CA_STATUS_OK)
-                    {
-                        CADestroyToken(token);
-                        goto exit;
-                    }
-#else
-                    OCCoAPToken token;
-                    OCGenerateCoAPToken(&token);
-
-                    result = OCDoCoAPResource(OC_REST_GET, OC_LOW_QOS,
-                            &token, (const char *)cbNode->requestUri, NULL, NULL, 0);
-
-                    if(result != OC_STACK_OK)
-                    {
-                        goto exit;
-                    }
-#endif // CA_INT
-                    cbNode->presence->TTLlevel++;
-                    OC_LOG_V(DEBUG, TAG, "----------------moving to TTL level %d", cbNode->presence->TTLlevel);
-                }
-            }
-        }
-    }
-exit:
-    if (result != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, TAG, PCF("OCProcessPresence error"));
-    }
-    return result;
-}
-#endif // CA_INT
 #endif // WITH_PRESENCE
 
 /**
@@ -2127,11 +1929,7 @@ OCStackResult OCProcess()
     #ifdef WITH_PRESENCE
     OCProcessPresence();
     #endif
-#ifdef CA_INT
     CAHandleRequestResponse();
-#else
-    OCProcessCoAP();
-#endif // CA_INT
 
     return OC_STACK_OK;
 }
@@ -2169,7 +1967,6 @@ OCStackResult OCStartPresence(const uint32_t ttl)
 
         OCBuildIPv4Address(224, 0, 1, 187, 5683, &multiCastAddr);
 
-#ifdef CA_INT
         CAAddress_t addressInfo;
         strncpy(addressInfo.IP.ipAddress, "224.0.1.187", CA_IPADDR_SIZE);
         addressInfo.IP.port = 5683;
@@ -2188,13 +1985,6 @@ OCStackResult OCStartPresence(const uint32_t ttl)
         AddObserver(OC_PRESENCE_URI, NULL, 0, &caToken,
                 &multiCastAddr, (OCResource *)presenceResource.handle, OC_LOW_QOS,
                 &addressInfo, CA_WIFI);
-#else
-        OCCoAPToken token;
-        OCGenerateCoAPToken(&token);
-        //add the presence observer
-        AddObserver(OC_PRESENCE_URI, NULL, 0, &token, &multiCastAddr,
-            (OCResource *)presenceResource.handle, OC_LOW_QOS);
-#endif
     }
 
     // Each time OCStartPresence is called
index 731c404..e20bccb 100644 (file)
@@ -677,15 +677,9 @@ OCStackResult SendAction(OCDoHandle *handle, const char *targetUri, const unsign
     cbdata.cd = &ActionSetCD;
     cbdata.context = (void *) 0x99;
 
-#ifdef CA_INT
     return OCDoResource(handle, OC_REST_PUT, targetUri,
     //temp->rsrcType->resourcetypename,
             NULL, (char *) action, OC_WIFI, OC_NA_QOS, &cbdata, NULL, 0);
-#else
-    return OCDoResource(handle, OC_REST_PUT, targetUri,
-    //temp->rsrcType->resourcetypename,
-            NULL, (char *) action, OC_NA_QOS, &cbdata, NULL, 0);
-#endif
 }
 
 OCStackResult BuildCollectionGroupActionJSONResponse(OCMethod method/*OCEntityHandlerFlag flag*/,
index a12ee23..4b11750 100644 (file)
@@ -47,8 +47,6 @@ if target_os == 'android':
 if target_os in ['darwin', 'ios']:
        examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
 
-examples_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index b75eaa3..fa630e3 100644 (file)
@@ -116,7 +116,6 @@ int main(int argc, char* argv[]) {
     ostringstream requestURI;
     std::string deviceDiscoveryURI = "/oc/core/d";
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
 
     if(argc == 2)
@@ -159,7 +158,6 @@ int main(int argc, char* argv[]) {
         std::cout << "connectivityType 0: ETHERNET" << std::endl;
         std::cout << "connectivityType 1: WIFI" << std::endl;
     }
-#endif
     // Create PlatformConfig object
     PlatformConfig cfg {
         OC::ServiceType::InProc,
@@ -174,12 +172,8 @@ int main(int argc, char* argv[]) {
     {
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
 
-#ifdef CA_INT
         OCPlatform::getDeviceInfo("", requestURI.str(), connectivityType,
                 &receivedDeviceInfo);
-#else
-        OCPlatform::getDeviceInfo("",  requestURI.str(), &receivedDeviceInfo);
-#endif
         std::cout<< "Querying for device information... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 7b6bc5e..392a479 100644 (file)
@@ -37,9 +37,7 @@ namespace PH = std::placeholders;
 const uint16_t API_VERSION = 2048;
 const uint16_t TOKEN = 3000;
 
-#ifdef CA_INT
 static OCConnectivityType connectivityType = OC_WIFI;
-#endif
 
 class ClientFridge
 {
@@ -50,13 +48,8 @@ class ClientFridge
         requestURI << OC_WELL_KNOWN_QUERY << "?rt=intel.fridge";
         std::cout << "Fridge Client has started " <<std::endl;
         FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1));
-#ifdef CA_INT
         OCStackResult result = OCPlatform::findResource(
                 "", requestURI.str(), connectivityType, f);
-#else
-        OCStackResult result = OCPlatform::findResource(
-                "", requestURI.str(), f);
-#endif
 
         if(OC_STACK_OK != result)
         {
@@ -89,13 +82,8 @@ class ClientFridge
         // server, and query them.
         std::vector<std::string> lightTypes = {"intel.fridge.light"};
         std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
-#ifdef CA_INT
         OCResource::Ptr light = constructResourceObject(resource->host(),
                                 "/light", connectivityType, false, lightTypes, ifaces);
-#else
-        OCResource::Ptr light = constructResourceObject(resource->host(),
-                                "/light", false, lightTypes, ifaces);
-#endif
 
         if(!light)
         {
@@ -104,13 +92,8 @@ class ClientFridge
         }
 
         std::vector<std::string> doorTypes = {"intel.fridge.door"};
-#ifdef CA_INT
         OCResource::Ptr leftdoor = constructResourceObject(resource->host(),
                                 "/door/left", connectivityType, false, doorTypes, ifaces);
-#else
-        OCResource::Ptr leftdoor = constructResourceObject(resource->host(),
-                                "/door/left", false, doorTypes, ifaces);
-#endif
 
         if(!leftdoor)
         {
@@ -118,13 +101,8 @@ class ClientFridge
             return;
         }
 
-#ifdef CA_INT
         OCResource::Ptr rightdoor = constructResourceObject(resource->host(),
                                 "/door/right", connectivityType, false, doorTypes, ifaces);
-#else
-        OCResource::Ptr rightdoor = constructResourceObject(resource->host(),
-                                "/door/right", false, doorTypes, ifaces);
-#endif
 
         if(!rightdoor)
         {
@@ -132,13 +110,8 @@ class ClientFridge
             return;
         }
 
-#ifdef CA_INT
         OCResource::Ptr randomdoor = constructResourceObject(resource->host(),
                                 "/door/random", connectivityType, false, doorTypes, ifaces);
-#else
-        OCResource::Ptr randomdoor = constructResourceObject(resource->host(),
-                                "/door/random", false, doorTypes, ifaces);
-#endif
         if(!randomdoor)
         {
             std::cout << "Error: Random Door Resource Object construction returned null\n";
@@ -273,7 +246,6 @@ class ClientFridge
 int main(int argc, char* argv[])
 {
 
-#ifdef CA_INT
     if(argc == 2)
     {
         try
@@ -314,7 +286,6 @@ int main(int argc, char* argv[])
         std::cout<<"ConnectivityType 0: ETHERNET\n";
         std::cout<<"ConnectivityType 1: WIFI\n";
     }
-#endif
 
     PlatformConfig cfg
     {
index c9997e6..2976aba 100644 (file)
@@ -271,7 +271,6 @@ int main(int argc, char* argv[]) {
 
 ostringstream requestURI;
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
 
     if(argc == 2)
@@ -314,7 +313,6 @@ ostringstream requestURI;
         std::cout<<"ConnectivityType 0: ETHERNET\n";
         std::cout<<"ConnectivityType 1: WIFI\n";
     }
-#endif
 
     // Create PlatformConfig object
     PlatformConfig cfg {
@@ -331,13 +329,9 @@ ostringstream requestURI;
         // Find all resources
         requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.garage";
 
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                 connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(),
-                    &foundResource);
-#endif
+
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 4cc97e0..88a92db 100644 (file)
@@ -157,7 +157,6 @@ int main(int argc, char* argv[])
     ostringstream requestURI;
     requestURI << OC_WELL_KNOWN_QUERY << "?rt=a.collection";
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
 
     if(argc == 2)
@@ -200,7 +199,6 @@ int main(int argc, char* argv[])
         std::cout<<"ConnectivityType 0: ETHERNET\n";
         std::cout<<"ConnectivityType 1: WIFI\n";
     }
-#endif
 
     PlatformConfig config
     { OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos };
@@ -212,12 +210,9 @@ int main(int argc, char* argv[])
         OCPlatform::Configure(config);
 
         string resourceTypeName = "a.collection";
-#ifdef CA_INT
+
         OCPlatform::findResource("", requestURI.str(),
                                  connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
 
         //Non-intensive block until foundResource callback is called by OCPlatform
         //and onGet gets resource.
index 1cd5e26..27caa9c 100644 (file)
@@ -83,7 +83,6 @@ int main(int argc, char* argv[])
 {
     ostringstream requestURI;
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
 
     if(argc == 2)
@@ -126,7 +125,6 @@ int main(int argc, char* argv[])
         std::cout<<"ConnectivityType 0: ETHERNET\n";
         std::cout<<"ConnectivityType 1: WIFI\n";
     }
-#endif
 
     PlatformConfig config
     { OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
@@ -150,12 +148,8 @@ int main(int argc, char* argv[])
 
         requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
 
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                                  connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
 
         OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
         OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
index 3f83d02..2ad3931 100644 (file)
@@ -27,9 +27,9 @@ CXX         := g++
 OUT_DIR          := $(BUILD)
 
 #TODO-CA Remove the CA Flag later
-CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread -DCA_INT
+CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread
 
-CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread -DCA_INT
+CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
 
 CXX_INC          := -I../include/
 CXX_INC   += -I../oc_logger/include
index 9390788..0a646dc 100644 (file)
@@ -35,9 +35,7 @@ std::shared_ptr<OCResource> curResource;
 
 static int TEST_CASE = 0;
 
-#ifdef CA_INT
 static OCConnectivityType connectivityType = OC_WIFI;
-#endif
 
 /**
  * List of methods that can be inititated from the client
@@ -54,11 +52,7 @@ typedef enum {
 
 void printUsage()
 {
-#ifdef CA_INT
     std::cout << "Usage : presenceclient -t <1|2> -c <0|1>" << std::endl;
-#else
-    std::cout << "Usage : presenceclient -t <1|2>" << std::endl;
-#endif
     std::cout << "-t 1 : Discover Resources and Initiate Unicast Presence" << std::endl;
     std::cout << "-t 2 : Discover Resources and Initiate Unicast Presence with Filter"
               << std::endl;
@@ -69,11 +63,9 @@ void printUsage()
               << std::endl;
     std::cout << "-t 6 : Discover Resources and Initiate Multicast Presence with two Filters"
                   << std::endl;
-#ifdef CA_INT
     std::cout<<"ConnectivityType: Default WIFI" << std::endl;
     std::cout << "-c 0 : Send message over ETHERNET interface" << std::endl;
     std::cout << "-c 1 : Send message over WIFI interface" << std::endl;
-#endif
 }
 
 // Callback to presence
@@ -148,13 +140,8 @@ void foundResource(std::shared_ptr<OCResource> resource)
 
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_NORMAL)
                 {
-#ifdef CA_INT
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
                             connectivityType, &presenceHandler);
-#else
-                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
-                            &presenceHandler);
-#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress << std::endl;
@@ -168,13 +155,8 @@ void foundResource(std::shared_ptr<OCResource> resource)
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTER ||
                         TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTERS)
                 {
-#ifdef CA_INT
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
                             "core.light", connectivityType, &presenceHandler);
-#else
-                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
-                            "core.light", &presenceHandler);
-#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress;
@@ -187,13 +169,8 @@ void foundResource(std::shared_ptr<OCResource> resource)
                 }
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTERS)
                 {
-#ifdef CA_INT
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress, "core.fan",
                             connectivityType, &presenceHandler);
-#else
-                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress, "core.fan",
-                            &presenceHandler);
-#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress;
@@ -225,24 +202,17 @@ int main(int argc, char* argv[]) {
 
     int opt;
 
-#ifdef CA_INT
     int optionSelected;
-#endif
 
     try
     {
-#ifdef CA_INT
         while ((opt = getopt(argc, argv, "t:c:")) != -1)
-        #else
-        while ((opt = getopt(argc, argv, "t:")) != -1)
-        #endif
         {
             switch(opt)
             {
                 case 't':
                     TEST_CASE = stoi(optarg);
                     break;
-#ifdef CA_INT
                 case 'c':
                     std::size_t inputValLen;
                     optionSelected = stoi(optarg, &inputValLen);
@@ -269,7 +239,6 @@ int main(int argc, char* argv[]) {
                             << std::endl;
                     }
                     break;
-#endif
                 default:
                     printUsage();
                     return -1;
@@ -308,13 +277,8 @@ int main(int argc, char* argv[]) {
 
         if(TEST_CASE == TEST_MULTICAST_PRESENCE_NORMAL)
         {
-#ifdef CA_INT
             result = OCPlatform::subscribePresence(presenceHandle,
                     OC_MULTICAST_IP, connectivityType, presenceHandler);
-#else
-            result = OCPlatform::subscribePresence(presenceHandle,
-                    OC_MULTICAST_IP, presenceHandler);
-#endif
 
             if(result == OC_STACK_OK)
             {
@@ -327,13 +291,8 @@ int main(int argc, char* argv[]) {
         }
         else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTER)
         {
-#ifdef CA_INT
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
                     connectivityType, &presenceHandler);
-#else
-            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
-                    &presenceHandler);
-#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Subscribed to multicast presence with resource type";
@@ -346,13 +305,8 @@ int main(int argc, char* argv[]) {
         }
         else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTERS)
         {
-#ifdef CA_INT
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
                     connectivityType, &presenceHandler);
-#else
-            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
-                    &presenceHandler);
-#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Subscribed to multicast presence with resource type";
@@ -363,13 +317,8 @@ int main(int argc, char* argv[]) {
             }
             std::cout << "\"core.light\"." << std::endl;
 
-#ifdef CA_INT
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.fan",
                     connectivityType, &presenceHandler);
-#else
-            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.fan",
-                    &presenceHandler);
-#endif
             if(result == OC_STACK_OK)
             {
                 std::cout<< "Subscribed to multicast presence with resource type";
@@ -385,12 +334,8 @@ int main(int argc, char* argv[]) {
             // Find all resources
             requestURI << OC_WELL_KNOWN_QUERY;
 
-#ifdef CA_INT
             result = OCPlatform::findResource("", requestURI.str(),
                     connectivityType, &foundResource);
-#else
-            result = OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Finding Resource... " << std::endl;
index 596832f..cf84a60 100644 (file)
@@ -221,7 +221,6 @@ int main(int argc, char* argv[]) {
 
     ostringstream requestURI;
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
     if(argc == 2)
     {
@@ -263,7 +262,6 @@ int main(int argc, char* argv[]) {
         std::cout << "connectivityType 0: ETHERNET" << std::endl;
         std::cout << "connectivityType 1: WIFI" << std::endl;
     }
-#endif
 
     // Create PlatformConfig object
     PlatformConfig cfg {
@@ -281,11 +279,7 @@ int main(int argc, char* argv[]) {
         // Find all resources
         requestURI << OC_WELL_KNOWN_QUERY;
 
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index f7293a7..e5286ce 100644 (file)
@@ -387,38 +387,27 @@ void foundResource(std::shared_ptr<OCResource> resource)
 void PrintUsage()
 {
     std::cout << std::endl;
-#ifdef CA_INT
     std::cout << "Usage : simpleclient <ObserveType> <ConnectivityType>" << std::endl;
-#else
-    std::cout << "Usage : simpleclient <ObserveType>" << std::endl;
-#endif
     std::cout << "   ObserveType : 1 - Observe" << std::endl;
     std::cout << "   ObserveType : 2 - ObserveAll" << std::endl;
-#ifdef CA_INT
     std::cout<<"    connectivityType: Default WIFI" << std::endl;
     std::cout << "   ConnectivityType : 0 - ETHERNET"<< std::endl;
     std::cout << "   ConnectivityType : 1 - WIFI"<< std::endl;
-#endif
 }
 
 int main(int argc, char* argv[]) {
 
     ostringstream requestURI;
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
-#endif
+
     try
     {
         if (argc == 1)
         {
             OBSERVE_TYPE_TO_USE = ObserveType::Observe;
         }
-#ifdef CA_INT
         else if (argc >= 2)
-#else
-        else if (argc == 2)
-#endif
         {
             int value = stoi(argv[1]);
             if (value == 1)
@@ -427,7 +416,6 @@ int main(int argc, char* argv[]) {
                 OBSERVE_TYPE_TO_USE = ObserveType::ObserveAll;
             else
                 OBSERVE_TYPE_TO_USE = ObserveType::Observe;
-#ifdef CA_INT
             if(argc == 3)
             {
                 std::size_t inputValLen;
@@ -455,7 +443,6 @@ int main(int argc, char* argv[]) {
                     << std::endl;
                 }
             }//if arg = 3
-#endif
         }
         else
         {
@@ -487,23 +474,15 @@ int main(int argc, char* argv[]) {
         // Find all resources
         requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
 
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                 connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // Find resource is done twice so that we discover the original resources a second time.
         // These resources will have the same uniqueidentifier (yet be different objects), so that
         // we can verify/show the duplicate-checking code in foundResource(above);
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                 connectivityType, &foundResource);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource);
-#endif
         std::cout<< "Finding Resource for second time..." << std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 04faa23..12a5ee9 100644 (file)
@@ -369,38 +369,26 @@ void foundResource(std::shared_ptr<OCResource> resource)
 void PrintUsage()
 {
     std::cout << std::endl;
-#ifdef CA_INT
     std::cout << "Usage : simpleclientHQ <ObserveType> <ConnectivityType>" << std::endl;
-#else
-    std::cout << "Usage : simpleclientHQ <ObserveType>" << std::endl;
-#endif
     std::cout << "   ObserveType : 1 - Observe" << std::endl;
     std::cout << "   ObserveType : 2 - ObserveAll" << std::endl;
-#ifdef CA_INT
     std::cout<<"    ConnectivityType: Default WIFI" << std::endl;
     std::cout << "   ConnectivityType : 0 - ETHERNET"<< std::endl;
     std::cout << "   ConnectivityType : 1 - WIFI"<< std::endl;
-#endif
 }
 
 int main(int argc, char* argv[]) {
 
     ostringstream requestURI;
 
-#ifdef CA_INT
     OCConnectivityType connectivityType = OC_WIFI;
-#endif
     try
     {
         if (argc == 1)
         {
             OBSERVE_TYPE_TO_USE = ObserveType::Observe;
         }
-#ifdef CA_INT
         else if (argc >= 2)
-#else
-        else if (argc == 2)
-#endif
         {
             int value = stoi(argv[1]);
             if (value == 1)
@@ -410,7 +398,6 @@ int main(int argc, char* argv[]) {
             else
                 OBSERVE_TYPE_TO_USE = ObserveType::Observe;
 
-#ifdef CA_INT
             if(argc == 3)
             {
                 std::size_t inputValLen;
@@ -438,7 +425,6 @@ int main(int argc, char* argv[]) {
                     << std::endl;
                 }
             }
-#endif
         }
         else
         {
@@ -468,25 +454,15 @@ int main(int argc, char* argv[]) {
         // Find all resources
         requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
 
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                 connectivityType, &foundResource, OC::QualityOfService::LowQos);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource,
-                OC::QualityOfService::LowQos);
-#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // Find resource is done twice so that we discover the original resources a second time.
         // These resources will have the same uniqueidentifier (yet be different objects), so that
         // we can verify/show the duplicate-checking code in foundResource(above);
-#ifdef CA_INT
         OCPlatform::findResource("", requestURI.str(),
                 connectivityType, &foundResource, OC::QualityOfService::LowQos);
-#else
-        OCPlatform::findResource("", requestURI.str(), &foundResource,
-                OC::QualityOfService::LowQos);
-#endif
         std::cout<< "Finding Resource for second time... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 22a0dcd..04a9cb1 100644 (file)
@@ -33,9 +33,7 @@
 #include "OCApi.h"
 using namespace OC;
 
-#ifdef CA_INT
 OCConnectivityType connectivityType = OC_WIFI;
-#endif
 
 class ClientWorker
 {
@@ -153,15 +151,9 @@ public:
 
         std::cout<<"Starting Client find:"<<std::endl;
         FindCallback f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
-#ifdef CA_INT
         std::cout<<"result:" <<
         OCPlatform::findResource("", requestURI.str(), connectivityType, f)
         << std::endl;
-#else
-        std::cout<<"result:" <<
-        OCPlatform::findResource("", requestURI.str(), f)
-        << std::endl;
-#endif
 
         std::cout<<"Finding Resource..."<<std::endl;
 
@@ -306,7 +298,6 @@ struct FooResource
 int main(int argc, char* argv[])
 {
 
-#ifdef CA_INT
     if(argc == 2)
     {
         try
@@ -347,7 +338,6 @@ int main(int argc, char* argv[])
         std::cout << "   ConnectivityType : 0 - ETHERNET" << std::endl;
         std::cout << "   ConnectivityType : 1 - WIFI" << std::endl;
     }
-#endif
 
     PlatformConfig cfg {
         OC::ServiceType::InProc,
index 24e7200..8a365e2 100644 (file)
@@ -34,9 +34,7 @@
 #include "OCApi.h"
 using namespace OC;
 
-#ifdef CA_INT
 static OCConnectivityType connectivityType = OC_WIFI;
-#endif
 
 static std::ostringstream requestURI;
 
@@ -285,13 +283,8 @@ void foundResource1(std::shared_ptr<OCResource> resource)
 void client1()
 {
     std::cout << "in client1\n";
-#ifdef CA_INT
     std::cout<<"result1:" << OCPlatform::findResource("", requestURI.str(),
             connectivityType, foundResource1)<< std::endl;
-#else
-    std::cout<<"result1:" << OCPlatform::findResource("", requestURI.str(),
-            foundResource1)<< std::endl;
-#endif
 
     // A condition variable will free the mutex it is given, then do a non-
     // intensive block until 'notify' is called on it.  In this case, since we
@@ -306,15 +299,9 @@ void client1()
 void client2()
 {
     std::cout << "in client2\n";
-#ifdef CA_INT
     std::cout<<"result2:" << OCPlatform::findResource("",
                 requestURI.str(),
                 connectivityType, foundResource2)<< std::endl;
-#else
-    std::cout<<"result2:" << OCPlatform::findResource("",
-                requestURI.str(),
-                foundResource2)<< std::endl;
-#endif
 
     // A condition variable will free the mutex it is given, then do a non-
     // intensive block until 'notify' is called on it.  In this case, since we
@@ -348,7 +335,6 @@ void server()
 int main(int argc, char* argv[])
 {
 
-#ifdef CA_INT
     if(argc == 2)
     {
         try
@@ -389,7 +375,6 @@ int main(int argc, char* argv[])
         std::cout << "   ConnectivityType : 0 - ETHERNET" << std::endl;
         std::cout << "   ConnectivityType : 1 - WIFI" << std::endl;
     }
-#endif
 
     requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.foo";
 
index 5ce6395..12f70b0 100644 (file)
@@ -40,7 +40,6 @@ namespace OC
         IClientWrapper()
         {}
 
-#ifdef CA_INT
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
                         const std::string& resourceType, OCConnectivityType connectivityType,
                         FindCallback& callback,
@@ -78,50 +77,14 @@ namespace OC
                         OCConnectivityType connectivityType, const QueryParamsMap& queryParams,
                         const HeaderOptions& headerOptions, ObserveCallback& callback,
                         QualityOfService QoS)=0;
-#else
-        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
-                        const std::string& resourceType, FindCallback& callback,
-                        QualityOfService QoS) = 0;
-
-        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
-                        const std::string& deviceURI, FindDeviceCallback& callback,
-                        QualityOfService QoS) = 0;
-
-        virtual OCStackResult GetResourceRepresentation(const std::string& host,
-                        const std::string& uri, const QueryParamsMap& queryParams,
-                        const HeaderOptions& headerOptions,
-                        GetCallback& callback, QualityOfService QoS)=0;
-
-        virtual OCStackResult PutResourceRepresentation(const std::string& host,
-                        const std::string& uri, const OCRepresentation& rep,
-                        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-                        PutCallback& callback, QualityOfService QoS) = 0;
 
-        virtual OCStackResult PostResourceRepresentation(const std::string& host,
-                        const std::string& uri, const OCRepresentation& rep,
-                        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-                        PostCallback& callback, QualityOfService QoS) = 0;
-
-        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
-                        const HeaderOptions& headerOptions, DeleteCallback& callback,
-                        QualityOfService QoS) = 0;
-
-        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
-                        const std::string& host, const std::string& uri,
-                        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-                        ObserveCallback& callback, QualityOfService QoS)=0;
-#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri, const HeaderOptions& headerOptions, QualityOfService QoS)=0;
 
-#ifdef CA_INT
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
                         const std::string& resourceType, OCConnectivityType connectivityType,
                         SubscribeCallback& presenceHandler)=0;
-#else
-        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
-                        const std::string& resourceType, SubscribeCallback& presenceHandler)=0;
-#endif
+
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
 
         virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0;
index f7351c6..bf94989 100644 (file)
@@ -83,7 +83,6 @@ namespace OC
                             PlatformConfig cfg);
         virtual ~InProcClientWrapper();
 
-#ifdef CA_INT
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
             const std::string& resourceType, OCConnectivityType connectivityType,
             FindCallback& callback, QualityOfService QoS);
@@ -115,48 +114,13 @@ namespace OC
             const std::string& host, const std::string& uri, OCConnectivityType connectivityType,
             const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
             ObserveCallback& callback, QualityOfService QoS);
-#else
-        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
-            const std::string& resourceType, FindCallback& callback,
-            QualityOfService QoS);
-
-        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
-            const std::string& deviceURI, FindDeviceCallback& callback,
-            QualityOfService QoS);
-
-        virtual OCStackResult GetResourceRepresentation(const std::string& host,
-            const std::string& uri, const QueryParamsMap& queryParams,
-            const HeaderOptions& headerOptions,
-            GetCallback& callback, QualityOfService QoS);
-
-        virtual OCStackResult PutResourceRepresentation(const std::string& host,
-            const std::string& uri, const OCRepresentation& attributes,
-            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-            PutCallback& callback, QualityOfService QoS);
 
-        virtual OCStackResult PostResourceRepresentation(const std::string& host,
-            const std::string& uri, const OCRepresentation& attributes,
-            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-            PostCallback& callback, QualityOfService QoS);
-
-        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
-             const HeaderOptions& headerOptions, DeleteCallback& callback, QualityOfService QoS);
-
-        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
-            const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
-            const HeaderOptions& headerOptions, ObserveCallback& callback, QualityOfService QoS);
-#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri, const HeaderOptions& headerOptions, QualityOfService QoS);
 
-#ifdef CA_INT
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
             const std::string& resourceType, OCConnectivityType connectivityType,
             SubscribeCallback& presenceHandler);
-#else
-        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
-            const std::string& resourceType, SubscribeCallback& presenceHandler);
-#endif
 
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle);
         OCStackResult GetDefaultQos(QualityOfService& QoS);
index c3fbdc5..c932b2b 100644 (file)
@@ -114,18 +114,11 @@ namespace OC
         * as BTH etc.
         * NOTE: OCStackResult is defined in ocstack.h.
         */
-#ifdef CA_INT
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     OCConnectivityType connectivityType, FindCallback resourceHandler);
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     OCConnectivityType connectivityType, FindCallback resourceHandler,
                     QualityOfService QoS);
-#else
-        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
-                    FindCallback resourceHandler);
-        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
-                    FindCallback resourceHandler, QualityOfService QoS);
-#endif
 
         /**
          * API for Device Discovery
@@ -137,18 +130,11 @@ namespace OC
          * @param QualityOfService the quality of communication
          *
          */
-#ifdef CA_INT
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler);
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler,
                     QualityOfService QoS);
-#else
-        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
-                    FindDeviceCallback deviceInfoHandler);
-        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
-                    FindDeviceCallback deviceInfoHandler, QualityOfService QoS);
-#endif
 
         /**
         * This API registers a resource with the server
@@ -397,18 +383,11 @@ namespace OC
         *
         * @return OCStackResult - return value of the API.  Returns OCSTACK_OK if success <br>
         */
-#ifdef CA_INT
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         OCConnectivityType connectivityType, SubscribeCallback presenceHandler);
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         const std::string& resourceType, OCConnectivityType connectivityType,
                         SubscribeCallback presenceHandler);
-#else
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
-                        SubscribeCallback presenceHandler);
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
-                        const std::string& resourceType, SubscribeCallback presenceHandler);
-#endif
 
         /**
         * unsubscribes from a previously subscribed server's presence events. Note that
@@ -447,16 +426,10 @@ namespace OC
         * @param interfaces - a collection of interfaces that the resource supports/implements
         * @return OCResource::Ptr - a shared pointer to the new resource object
         */
-#ifdef CA_INT
         OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
                         OCConnectivityType connectivityType, bool isObservable,
                         const std::vector<std::string>& resourceTypes,
                         const std::vector<std::string>& interfaces);
-#else
-        OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
-                        bool isObservable, const std::vector<std::string>& resourceTypes,
-                        const std::vector<std::string>& interfaces);
-#endif
 
         /**
         * Allows application entity handler to send response to an incoming request.
index 6f7ca58..71ca5f1 100644 (file)
@@ -140,18 +140,11 @@ namespace OC
         * as BTH etc.
         * NOTE: OCStackResult is defined in ocstack.h.
         */
-#ifdef CA_INT
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     OCConnectivityType connectivityType, FindCallback resourceHandler);
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     OCConnectivityType connectivityType, FindCallback resourceHandler,
                     QualityOfService QoS);
-#else
-        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
-                    FindCallback resourceHandler);
-        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
-                    FindCallback resourceHandler, QualityOfService QoS);
-#endif
         /**
          * API for Device Discovery
          *
@@ -162,18 +155,11 @@ namespace OC
          * @param QualityOfService the quality of communication
          *
          */
-#ifdef CA_INT
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler);
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler,
                     QualityOfService QoS);
-#else
-        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
-                    FindDeviceCallback deviceInfoHandler);
-        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
-                    FindDeviceCallback deviceInfoHandler, QualityOfService QoS);
-#endif
 
         /**
         * This API registers a resource with the server
@@ -418,18 +404,11 @@ namespace OC
         *
         * @return OCStackResult - return value of the API.  Returns OCSTACK_OK if success <br>
         */
-#ifdef CA_INT
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         OCConnectivityType connectivityType, SubscribeCallback presenceHandler);
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         const std::string& resourceType, OCConnectivityType connectivityType,
                         SubscribeCallback presenceHandler);
-#else
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
-                        SubscribeCallback presenceHandler);
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
-                        const std::string& resourceType, SubscribeCallback presenceHandler);
-#endif
         /**
         * unsubscribes from a previously subscribed server's presence events. Note that
         * you may for a short time still receive events from the server since it may take time
@@ -467,16 +446,10 @@ namespace OC
         * @param interfaces - a collection of interfaces that the resource supports/implements
         * @return OCResource::Ptr - a shared pointer to the new resource object
         */
-#ifdef CA_INT
         OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
                         OCConnectivityType connectivityType, bool isObservable,
                         const std::vector<std::string>& resourceTypes,
                         const std::vector<std::string>& interfaces);
-#else
-        OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
-                        bool isObservable, const std::vector<std::string>& resourceTypes,
-                        const std::vector<std::string>& interfaces);
-#endif
         /**
         * Allows application entity handler to send response to an incoming request.
         *
index 5a09fbf..f11efdd 100644 (file)
@@ -312,13 +312,11 @@ namespace OC
         */
         std::string uri() const;
 
-#ifdef CA_INT
         /**
         * Function to get the connectivity type of this resource
         * @return uint8_t connectivity type
         */
         OCConnectivityType connectivityType() const;
-#endif
 
         /**
         * Function to provide ability to check if this resource is observable or not
@@ -383,9 +381,7 @@ namespace OC
         std::string m_uri;
         OCResourceIdentifier m_resourceId;
         std::string m_host;
-#ifdef CA_INT
         OCConnectivityType m_connectivityType;
-#endif
         bool m_isObservable;
         bool m_isCollection;
         std::vector<std::string> m_resourceTypes;
@@ -395,18 +391,11 @@ namespace OC
         HeaderOptions m_headerOptions;
 
     private:
-#ifdef CA_INT
         OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
             const std::string& uri, const std::string& serverId,
             OCConnectivityType m_connectivityType, bool observable,
             const std::vector<std::string>& resourceTypes,
             const std::vector<std::string>& interfaces);
-#else
-        OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
-            const std::string& uri, const std::string& serverId, bool observable,
-            const std::vector<std::string>& resourceTypes,
-            const std::vector<std::string>& interfaces);
-#endif
     };
 
 } // namespace OC
index 8ab3426..272fa29 100644 (file)
@@ -186,15 +186,9 @@ namespace OC
                 ar(resources);
             }
         public:
-#ifdef CA_INT
             ListenOCContainer(std::weak_ptr<IClientWrapper> cw, const OCDevAddr& address,
                     OCConnectivityType connectivityType, std::stringstream& json):
                 m_clientWrapper(cw), m_address(address), m_connectivityType(connectivityType)
-#else
-            ListenOCContainer(std::weak_ptr<IClientWrapper> cw, const OCDevAddr& address,
-                    std::stringstream& json):
-                m_clientWrapper(cw), m_address(address)
-#endif
             {
                 LoadFromJson(json);
             }
@@ -274,19 +268,11 @@ namespace OC
                     {
                         if(res.loaded())
                         {
-#ifdef CA_INT
                             m_resources.push_back(std::shared_ptr<OCResource>(
                                 new OCResource(m_clientWrapper,
                                     ConvertOCAddrToString(res.secureType(),res.port()),
                                     res.m_uri, res.m_serverId, m_connectivityType, res.observable(),
                                     res.resourceTypes(), res.interfaces())));
-#else
-                            m_resources.push_back(std::shared_ptr<OCResource>(
-                                new OCResource(m_clientWrapper,
-                                    ConvertOCAddrToString(res.secureType(),res.port()),
-                                    res.m_uri, res.m_serverId, res.observable(),
-                                    res.resourceTypes(), res.interfaces())));
-#endif
                         }
 
                     }
index 6b54748..a929485 100644 (file)
@@ -32,7 +32,6 @@ namespace OC
                                 PlatformConfig cfg)
         {}
 
-#ifdef CA_INT
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
             const std::string& resourceType, OCConnectivityType connectivityType,
             FindCallback& callback, QualityOfService QoS)
@@ -71,57 +70,13 @@ namespace OC
             const std::string& host, const std::string& uri, OCConnectivityType connectivityType,
             const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
             ObserveCallback& callback, QualityOfService QoS){return OC_STACK_NOTIMPL;}
-#else
-        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
-            const std::string& resourceType, FindCallback& callback, QualityOfService QoS)
-            {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
-            const std::string& deviceURI, FindDeviceCallback& callback,
-            QualityOfService QoS)
-            {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult GetResourceRepresentation(const std::string& host,
-            const std::string& uri, const QueryParamsMap& queryParams,
-            const HeaderOptions& headerOptions, GetCallback& callback,
-            QualityOfService QoS)
-            {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult PutResourceRepresentation(const std::string& host,
-            const std::string& uri, const OCRepresentation& attributes,
-            const QueryParamsMap& queryParams,
-            const HeaderOptions& headerOptions, PutCallback& callback,
-            QualityOfService QoS)
-            {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult PostResourceRepresentation(const std::string& host,
-            const std::string& uri, const OCRepresentation& attributes,
-            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-            PostCallback& callback, QualityOfService QoS)
-            {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
-            const HeaderOptions& headerOptions, DeleteCallback& callback,
-            QualityOfService QoS) {return OC_STACK_NOTIMPL;}
-
-        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
-            const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
-            const HeaderOptions& headerOptions,
-            ObserveCallback& callback, QualityOfService QoS){return OC_STACK_NOTIMPL;}
-#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri,
             const HeaderOptions& headerOptions, QualityOfService QoS){return OC_STACK_NOTIMPL;}
-#ifdef CA_INT
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
             const std::string& resourceType, OCConnectivityType connectivityType,
             SubscribeCallback& presenceHandler)
         {return OC_STACK_NOTIMPL;}
-#else
-        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
-            const std::string& resourceType, SubscribeCallback& presenceHandler)
-        {return OC_STACK_NOTIMPL;}
-#endif
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle){return OC_STACK_NOTIMPL;}
 
         virtual OCStackResult GetDefaultQos(QualityOfService& QoS){return OC_STACK_NOTIMPL;}
index edfed48..b86d0c5 100644 (file)
@@ -38,8 +38,8 @@ OUT_DIR         := $(ROOT_DIR)/$(BUILD)
 OBJ_DIR          := $(OUT_DIR)/obj
 
 #TODO-CA Need to remove flag later
-CXX_FLAGS.debug     := -g3 -std=c++0x -Wall -pthread -O0 -DCA_INT
-CXX_FLAGS.release   := -std=c++0x -Wall -pthread -O3 -DCA_INT
+CXX_FLAGS.debug     := -g3 -std=c++0x -Wall -pthread -O0 
+CXX_FLAGS.release   := -std=c++0x -Wall -pthread -O3
 
 CXX_INC          := -I./include/
 CXX_INC          += -I./oc_logger/include
index cf65473..97fe351 100644 (file)
@@ -164,13 +164,8 @@ namespace OC
         try
         {
 
-#ifdef CA_INT
             ListenOCContainer container(clientWrapper, *clientResponse->addr,
                     clientResponse->connType, requestStream);
-#else
-            ListenOCContainer container(clientWrapper, *clientResponse->addr,
-                    requestStream);
-#endif
             // loop to ensure valid construction of all resources
             for(auto resource : container.Resources())
             {
@@ -194,14 +189,9 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl,
         const std::string& resourceType, OCConnectivityType connectivityType,
         FindCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl,
-        const std::string& resourceType, FindCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
 
@@ -220,21 +210,12 @@ namespace OC
         {
             std::lock_guard<std::recursive_mutex> lock(*cLock);
             OCDoHandle handle;
-#ifdef CA_INT
             result = OCDoResource(&handle, OC_REST_GET,
                                   resourceType.c_str(),
                                   nullptr, nullptr, connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   NULL, 0);
-#else
-            result = OCDoResource(&handle, OC_REST_GET,
-                                  resourceType.c_str(),
-                                  nullptr, nullptr,
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata,
-                                  NULL, 0);
-#endif
         }
         else
         {
@@ -265,14 +246,9 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::ListenForDevice(const std::string& serviceUrl,
         const std::string& deviceURI, OCConnectivityType connectivityType,
         FindDeviceCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::ListenForDevice(const std::string& serviceUrl,
-        const std::string& deviceURI, FindDeviceCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
 
@@ -290,21 +266,12 @@ namespace OC
         {
             std::lock_guard<std::recursive_mutex> lock(*cLock);
             OCDoHandle handle;
-#ifdef CA_INT
             result = OCDoResource(&handle, OC_REST_GET,
                                   deviceURI.c_str(),
                                   nullptr, nullptr, connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   NULL, 0);
-#else
-            result = OCDoResource(&handle, OC_REST_GET,
-                                  deviceURI.c_str(),
-                                  nullptr, nullptr,
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata,
-                                  NULL, 0);
-#endif
         }
         else
         {
@@ -367,17 +334,10 @@ namespace OC
         return OC_STACK_DELETE_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::GetResourceRepresentation(const std::string& host,
         const std::string& uri, OCConnectivityType connectivityType,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         GetCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::GetResourceRepresentation(const std::string& host,
-        const std::string& uri, const QueryParamsMap& queryParams,
-        const HeaderOptions& headerOptions, GetCallback& callback,
-        QualityOfService QoS)
-#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -400,19 +360,12 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
-#ifdef CA_INT
+
             result = OCDoResource(&handle, OC_REST_GET, os.str().c_str(),
                                   nullptr, nullptr, connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
-#else
-            result = OCDoResource(&handle, OC_REST_GET, os.str().c_str(),
-                                  nullptr, nullptr,
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata,
-                                  options, headerOptions.size());
-#endif
         }
         else
         {
@@ -488,17 +441,10 @@ namespace OC
         return ocInfo.getJSONRepresentation(OCInfoFormat::IncludeOC);
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::PostResourceRepresentation(const std::string& host,
         const std::string& uri, OCConnectivityType connectivityType, const OCRepresentation& rep,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         PostCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::PostResourceRepresentation(const std::string& host,
-        const std::string& uri, const OCRepresentation& rep,
-        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-        PostCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -523,19 +469,11 @@ namespace OC
             OCDoHandle handle;
 
             assembleHeaderOptions(options, headerOptions);
-#ifdef CA_INT
             result = OCDoResource(&handle, OC_REST_POST,
                                   os.str().c_str(), nullptr,
                                   assembleSetResourcePayload(rep).c_str(), connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata, options, headerOptions.size());
-#else
-            result = OCDoResource(&handle, OC_REST_POST,
-                                  os.str().c_str(), nullptr,
-                                  assembleSetResourcePayload(rep).c_str(),
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata, options, headerOptions.size());
-#endif
         }
         else
         {
@@ -546,17 +484,10 @@ namespace OC
         return result;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::PutResourceRepresentation(const std::string& host,
         const std::string& uri, OCConnectivityType connectivityType, const OCRepresentation& rep,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         PutCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::PutResourceRepresentation(const std::string& host,
-        const std::string& uri, const OCRepresentation& rep,
-        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
-        PutCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -581,21 +512,12 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
-#ifdef CA_INT
             result = OCDoResource(&handle, OC_REST_PUT,
                                   os.str().c_str(), nullptr,
                                   assembleSetResourcePayload(rep).c_str(), connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
-#else
-            result = OCDoResource(&handle, OC_REST_PUT,
-                                  os.str().c_str(), nullptr,
-                                  assembleSetResourcePayload(rep).c_str(),
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata,
-                                  options, headerOptions.size());
-#endif
         }
         else
         {
@@ -622,15 +544,9 @@ namespace OC
         return OC_STACK_DELETE_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::DeleteResource(const std::string& host,
         const std::string& uri, OCConnectivityType connectivityType,
         const HeaderOptions& headerOptions, DeleteCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::DeleteResource(const std::string& host,
-        const std::string& uri, const HeaderOptions& headerOptions,
-         DeleteCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -654,18 +570,12 @@ namespace OC
             assembleHeaderOptions(options, headerOptions);
 
             std::lock_guard<std::recursive_mutex> lock(*cLock);
-#ifdef CA_INT
+
             result = OCDoResource(&handle, OC_REST_DELETE,
                                   os.str().c_str(), nullptr,
                                   nullptr, connectivityType,
                                   static_cast<OCQualityOfService>(m_cfg.QoS),
                                   &cbdata, options, headerOptions.size());
-#else
-            result = OCDoResource(&handle, OC_REST_DELETE,
-                                  os.str().c_str(), nullptr,
-                                  nullptr, static_cast<OCQualityOfService>(m_cfg.QoS),
-                                  &cbdata, options, headerOptions.size());
-#endif
         }
         else
         {
@@ -707,16 +617,10 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::ObserveResource(ObserveType observeType, OCDoHandle* handle,
         const std::string& host, const std::string& uri, OCConnectivityType connectivityType,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         ObserveCallback& callback, QualityOfService QoS)
-#else
-    OCStackResult InProcClientWrapper::ObserveResource(ObserveType observeType, OCDoHandle* handle,
-        const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
-        const HeaderOptions& headerOptions, ObserveCallback& callback, QualityOfService QoS)
-#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -752,21 +656,12 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
-#ifdef CA_INT
             result = OCDoResource(handle, method,
                                   os.str().c_str(), nullptr,
                                   nullptr, connectivityType,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
-#else
-            result = OCDoResource(handle, method,
-                                  os.str().c_str(), nullptr,
-                                  nullptr,
-                                  static_cast<OCQualityOfService>(QoS),
-                                  &cbdata,
-                                  options, headerOptions.size());
-#endif
         }
         else
         {
@@ -829,15 +724,9 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
-#ifdef CA_INT
     OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle,
         const std::string& host, const std::string& resourceType,
         OCConnectivityType connectivityType, SubscribeCallback& presenceHandler)
-#else
-    OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle,
-        const std::string& host, const std::string& resourceType,
-        SubscribeCallback& presenceHandler)
-#endif
     {
         OCCallbackData cbdata = {0};
 
@@ -864,13 +753,8 @@ namespace OC
             return OC_STACK_ERROR;
         }
 
-#ifdef CA_INT
         return OCDoResource(handle, OC_REST_PRESENCE, os.str().c_str(), nullptr, nullptr,
                             connectivityType, OC_LOW_QOS, &cbdata, NULL, 0);
-#else
-        return OCDoResource(handle, OC_REST_PRESENCE, os.str().c_str(), nullptr, nullptr,
-                            OC_LOW_QOS, &cbdata, NULL, 0);
-#endif
     }
 
     OCStackResult InProcClientWrapper::UnsubscribePresence(OCDoHandle handle)
index 6eca568..84ca4d8 100644 (file)
@@ -70,7 +70,6 @@ namespace OC
                                                     observationIds, pResponse, QoS);
         }
 
-#ifdef CA_INT
         OCResource::Ptr constructResourceObject(const std::string& host,
                                                 const std::string& uri,
                                                 OCConnectivityType connectivityType,
@@ -119,48 +118,6 @@ namespace OC
             return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, connectivityType,
                     deviceInfoHandler, QoS);
         }
-#else
-
-        OCStackResult findResource(const std::string& host,
-                                                const std::string& resourceName,
-                                                FindCallback resourceHandler)
-        {
-            return OCPlatform_impl::Instance().findResource(host, resourceName, resourceHandler);
-        }
-
-        OCStackResult findResource(const std::string& host,
-                                                const std::string& resourceName,
-                                                FindCallback resourceHandler, QualityOfService QoS)
-        {
-            return OCPlatform_impl::Instance().findResource(host, resourceName,
-                                                resourceHandler, QoS);
-        }
-
-        OCResource::Ptr constructResourceObject(const std::string& host,
-                                                const std::string& uri,
-                                                bool isObservable,
-                                                const std::vector<std::string>& resourceTypes,
-                                                const std::vector<std::string>& interfaces)
-        {
-            return OCPlatform_impl::Instance().constructResourceObject(host, uri, isObservable,
-                                                resourceTypes, interfaces);
-        }
-
-        OCStackResult getDeviceInfo(const std::string& host,
-                                                const std::string& deviceURI,
-                                                FindDeviceCallback deviceInfoHandler)
-        {
-            return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, deviceInfoHandler);
-        }
-
-        OCStackResult getDeviceInfo(const std::string& host,
-                                                const std::string& deviceURI,
-                                                FindDeviceCallback deviceInfoHandler,
-                                                QualityOfService QoS)
-        {
-            return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, deviceInfoHandler, QoS);
-        }
-#endif
 
         OCStackResult registerResource(OCResourceHandle& resourceHandle,
                                                 std::string& resourceURI,
@@ -239,7 +196,6 @@ namespace OC
             return OCPlatform_impl::Instance().stopPresence();
         }
 
-#ifdef CA_INT
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
                                                 const std::string& host,
                                                 OCConnectivityType connectivityType,
@@ -258,24 +214,6 @@ namespace OC
             return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
                                                 resourceType, connectivityType, presenceHandler);
         }
-#else
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
-                                                const std::string& host,
-                                                SubscribeCallback presenceHandler)
-        {
-            return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
-                                                presenceHandler);
-        }
-
-        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
-                                                const std::string& host,
-                                                const std::string& resourceType,
-                                                SubscribeCallback presenceHandler)
-        {
-            return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
-                                                resourceType, presenceHandler);
-        }
-#endif
 
         OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle)
         {
index 3039fe5..1df71a4 100644 (file)
@@ -138,7 +138,6 @@ namespace OC
                             static_cast<OCQualityOfService>(QoS)));
     }
 
-#ifdef CA_INT
     OCResource::Ptr OCPlatform_impl::constructResourceObject(const std::string& host,
                                                 const std::string& uri,
                                                 OCConnectivityType connectivityType,
@@ -196,62 +195,6 @@ namespace OC
                              host, deviceURI, connectivityType, deviceInfoHandler, QoS);
     }
 
-#else
-    OCResource::Ptr OCPlatform_impl::constructResourceObject(const std::string& host,
-                                                const std::string& uri,
-                                                bool isObservable,
-                                                const std::vector<std::string>& resourceTypes,
-                                                const std::vector<std::string>& interfaces)
-    {
-        if(!m_client)
-        {
-            return std::shared_ptr<OCResource>();
-        }
-
-        return std::shared_ptr<OCResource>(new OCResource(m_client,
-                                            host,
-                                            uri,
-                                            "", // 'created' Resources have no way of knowing their
-                                                // server ID, so this has to be blank initially.
-                                            isObservable,
-                                            resourceTypes,
-                                            interfaces));
-    }
-
-    OCStackResult OCPlatform_impl::findResource(const std::string& host,
-                                            const std::string& resourceName,
-                                            FindCallback resourceHandler)
-    {
-        return findResource(host, resourceName, resourceHandler, m_cfg.QoS);
-    }
-
-    OCStackResult OCPlatform_impl::findResource(const std::string& host,
-                                            const std::string& resourceName,
-                                            FindCallback resourceHandler, QualityOfService QoS)
-    {
-
-        return checked_guard(m_client, &IClientWrapper::ListenForResource,
-                             host, resourceName, resourceHandler, QoS);
-    }
-
-    OCStackResult OCPlatform_impl::getDeviceInfo(const std::string& host,
-                                            const std::string& deviceURI,
-                                            FindDeviceCallback deviceInfoHandler)
-    {
-        return result_guard(getDeviceInfo(host, deviceURI, deviceInfoHandler, m_cfg.QoS));
-    }
-
-    OCStackResult OCPlatform_impl::getDeviceInfo(const std::string& host,
-                                            const std::string& deviceURI,
-                                            FindDeviceCallback deviceInfoHandler,
-                                            QualityOfService QoS)
-    {
-        return checked_guard(m_client, &IClientWrapper::ListenForDevice,
-                             host, deviceURI, deviceInfoHandler, QoS);
-    }
-
-#endif
-
     OCStackResult OCPlatform_impl::registerResource(OCResourceHandle& resourceHandle,
                                             std::string& resourceURI,
                                             const std::string& resourceTypeName,
@@ -355,7 +298,6 @@ namespace OC
         return checked_guard(m_server, &IServerWrapper::stopPresence);
     }
 
-#ifdef CA_INT
     OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
                                             const std::string& host,
                                             OCConnectivityType connectivityType,
@@ -375,24 +317,6 @@ namespace OC
                              &presenceHandle, host, resourceType, connectivityType,
                              presenceHandler);
     }
-#else
-    OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
-                                            const std::string& host,
-                                            SubscribeCallback presenceHandler)
-    {
-        return subscribePresence(presenceHandle, host, "", presenceHandler);
-    }
-
-    OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
-                                            const std::string& host,
-                                            const std::string& resourceType,
-                                            SubscribeCallback presenceHandler)
-    {
-        return checked_guard(m_client, &IClientWrapper::SubscribePresence,
-                             &presenceHandle, host, resourceType,
-                             presenceHandler);
-    }
-#endif
 
     OCStackResult OCPlatform_impl::unsubscribePresence(OCPresenceHandle presenceHandle)
     {
index faed78e..ff96714 100644 (file)
@@ -29,7 +29,6 @@ using OC::nil_guard;
 using OC::result_guard;
 using OC::checked_guard;
 
-#ifdef CA_INT
 OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
                        const std::string& uri, const std::string& serverId,
                        OCConnectivityType connectivityType, bool observable,
@@ -54,28 +53,6 @@ OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::s
                 interfaces.empty(), m_clientWrapper.expired(), false, false);
     }
 }
-#else
-OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
-                       const std::string& uri, const std::string& serverId, bool observable,
-                       const std::vector<std::string>& resourceTypes,
-                       const std::vector<std::string>& interfaces)
- :  m_clientWrapper(clientWrapper), m_uri(uri), m_resourceId(serverId, m_uri), m_host(host),
-    m_isObservable(observable), m_isCollection(false), m_resourceTypes(resourceTypes),
-    m_interfaces(interfaces), m_observeHandle(nullptr)
-{
-    m_isCollection = std::find(m_interfaces.begin(), m_interfaces.end(), LINK_INTERFACE)
-                        != m_interfaces.end();
-
-    if (m_uri.empty() ||
-        resourceTypes.empty() ||
-        interfaces.empty()||
-        m_clientWrapper.expired())
-    {
-        throw ResourceInitException(m_uri.empty(), resourceTypes.empty(),
-                interfaces.empty(), m_clientWrapper.expired(), false, false);
-    }
-}
-#endif
 
 OCResource::~OCResource()
 {
@@ -84,14 +61,9 @@ OCResource::~OCResource()
 OCStackResult OCResource::get(const QueryParamsMap& queryParametersMap,
                               GetCallback attributeHandler, QualityOfService QoS)
 {
-#ifdef CA_INT
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
                          m_host, m_uri, m_connectivityType, queryParametersMap, m_headerOptions,
                          attributeHandler, QoS);
-#else
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
-                         m_host, m_uri, queryParametersMap, m_headerOptions, attributeHandler, QoS);
-#endif
 }
 
 OCStackResult OCResource::get(const QueryParamsMap& queryParametersMap,
@@ -134,14 +106,9 @@ OCStackResult OCResource::put(const OCRepresentation& rep,
                               const QueryParamsMap& queryParametersMap, PutCallback attributeHandler,
                               QualityOfService QoS)
 {
-#ifdef CA_INT
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PutResourceRepresentation,
                          m_host, m_uri, m_connectivityType, rep, queryParametersMap,
                          m_headerOptions, attributeHandler, QoS);
-#else
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PutResourceRepresentation,
-                         m_host, m_uri, rep, queryParametersMap, m_headerOptions, attributeHandler, QoS);
-#endif
 }
 
 OCStackResult OCResource::put(const OCRepresentation& rep,
@@ -189,14 +156,9 @@ OCStackResult OCResource::post(const OCRepresentation& rep,
                                const QueryParamsMap& queryParametersMap, PostCallback attributeHandler,
                                QualityOfService QoS)
 {
-#ifdef CA_INT
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          m_host, m_uri, m_connectivityType, rep, queryParametersMap,
                          m_headerOptions, attributeHandler, QoS);
-#else
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
-                         m_host, m_uri, rep, queryParametersMap, m_headerOptions, attributeHandler, QoS);
-#endif
 }
 
 OCStackResult OCResource::post(const OCRepresentation& rep,
@@ -242,13 +204,8 @@ OCStackResult OCResource::post(const std::string& resourceType,
 
 OCStackResult OCResource::deleteResource(DeleteCallback deleteHandler, QualityOfService QoS)
 {
-#ifdef CA_INT
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
                          m_host, m_uri, m_connectivityType, m_headerOptions, deleteHandler, QoS);
-#else
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
-                         m_host, m_uri, m_headerOptions, deleteHandler, QoS);
-#endif
 }
 
 OCStackResult OCResource::deleteResource(DeleteCallback deleteHandler)
@@ -268,16 +225,10 @@ OCStackResult OCResource::observe(ObserveType observeType,
         return result_guard(OC_STACK_INVALID_PARAM);
     }
 
-#ifdef CA_INT
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
                          observeType, &m_observeHandle, m_host,
                          m_uri, m_connectivityType, queryParametersMap, m_headerOptions,
                          observeHandler, QoS);
-#else
-    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
-                         observeType, &m_observeHandle, m_host,
-                         m_uri, queryParametersMap, m_headerOptions, observeHandler, QoS);
-#endif
 }
 
 OCStackResult OCResource::observe(ObserveType observeType,
@@ -325,12 +276,10 @@ std::string OCResource::uri() const
     return m_uri;
 }
 
-#ifdef CA_INT
 OCConnectivityType OCResource::connectivityType() const
 {
     return m_connectivityType;
 }
-#endif
 
 bool OCResource::isObservable() const
 {
index 49a3d8e..9077131 100644 (file)
@@ -34,8 +34,6 @@ if target_os in ['darwin', 'ios']:
        oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
        oclib_env.AppendUnique(LIBS = ['octbstack', 'coap', 'oc_logger'])
 
-oclib_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index 76e4b1b..3162be6 100644 (file)
@@ -55,11 +55,11 @@ CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a
 CXX_LIBS  += $(GTEST_LIBS) -L$(CONNECTIVITY_DIR)/build/out -lconnectivity_abstraction
 
 CC_FLAGS.debug      := -g -O0 -g3 -Wall -ffunction-sections -fdata-sections \
-                        -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG -DCA_INT
+                        -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG 
 CC_FLAGS.release    := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s \
-                        -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DCA_INT
+                        -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) 
 
-CPPFLAGS       += $(CC_FLAGS.$(BUILD)) $(CXX_LIBS) -lpthread -DCA_INT
+CPPFLAGS       += $(CC_FLAGS.$(BUILD)) $(CXX_LIBS) -lpthread
 
 
 
index eb4dd41..c9b92ca 100644 (file)
@@ -29,8 +29,6 @@ sample_env.AppendUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'coap', 'coap_cs
 if env.get('SECURED') == '1': 
     sample_env.AppendUnique(LIBS = ['tinydtls'])
 
-sample_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 sample_env.ParseConfig('pkg-config --libs glib-2.0')
 
 ######################################################################
index 0efe16c..d39f0ec 100644 (file)
@@ -460,12 +460,8 @@ void client1()
 
     std::cout << "starting findResource = core.fan" << std::endl;
     // Find all resources
-#ifdef CA_INT
     OCPlatform::findResource("", requestURI, OC_WIFI,
             &foundResourceFan);
-#else
-    OCPlatform::findResource("", requestURI, &foundResourceFan);
-#endif
     // Get time of day
     timer = time(NULL);
     // Converts date/time to a structure
@@ -491,12 +487,8 @@ void client2()
 
     std::cout << "starting findResource = core.light" << std::endl;
     // Find all resources
-#ifdef CA_INT
     OCPlatform::findResource("", requestURI, OC_WIFI,
             &foundResourceLight);
-#else
-    OCPlatform::findResource("", requestURI, &foundResourceLight);
-#endif
     // Get time of day
     timer = time(NULL);
     // Converts date/time to a structure
index d2ad812..777a79a 100644 (file)
@@ -16,8 +16,6 @@ if target_os == 'arduino':
        soft_sensor_manager_env.Replace(CC = env.get('CXX'))
        soft_sensor_manager_env.Replace(CFLAGS = env.get('CXXFLAGS'))
 
-soft_sensor_manager_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Build flags
 ######################################################################
index c687b06..cb6c434 100644 (file)
@@ -75,15 +75,9 @@ void CResourceFinder::presenceHandler(OCStackResult result, const unsigned int n
     switch (result)
     {
         case OC_STACK_OK:
-#ifdef CA_INT
             ret = OC::OCPlatform::findResource("",
                                                "coap://" + hostAddress + ":5298" + "/oc/core?rt=SoftSensorManager.Sensor", OC_ALL,
                                                std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-#else
-            ret = OC::OCPlatform::findResource("",
-                                               "coap://" + hostAddress + "/oc/core?rt=SoftSensorManager.Sensor",
-                                               std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-#endif
 
             if (ret != OC_STACK_OK)
                 SSM_CLEANUP_ASSERT(SSM_E_FAIL);
@@ -123,29 +117,17 @@ SSMRESULT CResourceFinder::startResourceFinder()
     SSMRESULT res = SSM_E_FAIL;
     OCStackResult ret = OC_STACK_ERROR;
 
-#ifdef CA_INT
     ret = OC::OCPlatform::findResource("",
                                        "coap://224.0.1.187:5298/oc/core?rt=SoftSensorManager.Sensor", OC_ALL,
                                        std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-#else
-    ret = OC::OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=SoftSensorManager.Sensor",
-                                       std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-#endif
 
     if (ret != OC_STACK_OK)
         SSM_CLEANUP_ASSERT(SSM_E_FAIL);
 
-#ifdef CA_INT
     ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, "coap://224.0.1.187",
                                             "SoftSensorManager.Sensor", OC_ALL,
                                             std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1,
                                                     std::placeholders::_2, std::placeholders::_3));
-#else
-    ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, "coap://224.0.1.187",
-                                            "SoftSensorManager.Sensor",
-                                            std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1,
-                                                    std::placeholders::_2, std::placeholders::_3));
-#endif
 
     if (ret != OC_STACK_OK)
         SSM_CLEANUP_ASSERT(SSM_E_FAIL);
@@ -226,17 +208,10 @@ void CResourceFinder::onExecute(IN void *pArg)
             if (m_mapResourcePresenceHandles.find(((ISSMResource *)pMessage[1])->ip) ==
                 m_mapResourcePresenceHandles.end())
             {
-#ifdef CA_INT
                 ret = OC::OCPlatform::subscribePresence(presenceHandle, ((ISSMResource *)pMessage[1])->ip,
                                                         "SoftSensorManager.Sensor", OC_ALL,
                                                         std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1,
                                                                 std::placeholders::_2, std::placeholders::_3));
-#else
-                ret = OC::OCPlatform::subscribePresence(presenceHandle, ((ISSMResource *)pMessage[1])->ip,
-                                                        "SoftSensorManager.Sensor",
-                                                        std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1,
-                                                                std::placeholders::_2, std::placeholders::_3));
-#endif
 
                 if (ret != OC_STACK_OK)
                     SSM_CLEANUP_ASSERT(SSM_E_FAIL);
index db44465..412907c 100644 (file)
@@ -23,8 +23,6 @@ if target_os not in ['windows', 'winrt']:
 if target_os == 'android':
        things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
 
-things_manager_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 ######################################################################
 # Source files and Targets
 ######################################################################
index 0b766e9..3cd9c43 100644 (file)
@@ -25,8 +25,6 @@ linux_sample_env.AppendUnique(LIBS = ['libTGMSDKLibrary', 'oc', 'octbstack',
 if env.get('SECURED') == '1': 
     linux_sample_env.AppendUnique(LIBS = ['tinydtls'])
 
-linux_sample_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 linux_sample_env.ParseConfig('pkg-config --libs glib-2.0')
 
 ######################################################################
index f616030..26a716f 100644 (file)
@@ -360,22 +360,14 @@ int main()
                     std::string requestURI = OC_WELL_KNOWN_QUERY;
                     requestURI += "?rt=a.collection";
 
-                    #ifdef CA_INT
                     OCPlatform::findResource("", requestURI, OC_WIFI, &foundResource);
-                    #else
-                    OCPlatform::findResource("", requestURI, &foundResource);
-                    #endif
                 }
                 else if (n == 0)
                 {
                     std::string requestURI = OC_WELL_KNOWN_QUERY;
                     requestURI += "?rt=core.bookmark";
 
-                    #ifdef CA_INT
                     OCPlatform::findResource("", requestURI, OC_WIFI, &foundResource);
-                    #else
-                    OCPlatform::findResource("", requestURI, &foundResource);
-                    #endif
                 }
                 else if (n == 1)
                 {
index 5caa966..b64c70b 100644 (file)
@@ -25,8 +25,6 @@ linux_sample_env.AppendUnique(LIBS = ['libTGMSDKLibrary', 'oc', 'octbstack',
 if env.get('SECURED') == '1': 
     linux_sample_env.AppendUnique(LIBS = ['tinydtls'])
 
-linux_sample_env.AppendUnique(CPPDEFINES = ['CA_INT'])
-
 linux_sample_env.ParseConfig('pkg-config --libs glib-2.0')
 
 ######################################################################
index 5fd382b..6407d3a 100644 (file)
@@ -116,11 +116,7 @@ int main(int argc, char* argv[])
                 std::string requestURI = OC_WELL_KNOWN_QUERY;
                 requestURI += "?rt=core.musicplayer";
 
-                #ifdef CA_INT
                 result = OCPlatform::findResource("", requestURI, OC_WIFI, onFindResource);
-                #else
-                result = OCPlatform::findResource("", requestURI, onFindResource);
-                #endif
                 if (OC_STACK_OK == result)
                 {
                     cout << "Finding music player was successful\n";
@@ -135,11 +131,7 @@ int main(int argc, char* argv[])
                 std::string requestURI = OC_WELL_KNOWN_QUERY;
                 requestURI += "?rt=core.speaker";
 
-                #ifdef CA_INT
                 result = OCPlatform::findResource("", requestURI, OC_WIFI, onFindResource);
-                #else
-                result = OCPlatform::findResource("", requestURI, onFindResource);
-                #endif
                 if (OC_STACK_OK == result)
                 {
                     cout << "Finding speaker was successful\n";
index dacfe8a..da2763c 100644 (file)
@@ -222,17 +222,10 @@ OCStackResult GroupManager::findCandidateResources(std::vector< std::string > re
         query += "?rt=";
         query += resourceTypes.at(i);
 
-        #ifdef CA_INT
         OCPlatform::findResource("", query, OC_WIFI,
                 std::function < void(std::shared_ptr < OCResource > resource)
                 > (std::bind(&GroupManager::onFoundResource, this,
                         std::placeholders::_1, waitsec)));
-        #else
-        OCPlatform::findResource("", query,
-                std::function < void(std::shared_ptr < OCResource > resource)
-                        > (std::bind(&GroupManager::onFoundResource, this,
-                                std::placeholders::_1, waitsec)));
-        #endif
     }
 
     if (waitsec >= 0)
@@ -355,7 +348,6 @@ void GroupManager::checkCollectionRepresentation(const OCRepresentation& rep,
         std::cout << "\t\thost : " << hostAddress << std::endl;
         OCPlatform::OCPresenceHandle presenceHandle;
 
-        #ifdef CA_INT
         OCStackResult result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
                 resourceType, OC_WIFI,
                 std::function<
@@ -364,16 +356,6 @@ void GroupManager::checkCollectionRepresentation(const OCRepresentation& rep,
                         std::bind(&GroupManager::collectionPresenceHandler, this,
                                 std::placeholders::_1, std::placeholders::_2,
                                 std::placeholders::_3, hostAddress, oit->getUri())));
-        #else
-        OCStackResult result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
-                resourceType,
-                std::function<
-                        void(OCStackResult result, const unsigned int nonce,
-                                const std::string& hostAddress) >(
-                        std::bind(&GroupManager::collectionPresenceHandler, this,
-                                std::placeholders::_1, std::placeholders::_2,
-                                std::placeholders::_3, hostAddress, oit->getUri())));
-        #endif
 
         if (result == OC_STACK_OK)
         {
index 7166f47..d99fc36 100644 (file)
@@ -69,13 +69,8 @@ namespace OIC
             query += collectionResourceTypes.at(i);
             cout << "GroupSynchronization::findGroup - " << query << endl;
 
-#ifdef CA_INT
             OCPlatform::findResource("", query, OC_WIFI,
                     std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
-#else
-            OCPlatform::findResource("", query,
-                    std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
-#endif
         }
 
 
@@ -269,14 +264,8 @@ namespace OIC
         std::vector< std::string > resourceInterface;
         resourceInterface.push_back(DEFAULT_INTERFACE);
 
-#ifdef CA_INT
         OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri, OC_WIFI,
                 1, resourceTypes, resourceInterface);
-#else
-        OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri, 1,
-                resourceTypes, resourceInterface);
-
-#endif
         groupSyncResourceList[type[0]] = groupSyncResource;
 
         cout << "GroupSynchronization::joinGroup : creating groupSyncResource." << endl;
@@ -662,15 +651,9 @@ namespace OIC
 
                         resourceRequest = request;
 
-                        #ifdef CA_INT
                         OCPlatform::findResource("", resourceName, OC_WIFI,
                                 std::bind(&GroupSynchronization::onFindResource, this,
                                         std::placeholders::_1));
-                        #else
-                        OCPlatform::findResource("", resourceName,
-                                std::bind(&GroupSynchronization::onFindResource, this,
-                                        std::placeholders::_1));
-                        #endif
                     }
                     else if (methodType == "leaveGroup")
                     {
index 3dac052..5a38313 100644 (file)
@@ -276,13 +276,8 @@ namespace OIC
                 // For this reason, we create the resource objects.
 
                 std::string host = getHostFromURI(oit->getUri());
-                #ifdef CA_INT
                 tempResource = OCPlatform::constructResourceObject(host, uri, OC_WIFI, true,
                         oit->getResourceTypes(), m_if);
-                #else
-                tempResource = OCPlatform::constructResourceObject(host, uri, true,
-                        oit->getResourceTypes(), m_if);
-                #endif
 
                 p_resources.push_back(tempResource);
             }