Removed ocsocket
authorSachin Agrawal <sachin.agrawal@intel.com>
Thu, 19 Feb 2015 18:01:30 +0000 (10:01 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Thu, 19 Feb 2015 23:19:34 +0000 (23:19 +0000)
Removed obsolete ocsocket layer.
Moved OCDevAddr and helper functions to ocstack.
Note: OCDevAddr should be replaced in future (after CA merge).

Change-Id: I289232e12178fdc0c6ab1c5eeddc98c2f5e37531
Signed-off-by: Yuliya Kamatkova <yuliya.kamatkova@intel.com>
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/334
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-by: Habteab Yemane <habteab.l.yemane@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
70 files changed:
examples/OICMiddle/SConscript
examples/OICMiddle/makefile
examples/OICSensorBoard/SConstruct
resource/csdk/SConscript
resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak
resource/csdk/makefile
resource/csdk/ocmalloc/test/linux/makefile
resource/csdk/ocsocket/README.txt [deleted file]
resource/csdk/ocsocket/include/ocsocket.h [deleted file]
resource/csdk/ocsocket/src/ocsocket.c [deleted file]
resource/csdk/ocsocket/src/ocsocket_arduino.c [deleted file]
resource/csdk/ocsocket/src/ocsocket_arduino_wifi.c [deleted file]
resource/csdk/ocsocket/test/android/makefile [deleted file]
resource/csdk/ocsocket/test/android/ocsocket_gtest.cpp [deleted file]
resource/csdk/ocsocket/test/arduino/makefile [deleted file]
resource/csdk/ocsocket/test/arduino/ocsocket_test.cpp [deleted file]
resource/csdk/ocsocket/test/arduino/ocsocket_wifi_test.cpp [deleted file]
resource/csdk/ocsocket/test/linux/makefile [deleted file]
resource/csdk/ocsocket/test/linux/ocsocket_gtest.cpp [deleted file]
resource/csdk/ocsocket/test/makefile [deleted file]
resource/csdk/ocsocket/test/sendrecv.cpp [deleted file]
resource/csdk/ocsocket/test/sendrecv_README.txt [deleted file]
resource/csdk/stack/include/internal/ocobserve.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/arduino/SimpleClientServer/ocserver/SConscript
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile
resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
resource/csdk/stack/samples/linux/SimpleClientServer/makefile
resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
resource/csdk/stack/samples/linux/secure/SConscript
resource/csdk/stack/samples/linux/secure/makefile
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/test/arduino/makefile
resource/csdk/stack/test/linux/makefile
resource/csdk/stack/test/makefile
resource/examples/SConscript
resource/examples/makefile
resource/include/OCSerialization.h
resource/makefile
resource/oc_logger/samples/linux/makefile
resource/src/InProcClientWrapper.cpp
resource/src/SConscript
resource/unittests/makefile
service/notification-manager/NotificationManager/build/linux/Makefile
service/notification-manager/build/tizen/CMakeLists.txt
service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile
service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile
service/protocol-plugin/sample-app/linux/mqtt/Makefile
service/soft-sensor-manager/SSMCore/build/linux/Makefile
service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile
service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile
service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile
service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile
service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile
service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile
service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt
service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org
service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt
service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt
service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt
service/things-manager/sampleapp/linux/configuration/makefile
service/things-manager/sampleapp/linux/groupaction/makefile
service/things-manager/sampleapp/linux/groupsyncaction/makefile
service/things-manager/sdk/build/linux/Makefile
service/third_party_libs.scons

index 9feaaf0..db55684 100644 (file)
@@ -14,7 +14,6 @@ examples_env = lib_env.Clone()
 examples_env.AppendUnique(CPPPATH = [
                '../../resource/include/',
                '../../resource/csdk/stack/include',
-               '../../resource/csdk/ocsocket/include',
                '../../resource/csdk/ocrandom/include',
                '../../resource/csdk/logger/include',
                '../../resource/oc_logger/include'
index 7b39605..1a034bb 100644 (file)
@@ -42,16 +42,16 @@ CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
 CXX_INC          := -I$(OIC_RES)/include/
 CXX_INC   += -I$(OIC_RES)/oc_logger/include
 CXX_INC          += -I$(OIC_RES)/csdk/stack/include
-CXX_INC          += -I$(OIC_RES)/csdk/ocsocket/include
 CXX_INC          += -I$(OIC_RES)/csdk/ocrandom/include
 CXX_INC          += -I$(OIC_RES)/csdk/logger/include
-CXX_INC          += -I$(OIC_RES)/csdk/libcoap
+CXX_INC   += -I$(OIC_RES)/csdk/connectivity/lib/libcoap-4.1.1
 
 CXX_LIBS  := -L${OIC_LIB}
 CXX_LIBS  += -loc
 CXX_LIBS  += -loctbstack
 CXX_LIBS  += -loc_logger
-CXX_LIBS  += -loc_logger_core
+#CXX_LIBS  += -loc_logger_core
+CXX_LIBS  += -lconnectivity_abstraction
 CXX_LIBS  += -lcoap
 
 all: prep_dirs OICMiddle
index e9acb2d..8a4ef04 100644 (file)
@@ -15,7 +15,6 @@ envClient = env.Clone()
 envClient.AppendUnique(CPPPATH = [
                 IOTIVITY_ROOT + '/resource/include', 
                 IOTIVITY_ROOT + '/resource/csdk/stack/include',
-                IOTIVITY_ROOT + '/resource/csdk/ocsocket/include',
                 IOTIVITY_ROOT + '/resource/oc_logger/include',
                 ])
 envClient.AppendUnique(LIBPATH = [IOTIVITY_LIBS_PATH])
@@ -58,7 +57,6 @@ try:
     envServer.AppendUnique(CPPPATH = [
                 sdk_root + '/usr/include/iotivity/',
                 sdk_root + '/usr/include/iotivity/stack/',
-                sdk_root + '/usr/include/iotivity/ocsocket/',
                 sdk_root + '/usr/include/iotivity/oc_logger/',
                 ])                     
 except:
index 6067d13..1466f72 100644 (file)
@@ -21,7 +21,6 @@ if target_os == 'arduino':
 ######################################################################
 liboctbstack_env.PrependUnique(CPPPATH = [
                '../../extlibs/cjson/',
-               'ocsocket/include',
                'logger/include',
                'ocrandom/include',
                'ocmalloc/include',
@@ -72,7 +71,6 @@ liboctbstack_src = [
        OCTBSTACK_SRC + 'occollection.c',
        OCTBSTACK_SRC + 'oicgroup.c',
        'security/src/ocsecurity.c',
-       'ocsocket/src/ocsocket.c',
        'logger/src/logger.c',
        'ocrandom/src/ocrandom.c',
        'ocmalloc/src/ocmalloc.c'
index 7e3a369..e12a01e 100644 (file)
@@ -38,8 +38,6 @@ ifeq (arduino, $(findstring arduino,$(PLATFORM)))
        SOURCESCPP:= Time.cpp
        OBJECTSCPP:= $(patsubst %.cpp, %.o, $(SOURCESCPP))
        VPATH += $(SDIR_ARD_TIME)
-else
-       #SOURCES += ocsocket.c
 endif
 
 OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
index 727be87..24363bb 100644 (file)
@@ -86,7 +86,6 @@ endif
 OCLOGGER_DIR           = logger
 OC_LOG_DIR             = ../oc_logger
 OCRANDOM_DIR           = ocrandom
-OCSOCKET_DIR           = ocsocket
 OCTBSTACK_DIR          = stack
 OCMALLOC_DIR           = ocmalloc
 OCSECURITY_DIR  = security
@@ -101,13 +100,10 @@ OCSECURITY_SRC    = $(OCSECURITY_DIR)/src
 CJSON_SRC              = $(CJSON_DIR)
 CONNECTIVITY_SRC       = $(CONNECTIVITY_DIR)
 OCLOGGER_SRC           = $(OCLOGGER_DIR)/src
-OCSOCKET_SRC           = $(OCSOCKET_DIR)/src
 OCRANDOM_SRC           = $(OCRANDOM_DIR)/src
-
 OCLOGGER_INC           = $(OCLOGGER_DIR)/include
 OC_LOG_INC             = $(OC_LOG_DIR)/include
 OCRANDOM_INC           = $(OCRANDOM_DIR)/include
-OCSOCKET_INC           = $(OCSOCKET_DIR)/include
 OCTBSTACK_INC          = $(OCTBSTACK_DIR)/include
 OCMALLOC_INC           = $(OCMALLOC_DIR)/include
 OCSECURITY_INC = $(OCSECURITY_DIR)/include
@@ -118,7 +114,6 @@ LIBCOAP_INC         = $(CONNECTIVITY_DIR)/lib/libcoap-4.1.1
 INC_DIRS       := -I$(OCLOGGER_INC)
 INC_DIRS       += -I$(OC_LOG_INC)
 INC_DIRS       += -I$(OCRANDOM_INC)
-INC_DIRS       += -I$(OCSOCKET_INC)
 INC_DIRS       += -I$(OCMALLOC_INC)
 INC_DIRS       += -I$(OCSECURITY_INC)
 INC_DIRS       += -I$(OCSECURITY_INC)/internal
@@ -150,16 +145,6 @@ OCTBSTACK_SOURCES  += $(OCMALLOC_SRC)/ocmalloc.c
 OCTBSTACK_SOURCES      += $(OCLOGGER_SRC)/logger.c
 OCTBSTACK_SOURCES      += $(OCRANDOM_SRC)/ocrandom.c
 
-ifeq ($(PLATFORM_TYPE),arduino)
-    ifeq ($(ARDUINOWIFI),1)
-        OCTBSTACK_SOURCES += $(OCSOCKET_SRC)/ocsocket_arduino_wifi.c
-    else
-        OCTBSTACK_SOURCES += $(OCSOCKET_SRC)/ocsocket_arduino.c
-    endif
-else
-    OCTBSTACK_SOURCES += $(OCSOCKET_SRC)/ocsocket.c
-endif
-
 SOURCES                        := $(CJSON_SOURCES)
 SOURCES                        += $(OCTBSTACK_SOURCES)
 
index 2529d12..fad0401 100644 (file)
@@ -47,19 +47,16 @@ OUT_DIR       := $(PWD)
 OCLOGGER_DIR   = $(ROOT_DIR)/logger
 OCMALLOC_DIR   = $(ROOT_DIR)/ocmalloc
 OCRANDOM_DIR   = $(ROOT_DIR)/ocrandom
-OCSOCKET_DIR   = $(ROOT_DIR)/ocsocket
 OCTBSTACK_DIR  = $(ROOT_DIR)/stack
 
 OCLOGGER_INC   = $(OCLOGGER_DIR)/include
 OCMALLOC_INC   = $(OCMALLOC_DIR)/include
 OCRANDOM_INC   = $(OCRANDOM_DIR)/include
-OCSOCKET_INC   = $(OCSOCKET_DIR)/include
 OCTBSTACK_INC  = $(OCTBSTACK_DIR)/include
 
 INC_DIRS       := -I$(OCLOGGER_INC)
 INC_DIRS       += -I$(OCMALLOC_INC)
 INC_DIRS       += -I$(OCRANDOM_INC)
-INC_DIRS       += -I$(OCSOCKET_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)/internal
 INC_DIRS  += -I$(GTEST_DIR)/include
diff --git a/resource/csdk/ocsocket/README.txt b/resource/csdk/ocsocket/README.txt
deleted file mode 100644 (file)
index 61dc001..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
--------------------------------------------------------------------------------
-  NOTICE - Transition to SCONS
--------------------------------------------------------------------------------
-
-The IoTivity build system is transitioning to SCONS. Although the 
-makefiles are still available (until v1.0) and some developers are 
-still using them, they are currently no longer supported. To learn more 
-about building using SCONS see Readme.scons.txt in the repository root 
-directory. The build steps used in continuous integration can be found
-in auto_build.sh which is also in the the repository root directory.
-
--------------------------------------------------------------------------------
-
-To compile for Linux or Android, include ocsocket.c and ocsocket.h in your project.
-Look at the Makefile in ocsocket/test/linux and ocsocket/test/android for compilation dependencies.
-
-To compile for Arduino, include ocsocket_arduino.cpp and ocsocket.h in your project.
-Look at the Makefile in ocsocket/test/arduino for compilation dependencies.
-Note: Patch your Arduino Ethernet Shield library for arduino/libraries/Ethernet/utility/socket.cpp
-to fix recvfrom issue.
-
-Place appropriate local.properties file under test directory to provide local path for \
-GTEST libraries/header files to compile tests.
-
-#Sample local.properties file
-GTEST_LINUX_DIR = /home/gtest-1.7.0
-GTEST_ANDROID_DIR = /home/gtest-1.7.0_android/gtest-1.7.0
-ARDUINO_DIR = /usr/share/arduino
diff --git a/resource/csdk/ocsocket/include/ocsocket.h b/resource/csdk/ocsocket/include/ocsocket.h
deleted file mode 100644 (file)
index af4ab31..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-//******************************************************************
-///
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef _OCSOCKET_H
-#define _OCSOCKET_H
-
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@mainpage
- *
- * This module is a part of Open Communication Thin-Block SDK.
- */
-
-
-/**@defgroup socket Socket Interface
- *
- * This Socket interface  needs to be implemented for every platform on
- * which CCF TB stack is expected to run. If some functionality is not
- * available on a platform, implement the method by returning error
- * ERR_NOT_IMPLEMENTED.
- */
-
-#define ERR_SUCCESS          (0)
-#define ERR_INVALID_INPUT    (-900)
-#define ERR_UNKNOWN          (-901)
-#define ERR_NOT_IMPLEMENTED  (-903)
-
-
-/** This would need to be modified for specific platforms and specific
- *  technologies
- */
-#define DEV_ADDR_SIZE_MAX (16)
-
-/**
- *IPv4 or IPv6 addresses
- */
-#ifndef AF_INET
-#define AF_INET (2)
-#endif //AF_INET
-
-#ifndef AF_INET6
-#define AF_INET6 (10)
-#endif //AF_INET6
-
-
-/**
- * Data structure to encapsulate IPv4/IPv6/Contiki/lwIP device addresses
- *
-*/
-#pragma pack(push, 1)
-typedef struct OCDevAddr {
-    uint32_t     size;                    /**< length of the address stored in addr field. */
-    uint8_t      addr[DEV_ADDR_SIZE_MAX]; /**< device address. */
-}OCDevAddr;
-#pragma pack(pop)
-
-//-- OCInitNetworkStack -----------------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to perform any platform specific network
- * initialization. Optional to implement.
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCInitNetworkStack();
-
-typedef enum
-{
-    OC_SOCKET_NOOPTION = 0,
-    OC_SOCKET_REUSEADDR
-} OC_SOCKET_OPTION;
-
-//-- OCInitUDP -----------------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to create a new platform specific UDP socket and binds
- * it to the address provided.
- *
- * @param[in] ipAddr
- *              device address with which the new socket will be bind.
- * @param[out] sockfd
- *              reference to the new socket.
- * @param[in] sockoption
- *              specifies which socket option to be used.
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCInitUDP(OCDevAddr* ipAddr, int32_t* sockfd, OC_SOCKET_OPTION sockoption);
-
-
-//-- OCSendTo -------------------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to transmit a UDP datagram to another endpoint.
- *
- * @param[in] sockfd
- *              socket to be used for sending the datagram.
- * @param[in] buf
- *              datagram buffer.
- * @param[in] bufLen
- *              length of above buffer.
- * @param[in] flags
- *              flags to be used for sending datagram.
- * @param[in] addr
- *              endpoint to which datagram needs to be send.
- *
- * @retval On Success, it returns the number of bytes send, otherwise
- *          some negative value.
- */
-//------------------------------------------------------------------------
-int32_t OCSendTo(int32_t sockfd, const uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * addr);
-
-
-//-- OCRecvFrom ------------------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to retrieve a UDP datagram from the socket.
- *
- * @param[in] sockfd
- *              socket to be used for retrieving the datagram.
- * @param[in] buf
- *              datagram buffer.
- * @param[in] bufLen
- *              length of above buffer.
- * @param[in] flags
- *              flags to be used for receiving datagram.
- * @param[out] addr
- *              endpoint from which datagram has been received.
- *
- * @retval On Success, it returns the number of bytes read from the socket,
- *          otherwise some negative value.
- */
-//------------------------------------------------------------------------
-int32_t OCRecvFrom(int32_t sockfd, uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * addr);
-
-//-- OCClose ---------------------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to close the platform specific socket and release any
- * system resources associated with it.
- *
- * @param[in] sockfd
- *              socket to be closed.
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCClose(int32_t sockfd);
-
-
-//Utility methods
-//-- OCBuildIPv4Address -------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to create the IPv4 dev_addr structure.
- *
- * @param[in]  a first byte of IPv4 address.
- * @param[in]  b second byte of IPv4 address.
- * @param[in]  c third byte of IPv4 address.
- * @param[in]  d fourth byte of IPv4 address.
- * @param[in]  port port number.
- * @param[out] ipAddr
- *              dev_addr to be filled with above data.
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCBuildIPv4Address(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
-            uint16_t port, OCDevAddr *ipAddr);
-
-
-//-- OCDevAddrToString ----------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to convert the OCDevAddr to string format
- *
- * @param[in]   addr
- *               OCDevAddr address.
- * @param[out]  stringAddress the target string where the address
- *               is to be stored. Memory for this parameter is
- *               allocated by the caller.
- *
- * Note: The length of stringAddress may not exceed DEV_ADDR_SIZE_MAX
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCDevAddrToString(OCDevAddr *addr, char *stringAddress);
-
-
-//-- OCDevAddrToIPv4Addr -------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to retrieved the IPv4 address from OCDev address
- * data structure.
- *
- * @param[in]  ipAddr
- *              OCDevAddr address.
- * @param[out]  a first byte of IPv4 address.
- * @param[out]  b second byte of IPv4 address.
- * @param[out]  c third byte of IPv4 address.
- * @param[out]  d fourth byte of IPv4 address.
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
-            uint8_t *c, uint8_t *d );
-
-
-//-- OCDevAddrToPort -------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to retrieve the port number from OCDev address
- * data structure.
- *
- * @param[in]  ipAddr
- *              OCDevAddr address.
- * @param[out] port
- *              port number
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port);
-
-
-//-- OCGetSocketInfo -----------------------------------------------------
-/** @ingroup ocsocket
- *
- * This method is used to retrieve the port number to which the @p sockfd
- * is bound.
- *
- * @param[in]  sockfd
- *              socket whose port needs to be retrieved
- * @param[out] port
- *              port number
- *
- * @retval 0 for Success, otherwise some error value
- */
-//------------------------------------------------------------------------
-int32_t OCGetSocketInfo(int32_t sockfd, uint16_t *port);
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif //_OCSOCKET_H
diff --git a/resource/csdk/ocsocket/src/ocsocket.c b/resource/csdk/ocsocket/src/ocsocket.c
deleted file mode 100644 (file)
index ecf61b8..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <net/if.h>
-#include <errno.h>
-
-#ifdef __ANDROID__
-#include <sys/ioctl.h>
-#else
-#include <ifaddrs.h>
-#endif
-
-#include <logger.h>
-#include <ocsocket.h>
-
-/// Module Name
-#define MOD_NAME ("ocsocket")
-
-/// Macro to verify the validity of input argument
-#define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG(FATAL, MOD_NAME, #arg " is NULL"); return ERR_INVALID_INPUT;} }
-
-/// Builds a socket interface address using IP address and port number
-int32_t OCBuildIPv4Address(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port, OCDevAddr *ipAddr)
-{
-    struct sockaddr_in *sa;
-    uint32_t ip = a;
-
-    VERIFY_NON_NULL(ipAddr);
-    memset(ipAddr, 0, sizeof(OCDevAddr));
-
-    ip <<= 8;
-    ip |= b;
-    ip <<= 8;
-    ip |= c;
-    ip <<= 8;
-    ip |= d;
-
-    ipAddr->size = sizeof(struct sockaddr_in);
-    sa = (struct sockaddr_in*)ipAddr->addr;
-    sa->sin_family = AF_INET;
-    sa->sin_addr.s_addr = htonl(ip);
-    sa->sin_port = htons(port);
-
-    return ERR_SUCCESS;
-}
-
-/// Creates a BSD socket and binds it specified port for UDP
-int32_t OCInitUDP(OCDevAddr* ipAddr, int32_t *sockfd, OC_SOCKET_OPTION sockoption)
-{
-    int32_t ret = ERR_UNKNOWN;
-    int32_t sfd = 0xFFFFFFFF;
-    int set_option_on = 1;
-
-    VERIFY_NON_NULL(ipAddr);
-    VERIFY_NON_NULL(sockfd);
-
-    OC_LOG_V(DEBUG, MOD_NAME, "%s Begin", __func__ );
-    //Create a datagram socket on which to recv/send.
-    sfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-    if (sfd < 0) {
-        OC_LOG_V(FATAL, MOD_NAME, "socket API ret val %d", sfd);
-        goto exit;
-    }
-
-    if(OC_SOCKET_REUSEADDR == sockoption)
-    {
-        if ((ret = setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char*) &set_option_on,
-                    sizeof(set_option_on))) < 0) {
-            OC_LOG_V(FATAL, MOD_NAME, "setsockopt API failed with errno %s",
-                    strerror(errno));
-            goto exit;
-        }
-    }
-
-    if ((ret = bind(sfd, (struct sockaddr*)ipAddr->addr, ipAddr->size)) < 0) {
-        OC_LOG_V(FATAL, MOD_NAME, "bind API failed with errno %s", strerror(errno));
-        goto exit;
-    }
-
-    *sockfd = sfd;
-    ret = ERR_SUCCESS;
-
-exit:
-    if ((ret != ERR_SUCCESS) && (sfd >= 0)) {
-        close(sfd);
-    }
-
-    OC_LOG_V(DEBUG, MOD_NAME, "%s End", __func__ );
-    return ret;
-}
-
-
-/// Send data to requested end-point using UDP socket
-int32_t OCSendTo(int32_t sockfd, const uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-    int32_t ret;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ipAddr);
-
-    OC_LOG_V(DEBUG, MOD_NAME, "%s Begin", __func__ );
-    ret = sendto(sockfd, buf, bufLen, flags,
-            (struct sockaddr*)ipAddr->addr, ipAddr->size);
-
-    OC_LOG_V(DEBUG, MOD_NAME, "%s End", __func__ );
-    return ret;
-}
-
-
-/// Retrieve any available data from UDP socket. This is a non-blocking call.
-int32_t OCRecvFrom(int32_t sockfd, uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-    int32_t ret = 0;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ipAddr);
-
-    struct timeval timeout;
-    timeout.tv_sec = 0;
-    timeout.tv_usec = 5000;
-    fd_set reads;
-
-    FD_ZERO(&reads);
-    FD_SET(sockfd, &reads);
-    ret = select(sockfd + 1, &reads, NULL, NULL, &timeout);
-    if( ret < 0) {
-        OC_LOG(FATAL, MOD_NAME, "select API failed");
-        return ret;
-    }
-    if (!FD_ISSET(sockfd, &reads)) {
-        return ERR_SUCCESS;
-    }
-
-    // Read available data.
-    ret = recvfrom(sockfd, buf, bufLen, flags,
-            (struct sockaddr*)ipAddr->addr, (socklen_t*)&(ipAddr->size));
-    if (ret < 1) {
-        OC_LOG(FATAL, MOD_NAME, "OCRecvFrom ERR");
-    }
-
-    return ret;
-}
-
-
-/// Close the socket and release all system resources.
-int32_t OCClose(int32_t sockfd)
-{
-    return (close(sockfd));
-}
-
-//convert OCDevAddr to String
-int32_t OCDevAddrToString(OCDevAddr* addr, char* stringAddress)
-{
-    uint8_t a;
-    uint8_t b;
-    uint8_t c;
-    uint8_t d;
-
-    if(OCDevAddrToIPv4Addr(addr, &a, &b, &c, &d) == 0)
-    {
-        if (!stringAddress)
-        {
-            return ERR_INVALID_INPUT;
-        }
-
-        snprintf(stringAddress, DEV_ADDR_SIZE_MAX, "%u.%u.%u.%u",
-                a, b, c, d);
-        return ERR_SUCCESS;
-    }
-    else
-    {
-        return ERR_INVALID_INPUT;
-    }
-}
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
-            uint8_t *c, uint8_t *d )
-{
-
-    if ( !ipAddr || !a || !b || !c || !d ) {
-        OC_LOG(FATAL, MOD_NAME, "Invalid argument");
-        return ERR_INVALID_INPUT;
-    }
-
-    *a = ipAddr->addr[0];
-    *b = ipAddr->addr[1];
-    *c = ipAddr->addr[2];
-    *d = ipAddr->addr[3];
-
-    return ERR_SUCCESS;
-}
-
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port)
-{
-    if ( !ipAddr || !port ) {
-        OC_LOG(FATAL, MOD_NAME, "Invalid argument");
-        return ERR_INVALID_INPUT;
-    }
-
-    *port = *((uint16_t*)&ipAddr->addr[4]);
-
-    return ERR_SUCCESS;
-}
-
-/// Retrieve the port to which socket is bound
-int32_t OCGetSocketInfo(int32_t sockfd, uint16_t *port)
-{
-    int32_t ret = ERR_SUCCESS;
-
-    struct sockaddr_in sa;
-    socklen_t salen = sizeof(sa);
-    if (getsockname(sockfd, (struct sockaddr*)&sa, &salen) == 0) {
-        *port = ntohs(sa.sin_port);
-    } else {
-        OC_LOG_V(FATAL, MOD_NAME, "getsockname API failed with errno \
-            %s", strerror(errno));
-        ret = ERR_UNKNOWN;
-    }
-    return ret;
-}
diff --git a/resource/csdk/ocsocket/src/ocsocket_arduino.c b/resource/csdk/ocsocket/src/ocsocket_arduino.c
deleted file mode 100644 (file)
index c85a828..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <Arduino.h>
-#include <Ethernet.h>
-#include <socket.h>
-#include <w5100.h>
-#include <ocsocket.h>
-#include <EthernetUdp.h>
-#include <IPAddress.h>
-#include <logger.h>
-
-/// Ensures the literal string to be stored in Flash memory
-#define PCF(str) ((PROGMEM const char *)(F(str)))
-
-/// Module Name
-#define MOD_NAME PCF("ocsocket")
-
-/// Macro to verify the validity of input argument
-#define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG_V(FATAL, MOD_NAME, "%s is NULL", #arg); \
-         return ERR_INVALID_INPUT;} }
-
-/// Length of the IP address decimal notation string
-#define IPNAMESIZE (16)
-
-/// IPv4 address representation for Arduino Ethernet Shield
-typedef struct {
-    uint32_t size;  /// size of IP address and port bytes
-    uint8_t a;
-    uint8_t b;
-    uint8_t c;
-    uint8_t d;
-    uint16_t port;
-} ArduinoAddr;
-
-
-/// Builds a socket interface address using IP address and port number
-int32_t OCBuildIPv4Address(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port, OCDevAddr *ipAddr)
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(ardAddr);
-
-    memset(ardAddr, 0, sizeof(ArduinoAddr));
-
-    ardAddr->size =  sizeof(ArduinoAddr) - sizeof(ardAddr->size);
-    ardAddr-> a = a;
-    ardAddr-> b = b;
-    ardAddr-> c = c;
-    ardAddr-> d = d;
-    ardAddr-> port = port;
-
-    return ERR_SUCCESS;
-}
-
-/// Retrieves a empty socket and bind it for UDP with the input port
-int32_t OCInitUDP(OCDevAddr* ipAddr, int32_t* sockfd, OC_SOCKET_OPTION sockoption)
-{
-    uint8_t state;
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(ardAddr);
-    VERIFY_NON_NULL(sockfd);
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCInitUDP Begin"));
-    //Is any socket available to work with ?
-    *sockfd = -1;
-    for (int i = 0; i < MAX_SOCK_NUM; i++) {
-        state = W5100.readSnSR(i);
-        if (state == SnSR::CLOSED || state == SnSR::FIN_WAIT) {
-            *sockfd = i;
-            break;
-        }
-    }
-
-    if ( *sockfd == -1) {
-        return ERR_UNKNOWN;
-    }
-
-    //Create a datagram socket on which to recv/send.
-    if (!socket(*sockfd, SnMR::UDP, ardAddr->port, 0)) {
-        return ERR_UNKNOWN;
-    }
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCInitUDP End"));
-    return ERR_SUCCESS;
-}
-
-/// Send data to requested end-point using UDP socket
-int32_t OCSendTo(int32_t sockfd, const uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-    int32_t ret;
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ardAddr);
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCSendTo Begin"));
-    ret = sendto( sockfd, buf, bufLen, (uint8_t*)&(ardAddr->a), ardAddr->port);
-    OC_LOG_V(DEBUG, MOD_NAME, "OCSendTo RetVal %d", ret);
-    return ret;
-}
-
-
-/// Retrieve any available data from UDP socket. This is a non-blocking call.
-int32_t OCRecvFrom(int32_t sockfd, uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-    /**Bug : When there are multiple UDP packets in Wiznet buffer, W5100.getRXReceivedSize
-     * will not return correct length of the first packet.
-     * Fix : Use the patch provided for arduino/libraries/Ethernet/utility/socket.cpp
-     */
-    int32_t ret = 0;
-    uint16_t recvLen;
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ardAddr);
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCRecvFrom Begin"));
-    recvLen = W5100.getRXReceivedSize(sockfd);
-    if (recvLen == 0) {
-        return recvLen;
-    }
-
-    // Read available data.
-    ret = recvfrom(sockfd, buf, bufLen, (uint8_t*)&(ardAddr->a), (uint16_t*)&(ardAddr->port));
-    ardAddr->size =  sizeof(ArduinoAddr) - sizeof(ardAddr->size);
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCRecvFrom End"));
-    return ret;
-}
-
-
-/// Close the socket and release all system resources.
-int32_t OCClose(int32_t sockfd)
-{
-    close(sockfd);
-    return ERR_SUCCESS;
-}
-
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
-            uint8_t *c, uint8_t *d )
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    if ( !ardAddr || !a || !b || !c || !d ) {
-        OC_LOG(FATAL, MOD_NAME, PCF("Invalid argument"));
-        return ERR_INVALID_INPUT;
-    }
-
-    *a = ardAddr->a;
-    *b = ardAddr->b;
-    *c = ardAddr->c;
-    *d = ardAddr->d;
-
-    return ERR_SUCCESS;
-}
-
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port)
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    if ( !ardAddr || !port ) {
-        OC_LOG(FATAL, MOD_NAME, PCF("Invalid argument"));
-        return ERR_INVALID_INPUT;
-    }
-
-    *port = ardAddr->port;
-
-    return ERR_SUCCESS;
-}
-
-/// Retrieve the port to which socket is bound
-int32_t OCGetSocketInfo(int32_t sockfd, uint16_t *port)
-{
-    return ERR_NOT_IMPLEMENTED;
-}
diff --git a/resource/csdk/ocsocket/src/ocsocket_arduino_wifi.c b/resource/csdk/ocsocket/src/ocsocket_arduino_wifi.c
deleted file mode 100644 (file)
index 497ef26..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <logger.h>
-#include <ocsocket.h>
-#include <Arduino.h>
-#include <IPAddress.h>
-#include <WiFi.h>
-#include <utility/server_drv.h>
-#include <utility/wifi_drv.h>
-
-/// Module Name
-#define MOD_NAME PCF("ocsocket")
-
-/// Macro to verify the validity of input argument
-#define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG_V(FATAL, MOD_NAME, "%s is NULL", #arg); \
-         return ERR_INVALID_INPUT;} }
-
-/// Length of the IP address decimal notation string
-#define IPNAMESIZE (16)
-
-/// This is the max buffer size between Arduino and WiFi Shield
-#define ARDUINO_WIFI_SPI_RECV_BUFFERSIZE (64)
-
-// Start offsets based on end of received data buffer
-#define WIFI_RECBUF_IPADDR_OFFSET  (6)
-#define WIFI_RECBUF_PORT_OFFSET    (2)
-
-#define WIFI_RECBUF_IPADDR_SIZE    (WIFI_RECBUF_IPADDR_OFFSET - WIFI_RECBUF_PORT_OFFSET)
-#define WIFI_RECBUF_PORT_SIZE      (WIFI_RECBUF_PORT_OFFSET - 0)
-#define WIFI_RECBUF_FOOTER_SIZE    (WIFI_RECBUF_IPADDR_SIZE + WIFI_RECBUF_PORT_SIZE)
-
-
-/// IPv4 address representation for Arduino Ethernet Shield
-typedef struct {
-    uint32_t size;  /// size of IP address and port bytes
-    uint8_t a;
-    uint8_t b;
-    uint8_t c;
-    uint8_t d;
-    uint16_t port;
-} ArduinoAddr;
-
-
-/// Builds a socket interface address using IP address and port number
-int32_t OCBuildIPv4Address(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint16_t port, OCDevAddr *ipAddr)
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(ardAddr);
-
-    memset(ardAddr, 0, sizeof(ArduinoAddr));
-
-    ardAddr->size =  sizeof(ArduinoAddr) - sizeof(ardAddr->size);
-    ardAddr-> a = a;
-    ardAddr-> b = b;
-    ardAddr-> c = c;
-    ardAddr-> d = d;
-    ardAddr-> port = port;
-
-    return ERR_SUCCESS;
-}
-
-/// Retrieves a empty socket and bind it for UDP with the input port
-int32_t OCInitUDP(OCDevAddr* ipAddr, int32_t* sockfd, OC_SOCKET_OPTION sockoption)
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-    uint8_t sock;
-
-    VERIFY_NON_NULL(ardAddr);
-    VERIFY_NON_NULL(sockfd);
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCInitUDP Begin"));
-    //Is any socket available to work with ?
-    *sockfd = -1;
-
-    sock = WiFiClass::getSocket();
-    if (sock != NO_SOCKET_AVAIL)
-    {
-        ServerDrv::startServer(ardAddr->port, sock, UDP_MODE);
-        WiFiClass::_server_port[sock] = ardAddr->port;
-        *sockfd = (int32_t)sock;
-    }
-
-    if (*sockfd == -1)
-    {
-        return ERR_UNKNOWN;
-    }
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCInitUDP End"));
-    return ERR_SUCCESS;
-}
-
-
-/// Send data to requested end-point using UDP socket
-int32_t OCSendTo(int32_t sockfd, const uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-    int32_t ret = 0;
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-    uint32_t ip;
-    uint16_t rem, send;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ardAddr);
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCSendTo Begin"));
-
-    if (sockfd >= MAX_SOCK_NUM)
-    {
-        OC_LOG(ERROR, MOD_NAME, PCF("Invalid sockfd"));
-        return -1;
-    }
-
-    memcpy((uint8_t*)&ip, (uint8_t*)&(ardAddr->a), sizeof(ip));
-    ServerDrv::startClient(ip, ardAddr->port, (uint8_t)sockfd, UDP_MODE);
-
-    rem = bufLen;
-    do
-    {
-        send = (rem > ARDUINO_WIFI_SPI_RECV_BUFFERSIZE ) ? ARDUINO_WIFI_SPI_RECV_BUFFERSIZE : rem;
-        if (!ServerDrv::insertDataBuf((uint8_t)sockfd, buf, (uint16_t)send))
-        {
-            OC_LOG(ERROR, MOD_NAME, PCF("insertDataBuf error"));
-            ret = -1;
-            break;
-        }
-        rem = rem - send;
-        buf = buf + send;
-    }while(rem > 0);
-
-    if (ret != -1)
-    {
-        if (!ServerDrv::sendUdpData((uint8_t)sockfd))
-        {
-            OC_LOG(ERROR, MOD_NAME, PCF("sendUdpData error"));
-            ret = -1;
-        }
-        else
-        {
-            ret = bufLen;
-        }
-    }
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCSendTo End"));
-    return ret;
-}
-
-
-/// Retrieve any available data from UDP socket. This is a non-blocking call.
-int32_t OCRecvFrom(int32_t sockfd, uint8_t* buf, uint32_t bufLen, uint32_t flags,
-            OCDevAddr * ipAddr)
-{
-
-    uint16_t recvLen;
-    uint16_t size = 0;
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    VERIFY_NON_NULL(buf);
-    VERIFY_NON_NULL(ardAddr);
-
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCRecvFrom Begin"));
-    if (sockfd >= MAX_SOCK_NUM)
-    {
-        OC_LOG(ERROR, MOD_NAME, PCF("Invalid sockfd"));
-        return -1;
-    }
-
-    recvLen = (int32_t)ServerDrv::availData((uint8_t)sockfd);
-    if (recvLen == 0)
-    {
-        return recvLen;
-    }
-
-    // Make sure buf is large enough for received data
-    if ((uint32_t)recvLen > bufLen)
-    {
-        OC_LOG(ERROR, MOD_NAME, PCF("Receive buffer too small"));
-        return -1;
-    }
-
-    if (!ServerDrv::getDataBuf((uint8_t)sockfd, buf, &size))
-    {
-        OC_LOG(ERROR, MOD_NAME, PCF("getDataBuf error"));
-        return -1;
-    }
-
-    // Read IP Address and Port from end of receive buffer
-    memcpy(&(ardAddr->a), &buf[size - WIFI_RECBUF_IPADDR_OFFSET], WIFI_RECBUF_IPADDR_SIZE);
-    // Change the endianness of the port number
-    *((uint8_t*)&(ardAddr->port)) = buf[size - (WIFI_RECBUF_PORT_OFFSET-1)];
-    *((uint8_t*)&(ardAddr->port) + 1) = buf[size - (WIFI_RECBUF_PORT_OFFSET)];
-
-    size -= WIFI_RECBUF_FOOTER_SIZE;
-
-    ardAddr->size =  sizeof(ArduinoAddr) - sizeof(ardAddr->size);
-    OC_LOG(DEBUG, MOD_NAME, PCF("OCRecvFrom End"));
-    return (int32_t)size;
-}
-
-
-/// Close the socket and release all system resources.
-int32_t OCClose(int32_t sockfd)
-{
-    if (sockfd >= MAX_SOCK_NUM)
-    {
-        OC_LOG(ERROR, MOD_NAME, PCF("Invalid sockfd"));
-        return -1;
-    }
-    ServerDrv::stopClient(sockfd);
-
-    WiFiClass::_server_port[sockfd] = 0;
-    WiFiClass::_state[sockfd] = NA_STATE;
-
-    return ERR_SUCCESS;
-}
-
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
-            uint8_t *c, uint8_t *d )
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    if ( !ardAddr || !a || !b || !c || !d ) {
-        OC_LOG(FATAL, MOD_NAME, PCF("Invalid argument"));
-        return ERR_INVALID_INPUT;
-    }
-
-    *a = ardAddr->a;
-    *b = ardAddr->b;
-    *c = ardAddr->c;
-    *d = ardAddr->d;
-
-    return ERR_SUCCESS;
-}
-
-
-/// Retrieve the IPv4 address embedded inside OCDev address data structure
-int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port)
-{
-    ArduinoAddr* ardAddr = (ArduinoAddr*)ipAddr;
-
-    if ( !ardAddr || !port ) {
-        OC_LOG(FATAL, MOD_NAME, PCF("Invalid argument"));
-        return ERR_INVALID_INPUT;
-    }
-
-    *port = ardAddr->port;
-
-    return ERR_SUCCESS;
-}
-
-/// Retrieve the port to which socket is bound
-int32_t OCGetSocketInfo(int32_t sockfd, uint16_t *port)
-{
-    return ERR_NOT_IMPLEMENTED;
-}
diff --git a/resource/csdk/ocsocket/test/android/makefile b/resource/csdk/ocsocket/test/android/makefile
deleted file mode 100644 (file)
index f68574d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# //******************************************************************
-# //
-# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed under the Apache License, Version 2.0 (the "License");
-# // you may not use this file except in compliance with the License.
-# // You may obtain a copy of the License at
-# //
-# //      http://www.apache.org/licenses/LICENSE-2.0
-# //
-# // Unless required by applicable law or agreed to in writing, software
-# // distributed under the License is distributed on an "AS IS" BASIS,
-# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# // See the License for the specific language governing permissions and
-# // limitations under the License.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-include ../local.properties
-
-ROOT_DIR = ../../..
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
-LOGGER_DIR = $(ROOT_DIR)/logger
-BIN_DIR = $(OCSOCK_DIR)/bin/android/
-OBJ_DIR = $(OCSOCK_DIR)/obj/android/
-INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
-
-CXX=arm-linux-androideabi-g++
-CC=arm-linux-androideabi-gcc
-CFLAGS_ANDROID =  -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DGTEST_HAS_PTHREAD=0
-LDFLAGS_ANDROID = -march=armv7-a -Wl,--fix-cortex-a8 -llog
-
-DEP_LIBS = $(GTEST_ANDROID_DIR)/lib/.libs/libgtest_main.a $(GTEST_ANDROID_DIR)/lib/.libs/libgtest.a
-
-CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -DTB_LOG
-
-TEST_APP = ocsocket_gtest
-
-COBJ = ocsocket.o logger.o
-
-VPATH = $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src
-
-all: $(TEST_APP)
-       mkdir -p $(BIN_DIR)
-       cp $(TEST_APP) $(BIN_DIR)
-       mkdir -p $(OBJ_DIR)
-       cp *.o $(OBJ_DIR)
-
-%.o: %.c
-       $(CXX) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) $< -o $@
-
-$(TEST_APP).o: $(TEST_APP).cpp
-       $(CXX) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) -I$(GTEST_ANDROID_DIR)/include -o $@ $<
-
-$(TEST_APP): $(TEST_APP).o $(DEP_LIBS) $(COBJ)
-       $(CXX) -Os -Wl,--gc-sections $(LDFLAGS_ANDROID) $^ -o $@
-
-install: all
-#      adb remount
-       adb push $(BIN_DIR)$(TEST_APP) /data/local/tmp/
-
-.PHONY: clean
-
-clean:
-       rm -f *.o $(TEST_APP) recv
-       rm -fr $(BIN_DIR)
-       rm -fr $(OBJ_DIR)
-
diff --git a/resource/csdk/ocsocket/test/android/ocsocket_gtest.cpp b/resource/csdk/ocsocket/test/android/ocsocket_gtest.cpp
deleted file mode 100644 (file)
index 2d58ac9..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-#include <gtest/gtest.h>
-#include <ocsocket.h>
-#include <logger.h>
-
-#define MOD_NAME ("ocsocket_test")
-#define TEST_PORT_NUM (8888)
-
-unsigned char buf1[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f, 0x6f, 0x67,
-  0x6c, 0x65, 0x63, 0x61, 0x73, 0x74, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05,
-  0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01
-};
-unsigned int buf1_len = sizeof(buf1);
-
-
-unsigned char buf2[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-};
-
-unsigned int buf2_len = sizeof(buf2);
-
-
-TEST(BuildIPv4, Positive) {
-    OCDevAddr ipaddr;
-    EXPECT_EQ(ERR_SUCCESS, OCBuildIPv4Address(224,0,0,251,5353, &ipaddr));
-}
-
-
-TEST(BuildIPv4, InvalidInput) {
-    EXPECT_EQ(ERR_INVALID_INPUT, OCBuildIPv4Address(24,24,24,24,2424, NULL));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCBuildIPv4Address(-24,24,-24,24,2424, NULL));
-}
-
-
-TEST(DevAddrToIPv4Addr, Positive) {
-    OCDevAddr ipaddr;
-    uint8_t  a,b,c,d;
-    uint16_t port;
-    OCBuildIPv4Address(1,2,3,4,5353, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCDevAddrToIPv4Addr(&ipaddr, &a, &b, &c, &d ));
-    EXPECT_TRUE((a == 1) && (b == 2) && (c == 3) && (d ==4));
-    EXPECT_EQ(ERR_SUCCESS, OCDevAddrToPort(&ipaddr, &port ));
-    EXPECT_TRUE(port == 5353);
-}
-
-
-TEST(DevAddrToIPv4Addr, InvalidInput) {
-    OCDevAddr ipaddr;
-    uint8_t  a,b,c,d;
-    uint16_t port;
-    OCBuildIPv4Address(1,2,3,4,5353, &ipaddr);
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(NULL, &a, &b, &c, &d ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(&ipaddr, NULL, &b, &c, &d ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(NULL, NULL, &b, &c, &d ));
-
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(NULL, &port ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(&ipaddr, NULL ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(NULL, NULL ));
-}
-
-TEST(InitUDP, Positive) {
-    OCDevAddr ipaddr;
-    int32_t  sockfd;
-    uint8_t addr[20];
-    uint8_t ifname[] = "wlan0";
-    uint8_t a,b,c,d;
-
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-
-    OCBuildIPv4Address(0,0,0,0, 5678, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-
-    sscanf((const char*)addr, "%d.%d.%d.%d", (int*)&a, (int*)&b, (int*)&c, (int*)&d);
-    OCBuildIPv4Address(a,b,c,d, TEST_PORT_NUM, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-}
-
-
-TEST(InitUDP, Negative) {
-    OCDevAddr ipaddr;
-    int32_t  sockfd;
-
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr);
-    EXPECT_EQ(ERR_INVALID_INPUT, OCInitUDP(NULL, &sockfd));
-
-    EXPECT_EQ(ERR_INVALID_INPUT, OCInitUDP(&ipaddr, NULL));
-}
-
-TEST(SendToRecvfromUnicast, Positive) {
-    OCDevAddr ipaddr1, ipaddr2, ipaddr3;
-    int32_t  ssfd, rsfd;
-    uint8_t addr[20];
-    uint8_t ifname[] = "wlan0";
-    uint8_t a,b,c,d;
-    //uint8_t tmp1[512];
-
-    sscanf((const char*)addr, "%d.%d.%d.%d", (int*)&a, (int*)&b, (int*)&c, (int*)&d);
-
-    //Create sending socket
-    OCBuildIPv4Address(a, b, c, d, 0, &ipaddr1);
-    OCInitUDP(&ipaddr1, &ssfd);
-
-    //Create receiving socket...i.e. bind to the specific port
-    OCBuildIPv4Address(a,b,c, d+1, TEST_PORT_NUM, &ipaddr2);
-    OCInitUDP(&ipaddr2, &rsfd);
-
-    //Test 1 -- Send 40 bytes
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ(buf1_len, OCSendTo(ssfd, buf1, buf1_len, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    //EXPECT_EQ(buf1_len, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    //EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, buf1_len));
-
-    //Test 2 -- Send 1 byte
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ( 1, OCSendTo(ssfd, buf1, 1, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    //EXPECT_EQ( 1, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    //EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, 1));
-
-    //Test 3 -- Send 320 byte
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ(buf2_len, OCSendTo(ssfd, buf2, buf2_len, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    //EXPECT_EQ(buf2_len, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    //EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf2, buf2_len));
-
-    OCClose(ssfd);
-    OCClose(rsfd);
-}
-
-
-
-TEST(SendToRecvfromMulticast, Positive) {
-    OCDevAddr ipaddr1, ipaddr2, ipaddr3, ipaddr4;
-    int32_t  ssfd;
-    uint8_t tmp1[512];
-
-    //Create sending socket
-    OCBuildIPv4Address(0,0,0,0, 5353, &ipaddr1);
-    OCBuildIPv4Address(224, 0, 0, 251, 5353, &ipaddr2); //address to which MEMBERSHIP needs to be added
-
-    //build the multicast address to which we need to send the datagram
-    OCBuildIPv4Address(224, 0, 0, 251, 5353, &ipaddr3);
-
-    //Test 1 -- Send 40 bytes
-    EXPECT_EQ(buf1_len, OCSendTo(ssfd, buf1, buf1_len, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ(buf1_len, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr4));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, buf1_len));
-
-    //Test 2 -- Send 1 byte
-    EXPECT_EQ( 1, OCSendTo(ssfd, buf1, 1, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ( 1, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr4));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, 1));
-
-    //Test 3 -- Send 320 byte
-    EXPECT_EQ(buf2_len, OCSendTo(ssfd, buf2, buf2_len, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ(buf2_len, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf2, buf2_len));
-
-    OCClose(ssfd);
-}
-
diff --git a/resource/csdk/ocsocket/test/arduino/makefile b/resource/csdk/ocsocket/test/arduino/makefile
deleted file mode 100644 (file)
index 682a5a8..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-# //******************************************************************
-# //
-# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed under the Apache License, Version 2.0 (the "License");
-# // you may not use this file except in compliance with the License.
-# // You may obtain a copy of the License at
-# //
-# //      http://www.apache.org/licenses/LICENSE-2.0
-# //
-# // Unless required by applicable law or agreed to in writing, software
-# // distributed under the License is distributed on an "AS IS" BASIS,
-# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# // See the License for the specific language governing permissions and
-# // limitations under the License.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-BUILD := release
-PLATFORM := arduinomega
-ARDUINO_PORT := /dev/ttyACM0
-
-# override with `make PLATFORM=arduinomega ARDUINOWIFI=1` to enable Arduino WiFi shield
-ARDUINOWIFI := 0
-
-ifeq ($(ARDUINOWIFI),0)
-       APP_NAME := ocsocket_test
-       OCSOCKET_CPPOBJ = ocsocket_arduino.o
-else
-       APP_NAME := ocsocket_wifi_test
-       OCSOCKET_CPPOBJ = ocsocket_arduino_wifi.o
-endif
-
-OBJ_DIR := ./bin
-
-ROOT_DIR = ../../..
-
-include $(ROOT_DIR)/local.properties
-include $(ROOT_DIR)/$(PLATFORM).properties
-
-
-#include directories
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
-LOGGER_DIR = $(ROOT_DIR)/logger
-INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
-
-VPATH := $(SDIR_ARD_PLATFORM):$(LOGGER_DIR)/src:$(OCSOCK_DIR)/src 
-
-CFLAGS := -Os -Wall -c -DTB_LOG
-
-all: core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).hex
-
-core.a: $(PLATFORM_OBJS)
-       $(AR) rcs $@ $^
-       $(RANLIB) $@
-
-#logger needs to be compiled using C++ compiler
-logger.o: logger.c
-       $(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
-
-%.o: %.c
-       $(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
-
-%.o: %.cpp
-       $(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
-
-$(APP_NAME).elf: $(APP_NAME).o $(OCSOCKET_CPPOBJ) logger.o core.a
-       $(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $^ -lm -o $@
-
-$(APP_NAME).hex: $(APP_NAME).elf
-       $(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $(APP_NAME).eep
-       $(AVR_OBJCOPY) -O ihex -R .eeprom $< $@
-
-install: all
-       $(AVR_PROGRAMMER) -C$(ARDUINO_DIR)/hardware/tools/avrdude.conf -v -v -v -v -patmega2560 -cstk500v2 -P$(ARDUINO_PORT) -b115200 -D -Uflash:w:$(APP_NAME).hex:i
-
-.PHONY: clean
-
-clean:
-       @rm -f *.o *.d *.elf *.eep *.a *.hex *.bin *.map *-
-       @rm -rf $(OBJ_DIR)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/resource/csdk/ocsocket/test/arduino/ocsocket_test.cpp b/resource/csdk/ocsocket/test/arduino/ocsocket_test.cpp
deleted file mode 100644 (file)
index 993ab26..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <SPI.h>
-#include <Ethernet.h>
-#include <ocsocket.h>
-#include <logger.h>
-
-//Mac address of my ethernet shield
-static uint8_t ETHERNET_MAC[] = {0x90, 0xA2, 0xDA, 0x0F, 0x2B, 0x72 };
-//IP address of the peer whom I wish to send some data
-static uint8_t PEER_IP_ADDR[] = {192, 168, 1, 125};
-static uint8_t MULTICAST_IP_ADDR[] = {224, 0, 1, 187};
-
-//Set below to 0 to disable multicast testing
-//#define MCAST_TESTING_EN 1
-
-#define TEST_NUM_PKTS (20)
-#define TEST_PORT_NUM (8888)
-#define MAX_BUF_SIZE  (256)
-
-unsigned char TEST_BUF[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-};
-unsigned int TEST_BUF_LEN = sizeof(TEST_BUF);
-
-#define PCF(str) ((PROGMEM const char *)(F(str)))
-
-#define MOD_NAME PCF("ocsocket_test")
-
-#define VERIFY_SUCCESS(op, res) { if (op == res) {OC_LOG(DEBUG, MOD_NAME, PCF(#op " SUCCEEDED"));} \
-     else {OC_LOG(FATAL, MOD_NAME, PCF(#op "!!!!  FAILED FAILED FAILED !!!!"));} }
-
-//OCBuildIPv4Address tests
-void test20() {
-    OCDevAddr ipAddr;
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, NULL), ERR_INVALID_INPUT);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test20 - Completed"));
-}
-
-
-void test30() {
-
-    OCDevAddr ipAddr;
-    uint8_t a, b, c, d;
-    uint16_t port;
-    VERIFY_SUCCESS(OCBuildIPv4Address( 1, 2, 3, 4, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCDevAddrToIPv4Addr( &ipAddr, &a, &b, &c, &d), ERR_SUCCESS);
-    if ((a != 1) || (b != 2) || (c !=3) || (d !=4)) {
-        OC_LOG(DEBUG, MOD_NAME, PCF("test30 - Failed !!!"));
-        return;
-    }
-
-    VERIFY_SUCCESS(OCDevAddrToPort( &ipAddr, &port), ERR_SUCCESS);
-    if (port != TEST_PORT_NUM) {
-        OC_LOG(DEBUG, MOD_NAME, PCF("test30 - Failed !!!"));
-        return;
-    }
-    VERIFY_SUCCESS(OCDevAddrToIPv4Addr( NULL, &a, &b, &c, &d), ERR_INVALID_INPUT);
-    VERIFY_SUCCESS(OCDevAddrToPort( &ipAddr, NULL), ERR_INVALID_INPUT);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test30 - Completed"));
-}
-
-//OCInitUDP tests
-void test40() {
-    OCDevAddr ipAddr;
-    int32_t sfd1, sfd2, sfd3, sfd4, sfd5;
-
-    //We should be able to successfully open 4 sockets.
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd1), ERR_SUCCESS);
-
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM + 1, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd2), ERR_SUCCESS);
-
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM + 2, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd3), ERR_SUCCESS);
-
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM + 3, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd4), ERR_SUCCESS);
-
-    //5th socket creation call should FAIL
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM + 4, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd5), ERR_UNKNOWN);
-
-    VERIFY_SUCCESS(OCClose( sfd4), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd5), ERR_SUCCESS);
-
-    VERIFY_SUCCESS(OCClose( sfd1), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCClose( sfd2), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCClose( sfd3), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCClose( sfd5), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test40 - Completed"));
-}
-
-//OCSendTo -- Unicast tests
-void test60() {
-    OCDevAddr ipAddr, peerAddr;
-    int32_t sfd;
-
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCBuildIPv4Address(PEER_IP_ADDR[0], PEER_IP_ADDR[0],
-                PEER_IP_ADDR[0], PEER_IP_ADDR[0], TEST_PORT_NUM, &peerAddr), ERR_SUCCESS);
-
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd), ERR_SUCCESS);
-    for (int i = 2; i < 300; ) {
-        VERIFY_SUCCESS(OCSendTo(sfd, TEST_BUF, i, 0, &peerAddr), i);
-        i = i + 12;
-
-        delay(100);
-    }
-    VERIFY_SUCCESS(OCClose( sfd), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test60 - Completed"));
-}
-
-//End to End - Unicast Send/Recv test
-//Start sample app 'sendrecv' on different Linux box.
-void test80() {
-    OCDevAddr ipAddr, peerAddr;
-    int32_t sfd;
-    int32_t recvLen;
-    uint8_t buf[MAX_BUF_SIZE];
-    uint8_t pktrecv = 0;
-
-    //Unicast
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd), ERR_SUCCESS);
-
-    do {
-        recvLen = OCRecvFrom(sfd, buf, MAX_BUF_SIZE, 0, &peerAddr);
-        if (recvLen > 0) {
-            pktrecv++;
-            OC_LOG(DEBUG, MOD_NAME, PCF("Rcvd data from :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, peerAddr.addr, peerAddr.size);
-            OC_LOG(DEBUG, MOD_NAME, PCF("Data Length :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, (uint8_t*)&recvLen, sizeof(recvLen));
-
-            VERIFY_SUCCESS(OCSendTo(sfd, buf, recvLen, 0, &peerAddr), recvLen);
-        } else {
-            OC_LOG(DEBUG, MOD_NAME, PCF("No data received"));
-        }
-        delay(500); //delay  secs
-    } while (pktrecv < TEST_NUM_PKTS);
-
-    VERIFY_SUCCESS(OCClose(sfd), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test80 - Completed"));
-}
-
-
-//End to End - Multicast Send/Recv test
-//Start sample app 'sendrecv' on different Linux box.
-void test90() {
-    OCDevAddr ipAddrMcast, peerAddr;
-    int32_t sfd;
-    int32_t recvLen;
-    uint8_t buf[MAX_BUF_SIZE];
-    uint8_t pktrecv = 0;
-
-    //Multicast
-    VERIFY_SUCCESS(OCBuildIPv4Address( MULTICAST_IP_ADDR[0], MULTICAST_IP_ADDR[1],
-                MULTICAST_IP_ADDR[2], MULTICAST_IP_ADDR[3], TEST_PORT_NUM, &ipAddrMcast), ERR_SUCCESS);
-
-    do {
-
-        recvLen = OCRecvFrom(sfd, buf, MAX_BUF_SIZE, 0, &peerAddr);
-        if (recvLen > 0) {
-            pktrecv++;
-            OC_LOG(DEBUG, MOD_NAME, PCF("Rcvd data from :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, peerAddr.addr, peerAddr.size);
-            OC_LOG(DEBUG, MOD_NAME, PCF("Data Length :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, (uint8_t*)&recvLen, sizeof(recvLen));
-
-            VERIFY_SUCCESS(OCSendTo(sfd, buf, recvLen, 0, &ipAddrMcast), recvLen);
-        } else {
-            OC_LOG(DEBUG, MOD_NAME, PCF("No data received"));
-        }
-        delay(500); //delay  secs
-    } while (pktrecv < TEST_NUM_PKTS);
-
-    VERIFY_SUCCESS(OCClose(sfd), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("test90 - Completed"));
-}
-
-
-
-//End to End - 'Simultaneous' Unicast-Multicast Send/Recv test
-//This tests if Arduino Wiznet shield can open 2 independent sockets listening on same port:
-//  one for unicast traffic and another for multicast traffic.
-//Start sample app 'sendrecv' on different Linux box.
-void test100() {
-    //TBD
-    //TBD
-    //TBD
-}
-
-
-
-
-
-void setup() {
-
-    Serial.begin(115200);
-
-    Serial.println("Trying to get an IP address using DHCP");
-    if (Ethernet.begin(ETHERNET_MAC) == 0) {
-        Serial.println("Failed to configure Ethernet using DHCP");
-    }
-}
-
-void loop() {
-    test10();
-    test20();
-    test30();
-    test40();
-    test50();
-    test60(); //SendTo --Unicast
-    test70(); //SendTo --Multicast
-    test80(); //End-to-End  --Unicast
-    delay(5000);
-    test90(); //End-to-End  --Multicast
-
-    do {
-        OC_LOG(DEBUG, MOD_NAME, PCF("All tests Completed"));
-        delay(10000);
-    } while (1);
-}
-
-
diff --git a/resource/csdk/ocsocket/test/arduino/ocsocket_wifi_test.cpp b/resource/csdk/ocsocket/test/arduino/ocsocket_wifi_test.cpp
deleted file mode 100644 (file)
index 0138afb..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <ocsocket.h>
-#include <logger.h>
-#include <SPI.h>
-#include <WiFi.h>
-#include <WiFiUdp.h>
-
-/// WiFi Shield firmware with Intel patches
-static const char INTEL_WIFI_SHIELD_FW_VER[] = "1.2.0";
-
-/// IP address of the peer whom I wish to send/recv some data
-static uint8_t PEER_IP_ADDR[] = {192, 168, 1, 132};
-
-/// Port number of the peer whom I wish to send/recv some data
-#define TEST_PORT_NUM (4097)
-
-/// Max buffer size
-#define MAX_BUF_SIZE  (1024)
-
-/// Some test bytes to send to the peer
-unsigned char TEST_BUF[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-};
-unsigned int TEST_BUF_LEN = sizeof(TEST_BUF);
-
-#define MOD_NAME PCF("ocsocket_test")
-
-#define VERIFY_SUCCESS(op, res) { if (op == res) {OC_LOG(DEBUG, MOD_NAME, PCF(#op " SUCCEEDED"));} \
-     else {OC_LOG(FATAL, MOD_NAME, PCF(#op "!!!!  FAILED FAILED FAILED !!!!"));} }
-
-/// WiFi network info and credentials
-char ssid[] = "mDNSAP";
-char pass[] = "letmein9";
-int status = WL_IDLE_STATUS;
-
-//Start sample app 'sendrecv' on different Linux box.
-void SendReceiveTest()
-{
-    Serial.println("entering SendReceiveTest...");
-    OCDevAddr ipAddr, peerAddr, recvAddr;
-    int32_t sfd;
-    int32_t recvLen;
-    uint8_t buf[MAX_BUF_SIZE];
-    uint16_t recvPort;
-
-    VERIFY_SUCCESS(OCBuildIPv4Address( 0, 0, 0, 0, TEST_PORT_NUM, &ipAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCBuildIPv4Address(PEER_IP_ADDR[0], PEER_IP_ADDR[1],
-                PEER_IP_ADDR[2], PEER_IP_ADDR[3], TEST_PORT_NUM, &peerAddr), ERR_SUCCESS);
-    VERIFY_SUCCESS(OCInitUDP( &ipAddr, &sfd), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("Peer Addr :"));
-    OC_LOG_BUFFER(INFO, MOD_NAME, peerAddr.addr, peerAddr.size);
-    for (int i = 0; i < 300; i++)
-    {
-
-        OC_LOG_V(DEBUG, MOD_NAME, "--------------------- i --------------- %d", i);
-        VERIFY_SUCCESS(OCSendTo(sfd, TEST_BUF, i + 10, 0, &peerAddr), i+10);
-
-        delay(2000);
-        recvLen = OCRecvFrom(sfd, buf, MAX_BUF_SIZE, 0, &recvAddr);
-        if (recvLen > 0)
-        {
-            OC_LOG(DEBUG, MOD_NAME, PCF("Rcvd data from :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, recvAddr.addr, recvAddr.size);
-            OCDevAddrToPort(&recvAddr, &recvPort);
-            OC_LOG_V(DEBUG, MOD_NAME, "Recv Data from Port %hu", recvPort);
-            OC_LOG(DEBUG, MOD_NAME, PCF("Data Length :"));
-            OC_LOG_BUFFER(INFO, MOD_NAME, (uint8_t*)&recvLen, sizeof(recvLen));
-            OC_LOG(DEBUG, MOD_NAME, PCF("Data :"));
-            if (recvLen < 255)
-            {
-                OC_LOG_BUFFER(INFO, MOD_NAME, buf, recvLen);
-            }
-            else
-            {
-                int idx = 0;
-                int rem = recvLen;
-                do {
-                    if (rem > 255)
-                    {
-                        OC_LOG_BUFFER(INFO, MOD_NAME, buf + idx, 255);
-                        rem = rem - 255;
-                    }
-                    else
-                    {
-                        OC_LOG_BUFFER(INFO, MOD_NAME, buf + idx, rem);
-                        rem = 0;
-                    }
-                    idx = idx + 255;
-                }while(rem > 0);
-            }
-
-        }
-    }
-    VERIFY_SUCCESS(OCClose( sfd), ERR_SUCCESS);
-    OC_LOG(DEBUG, MOD_NAME, PCF("WifiTest - Completed"));
-
-}
-void setup()
-{
-    Serial.begin(115200);
-    Serial.println("WiFi test starting...");
-
-    // check for the presence of the shield:
-    if (WiFi.status() == WL_NO_SHIELD)
-    {
-      Serial.println("WiFi shield not present");
-      // don't continue:
-      while(true);
-    }
-
-    Serial.print("WiFi version: ");
-    Serial.println(WiFi.firmwareVersion());
-
-    if (strcmp(WiFi.firmwareVersion(), INTEL_WIFI_SHIELD_FW_VER) != 0)
-    {
-        Serial.println("!!!!! Upgrade WiFi Shield Firmware version !!!!!!");
-    }
-
-    // attempt to connect to Wifi network:
-    while ( status != WL_CONNECTED) {
-      Serial.print("Attempting to connect to SSID: ");
-      Serial.println(ssid);
-      status = WiFi.begin(ssid,pass);
-
-      // wait 10 seconds for connection:
-      delay(10000);
-    }
-    Serial.println("Connected to wifi");
-
-    IPAddress ip = WiFi.localIP();
-    Serial.print("IP Address: ");
-    Serial.println(ip);
-}
-
-void loop() {
-    Serial.println("entering loop...");
-    SendReceiveTest();
-    delay(5000);
-
-    do {
-        OC_LOG(DEBUG, MOD_NAME, PCF("All tests Completed"));
-        delay(10000);
-    } while (1);
-}
-
-
diff --git a/resource/csdk/ocsocket/test/linux/makefile b/resource/csdk/ocsocket/test/linux/makefile
deleted file mode 100644 (file)
index adf6abc..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# //******************************************************************
-# //
-# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed under the Apache License, Version 2.0 (the "License");
-# // you may not use this file except in compliance with the License.
-# // You may obtain a copy of the License at
-# //
-# //      http://www.apache.org/licenses/LICENSE-2.0
-# //
-# // Unless required by applicable law or agreed to in writing, software
-# // distributed under the License is distributed on an "AS IS" BASIS,
-# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# // See the License for the specific language governing permissions and
-# // limitations under the License.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-PLATFORM := linux
-
-ROOT_DIR = ../../..
-include $(ROOT_DIR)/local.properties
-
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
-OC_LOG_DIR    = $(ROOT_DIR)/../oc_logger
-LOGGER_DIR = $(ROOT_DIR)/logger
-BIN_DIR = $(OCSOCK_DIR)/bin/linux/
-OBJ_DIR = $(OCSOCK_DIR)/obj/linux/
-INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include -I$(OC_LOG_DIR)/include
-
-CXX = g++
-CC = gcc
-
-CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -DTB_LOG
-DEP_LIBS = $(GTEST_LINUX_DIR)/lib/.libs/libgtest_main.a $(GTEST_LINUX_DIR)/lib/.libs/libgtest.a
-VPATH = $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src
-
-TEST_APP = ocsocket_gtest
-COBJ = logger.o ocsocket.o 
-
-all: $(TEST_APP)
-       mkdir -p $(BIN_DIR)
-       cp $(TEST_APP) $(BIN_DIR)
-       mkdir -p $(OBJ_DIR)
-       cp *.o $(OBJ_DIR)
-
-%.o: %.c
-       $(CC) -c $(CFLAGS) $(INC_DIRS) $< -o $@
-
-$(TEST_APP).o: $(TEST_APP).cpp
-       $(CXX) -c $(CFLAGS) -pthread $(INC_DIRS)  -I$(GTEST_LINUX_DIR)/include -o $@ $<
-
-$(TEST_APP): $(TEST_APP).o $(DEP_LIBS) $(COBJ)
-       $(CXX) -Os -Wl,--gc-sections $^ -lpthread -o $@
-
-.PHONY: clean
-
-clean:
-       rm -f *.o $(TEST_APP)
-       rm -fr $(BIN_DIR)
-       rm -fr $(OBJ_DIR)
-
-
diff --git a/resource/csdk/ocsocket/test/linux/ocsocket_gtest.cpp b/resource/csdk/ocsocket/test/linux/ocsocket_gtest.cpp
deleted file mode 100644 (file)
index 3c941e9..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-#include <gtest/gtest.h>
-#include <ocsocket.h>
-#include <logger.h>
-
-#define MOD_NAME ("ocsocket_test")
-
-#define TEST_PORT_NUM (8888)
-
-unsigned char buf1[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f, 0x6f, 0x67,
-  0x6c, 0x65, 0x63, 0x61, 0x73, 0x74, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05,
-  0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01
-};
-unsigned int buf1_len = sizeof(buf1);
-
-
-unsigned char buf2[] = {
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0b, 0x5f, 0x67, 0x6f,
-  0x6f, 0x67, 0x6c, 0x65, 0x63, 0x61, 0x73, 0x74,
-  0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f,
-  0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01,
-};
-unsigned int buf2_len = sizeof(buf2);
-
-TEST(BuildIPv4, Positive) {
-    OCDevAddr ipaddr;
-    EXPECT_EQ(ERR_SUCCESS, OCBuildIPv4Address(224,0,0,251,5353, &ipaddr));
-}
-
-
-TEST(BuildIPv4, InvalidInput) {
-    EXPECT_EQ(ERR_INVALID_INPUT, OCBuildIPv4Address(24,24,24,24,2424, NULL));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCBuildIPv4Address(-24,24,-24,24,2424, NULL));
-}
-
-TEST(DevAddrToIPv4Addr, Positive) {
-    OCDevAddr ipaddr;
-    uint8_t  a,b,c,d;
-    uint16_t port;
-    OCBuildIPv4Address(1,2,3,4,5353, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCDevAddrToIPv4Addr(&ipaddr, &a, &b, &c, &d ));
-    EXPECT_TRUE((a == 1) && (b == 2) && (c == 3) && (d ==4));
-    EXPECT_EQ(ERR_SUCCESS, OCDevAddrToPort(&ipaddr, &port ));
-    EXPECT_TRUE(port == 5353);
-}
-
-
-TEST(DevAddrToIPv4Addr, InvalidInput) {
-    OCDevAddr ipaddr;
-    uint8_t  a,b,c,d;
-    uint16_t port;
-    OCBuildIPv4Address(1,2,3,4,5353, &ipaddr);
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(NULL, &a, &b, &c, &d ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(&ipaddr, NULL, &b, &c, &d ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToIPv4Addr(NULL, NULL, &b, &c, &d ));
-
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(NULL, &port ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(&ipaddr, NULL ));
-    EXPECT_EQ(ERR_INVALID_INPUT, OCDevAddrToPort(NULL, NULL ));
-}
-
-TEST(InitUDP, Positive) {
-    OCDevAddr ipaddr;
-    int32_t  sockfd;
-    uint8_t addr[20];
-    uint8_t ifname[] = "eth0";
-    uint8_t a,b,c,d;
-
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-
-    OCBuildIPv4Address(0,0,0,0, 5678, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-
-    sscanf((const char*)addr, "%d.%d.%d.%d", (int*)&a, (int*)&b, (int*)&c, (int*)&d);
-    OCBuildIPv4Address(a,b,c,d, TEST_PORT_NUM, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    OCClose(sockfd);
-}
-
-
-TEST(InitUDP, Negative) {
-    OCDevAddr ipaddr;
-    int32_t  sockfd;
-
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr);
-    EXPECT_EQ(ERR_INVALID_INPUT, OCInitUDP(NULL, &sockfd));
-
-    EXPECT_EQ(ERR_INVALID_INPUT, OCInitUDP(&ipaddr, NULL));
-}
-
-TEST(SendToRecvfromUnicast, Positive) {
-    OCDevAddr ipaddr1, ipaddr2, ipaddr3;
-    int32_t  ssfd, rsfd;
-    uint8_t addr[20];
-    uint8_t ifname[] = "eth0";
-    uint8_t a,b,c,d;
-    uint8_t tmp1[512];
-
-    //Create sending socket
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr1);
-    OCInitUDP(&ipaddr1, &ssfd);
-
-    //Create receiving socket...i.e. bind to the specific port
-    OCBuildIPv4Address(0,0,0,0, TEST_PORT_NUM, &ipaddr2);
-    OCInitUDP(&ipaddr2, &rsfd);
-
-    //Since this is a Unit test, we will attempt to send message to ourself at a specific port
-    sscanf((const char*)addr, "%d.%d.%d.%d", (int*)&a, (int*)&b, (int*)&c, (int*)&d);
-    OCBuildIPv4Address(a,b,c,d, TEST_PORT_NUM, &ipaddr2);
-
-    //Test 1 -- Send 40 bytes
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ(buf1_len, OCSendTo(ssfd, buf1, buf1_len, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    EXPECT_EQ(buf1_len, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, buf1_len));
-
-    //Test 2 -- Send 1 byte
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ( 1, OCSendTo(ssfd, buf1, 1, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    EXPECT_EQ( 1, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, 1));
-
-    //Test 3 -- Send 320 byte
-    //Send the packet to ipaddr2(myself:TEST_PORT_NUM)
-    EXPECT_EQ(buf2_len, OCSendTo(ssfd, buf2, buf2_len, 0, &ipaddr2));
-    //Receive the packet
-    ipaddr3.size = sizeof(ipaddr3.addr);
-    EXPECT_EQ(buf2_len, OCRecvFrom(rsfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf2, buf2_len));
-
-    OCClose(ssfd);
-    OCClose(rsfd);
-}
-
-
-TEST(SendToRecvfromMulticast, Positive) {
-    OCDevAddr ipaddr1, ipaddr2, ipaddr3, ipaddr4;
-    int32_t  ssfd;
-    uint8_t tmp1[512];
-
-    //Create sending socket
-    OCBuildIPv4Address(0,0,0,0, 5353, &ipaddr1);
-    OCBuildIPv4Address(224, 0, 0, 251, 5353, &ipaddr2); //address to which MEMBERSHIP needs to be added
-
-    //build the multicast address to which we need to send the datagram
-    OCBuildIPv4Address(224, 0, 0, 251, 5353, &ipaddr3);
-
-    //Test 1 -- Send 40 bytes
-    EXPECT_EQ(buf1_len, OCSendTo(ssfd, buf1, buf1_len, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ(buf1_len, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr4));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, buf1_len));
-
-    //Test 2 -- Send 1 byte
-    EXPECT_EQ( 1, OCSendTo(ssfd, buf1, 1, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ( 1, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr4));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf1, 1));
-
-    //Test 3 -- Send 320 byte
-    EXPECT_EQ(buf2_len, OCSendTo(ssfd, buf2, buf2_len, 0, &ipaddr3));
-    //Receive the packet
-    ipaddr4.size = sizeof(ipaddr4.addr);
-    EXPECT_EQ(buf2_len, OCRecvFrom(ssfd, tmp1, sizeof(tmp1), 0, &ipaddr3));
-    //Compare the received buffer with send buffer
-    EXPECT_EQ(ERR_SUCCESS, memcmp(tmp1, buf2, buf2_len));
-
-    OCClose(ssfd);
-}
-
-TEST(GetSocketInfo, Positive) {
-    OCDevAddr ipaddr;
-    int32_t  sockfd;
-    uint8_t addr[20];
-    uint8_t ifname[] = "eth0";
-    uint16_t port;
-    uint8_t a,b,c,d;
-
-    OCBuildIPv4Address(0,0,0,0, 0, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    EXPECT_EQ(ERR_SUCCESS, OCGetSocketInfo(sockfd, &port));
-    OC_LOG_V(DEBUG, MOD_NAME, "Port %d", port);
-    OCClose(sockfd);
-
-    OCBuildIPv4Address(0,0,0,0, 5678, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    EXPECT_EQ(ERR_SUCCESS, OCGetSocketInfo(sockfd, &port));
-    OC_LOG_V(DEBUG, MOD_NAME, "Port %d", port);
-    EXPECT_TRUE(port == 5678);
-    OCClose(sockfd);
-
-    sscanf((const char*)addr, "%d.%d.%d.%d", (int*)&a, (int*)&b, (int*)&c, (int*)&d);
-    OCBuildIPv4Address(a,b,c,d, TEST_PORT_NUM, &ipaddr);
-    EXPECT_EQ(ERR_SUCCESS, OCInitUDP(&ipaddr, &sockfd));
-    EXPECT_EQ(ERR_SUCCESS, OCGetSocketInfo(sockfd, &port));
-    OC_LOG_V(DEBUG, MOD_NAME, "Port %d", port);
-    EXPECT_TRUE(port == TEST_PORT_NUM);
-    OCClose(sockfd);
-}
diff --git a/resource/csdk/ocsocket/test/makefile b/resource/csdk/ocsocket/test/makefile
deleted file mode 100644 (file)
index 8d6598e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# //******************************************************************
-# //
-# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed under the Apache License, Version 2.0 (the "License");
-# // you may not use this file except in compliance with the License.
-# // You may obtain a copy of the License at
-# //
-# //      http://www.apache.org/licenses/LICENSE-2.0
-# //
-# // Unless required by applicable law or agreed to in writing, software
-# // distributed under the License is distributed on an "AS IS" BASIS,
-# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# // See the License for the specific language governing permissions and
-# // limitations under the License.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-all: 
-       $(MAKE) -C android all
-       $(MAKE) -C linux all
-       $(MAKE) -C arduino all
-
-install: all
-       $(MAKE) -C android install
-       $(MAKE) -C arduino install
-
-.PHONY: clean
-
-clean:
-       $(MAKE) -C android clean
-       $(MAKE) -C linux clean
-       $(MAKE) -C arduino clean
-
diff --git a/resource/csdk/ocsocket/test/sendrecv.cpp b/resource/csdk/ocsocket/test/sendrecv.cpp
deleted file mode 100644 (file)
index e657d6b..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <net/if.h>
-
-#include <ifaddrs.h>
-#include <linux/if_link.h>
-
-#include <signal.h>
-
-//static uint8_t MULTICAST_IP_ADDR[] = {224, 0, 1, 187};
-//static uint32_t TEST_PORT_NUM = 8888;
-
-
-#define MAX_BUF (1024)
-uint8_t g_bfr[] = {
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
-    };
-uint32_t g_bfrlen = sizeof(g_bfr);
-
-int multicast_test(int argc, char* argv[])
-{
-    int32_t sfd;
-    char loopch=0;
-    int set_option_on = 1;
-    struct sockaddr_in mcastsock = {0}, peer;
-    uint8_t recvbuf[MAX_BUF];
-    uint32_t len, bufLen, fromlen;
-
-    printf("Running multicast tests\n");
-
-    bufLen = atoi(argv[4]);
-    if (bufLen > g_bfrlen) {
-        printf("Warning: Input buffer provided too big. Trimming to supported size\n");
-        bufLen = g_bfrlen;
-    }
-
-    //Create a datagram socket on which to send.
-    sfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-    if (sfd < 0) {
-        printf("Error in opening datagram socket");
-        return -1;
-    }
-
-    //Initialize the group sockaddr structure with a
-    mcastsock.sin_family = AF_INET;
-    mcastsock.sin_addr.s_addr = inet_addr(argv[2]);
-    mcastsock.sin_port = htons(atoi(argv[3]));
-
-    //Disable loopback so you do not receive your own datagrams.
-    if (setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_LOOP,
-                (char *)&loopch, sizeof(loopch)) < 0) {
-        //printf("setting IP_MULTICAST_LOOP:");
-        close(sfd);
-        return -1;
-    }
-
-    //Play nice with other processes who may be listening at this
-    //port/IP address combination
-    if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char*) &set_option_on,
-                sizeof(set_option_on)) < 0) {
-        //printf("setting SO_REUSEADDR:");
-        close(sfd);
-        return -1;
-    }
-
-    if (bind(sfd, (sockaddr*)&mcastsock, sizeof(mcastsock)) < 0) {
-        printf("bind returns error");
-        close(sfd);
-        return -1;
-    }
-
-    struct ip_mreq mreq = {0};
-    mreq.imr_interface.s_addr = htonl(INADDR_ANY);
-    mreq.imr_multiaddr.s_addr = mcastsock.sin_addr.s_addr;
-    if ((setsockopt(sfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq))) < 0) {
-        printf("multicast -- adding membership failed");
-        close(sfd);
-        return -1;
-    }
-
-    do {
-        len = sendto(sfd, g_bfr,  bufLen, 0,
-                (struct sockaddr*)&mcastsock, sizeof(mcastsock));
-        if (len > 0) {
-            printf ("Send %d bytes to %s\n", len, inet_ntoa(mcastsock.sin_addr));
-        }
-
-        fromlen = sizeof(peer);
-        len = recvfrom(sfd, recvbuf, sizeof(recvbuf), 0, (struct sockaddr*)&peer, &fromlen);
-        if (len > 0) {
-            printf("Rcvd %d bytes from %s\n", len, inet_ntoa(peer.sin_addr));
-        }
-
-        sleep(1);
-    } while (true);
-
-    close(sfd);
-    return 0;
-}
-
-
-
-
-int unicast_test(int argc, char* argv[])
-{
-    int32_t sfd;
-    struct sockaddr_in sa, peer;
-    uint8_t recvbuf[MAX_BUF];
-    uint32_t len, bufLen, fromlen;
-
-    printf("Running unicast tests\n");
-
-    bufLen = atoi(argv[4]);
-    if (bufLen > g_bfrlen) {
-        printf("Warning: Input buffer provided too big. Trimming to supported size\n");
-        bufLen = g_bfrlen;
-    }
-
-    sfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-    if (sfd < 0) {
-        printf("socket API ret val %d\n", sfd);
-        return -1;
-    }
-
-    sa.sin_family = AF_INET;
-    sa.sin_addr.s_addr = INADDR_ANY;
-    sa.sin_port = htons(atoi(argv[3]));
-
-    if (bind(sfd, (struct sockaddr*)&sa, sizeof(sa)) < 0) {
-        printf("bin API ret val %d\n", sfd);
-        close(sfd);
-        return -1;
-    }
-
-    peer.sin_family = AF_INET;
-    inet_aton(argv[2], &peer.sin_addr);
-    peer.sin_port = htons(atoi(argv[3]));
-
-    do {
-        len = sendto(sfd, g_bfr,  bufLen, 0,
-                (struct sockaddr*)&peer, sizeof(peer));
-
-        if (len > 0) {
-            printf ("Send %d bytes to %s\n", len, inet_ntoa(peer.sin_addr));
-        }
-
-        fromlen = sizeof(peer);
-        len = recvfrom(sfd, recvbuf, sizeof(recvbuf), 0, (struct sockaddr*)&peer, &fromlen);
-        if (len > 0) {
-            printf("Rcvd %d bytes from %s\n", len, inet_ntoa(peer.sin_addr));
-        }
-
-        sleep(1);
-    } while(true);
-
-    close(sfd);
-    return 0;
-}
-
-
-
-
-int main(int argc, char * argv[])
-{
-
-    if (argc < 5) {
-        printf("Usage: sendrecv <u|m> <ipAddr 192.168.1.107 | 224.0.1.187> <portnum 8888> <pkt_size 200>\n");
-        return -1;
-    }
-
-    if (argv[1][0] == 'u') {
-        unicast_test(argc, argv);
-    } else {
-        multicast_test(argc, argv);
-    }
-
-    return 0;
-}
diff --git a/resource/csdk/ocsocket/test/sendrecv_README.txt b/resource/csdk/ocsocket/test/sendrecv_README.txt
deleted file mode 100644 (file)
index 2c45530..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-sendrecv.cpp is a test application for verifying the end to end test for Arduino/Android platforms.
-To compile: 
-    g++ -o sendrecv sendrecv.cpp
index b9a88ff..9125b9f 100644 (file)
@@ -39,8 +39,7 @@ typedef struct ResourceObserver {
     CAToken_t token;
     // Resource handle
     OCResource *resource;
-    // IP address & port of client registered for observe
-    OCDevAddr *addr;
+    //TODO bundle it in Endpoint structure(address, uri, type, secured)
     /** Remote Endpoint address **/
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
@@ -77,7 +76,6 @@ OCStackResult AddObserver (const char         *resUri,
                            const char         *query,
                            OCObservationId    obsId,
                            CAToken_t          *token,
-                           OCDevAddr          *addr,
                            OCResource         *resHandle,
                            OCQualityOfService qos,
                            CAAddress_t          *addressInfo,
index bfa4511..beb63aa 100644 (file)
@@ -50,9 +50,6 @@ typedef struct OCServerRequest {
     CAAddress_t addressInfo;
     /** Connectivity of the endpoint**/
     CAConnectivityType_t connectivityType;
-    //////////////////////////////////////////////////////////
-    // IP address & port of client registered for observe   //These
-    OCDevAddr requesterAddr;                                //Members
     // token for the observe request
     CAToken_t requestToken;
     // The ID of CoAP pdu                                   //Kept in
@@ -93,7 +90,7 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         OCQualityOfService qos, unsigned char * query,
         OCHeaderOption * rcvdVendorSpecificHeaderOptions,
         unsigned char * reqJSONPayload, CAToken_t * requestToken,
-        OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize,
+        unsigned char * resourceUrl, size_t reqTotalSize,
         CAAddress_t *addressInfo, CAConnectivityType_t connectivityType);
 
 OCStackResult AddServerResponse (OCServerResponse ** response, OCRequestHandle requestHandle);
index bd44976..2952f01 100644 (file)
@@ -83,14 +83,15 @@ typedef struct {
     // An array of the received vendor specific header options
     uint8_t numRcvdVendorSpecificHeaderOptions;
     OCHeaderOption rcvdVendorSpecificHeaderOptions[MAX_HEADER_OPTIONS];
+
     /** Remote Endpoint address **/
-    CAAddress_t addressInfo;
-    /** Connectivity of the endpoint**/
-    CAConnectivityType_t connectivityType;
     //////////////////////////////////////////////////////////
     // TODO: Consider moving these member to CoAP
     // IP address & port of client registered for observe
-    OCDevAddr requesterAddr;
+    // TODO: YK bundle this up as endpoint
+    CAAddress_t addressInfo;
+    /** Connectivity of the endpoint**/
+    CAConnectivityType_t connectivityType;
 
     //token for the observe request
     CAToken_t requestToken;
index 2c5184e..0038ec8 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef OCSTACK_H_
 #define OCSTACK_H_
 
-#include "ocsocket.h"
+#include <stdint.h>
 #include "ocstackconfig.h"
 
 #ifdef __cplusplus
@@ -52,10 +52,26 @@ extern uint32_t PresenceTimeOut[];
 // Typedefs
 //-----------------------------------------------------------------------------
 
+/** This would need to be modified for specific platforms and specific
+ *  technologies
+ */
+#define DEV_ADDR_SIZE_MAX (16)
+
+/**
+ * Data structure to encapsulate IPv4/IPv6/Contiki/lwIP device addresses
+ *
+*/
+typedef struct OCDevAddr
+{
+    uint32_t     size;                    /**< length of the address stored in addr field. */
+    uint8_t      addr[DEV_ADDR_SIZE_MAX]; /**< device address. */
+}OCDevAddr;
+
 /**
  * OC Virtual resources supported by every OC device
  */
-typedef enum {
+typedef enum
+{
     OC_WELL_KNOWN_URI= 0,       // "/oc/core"
     OC_DEVICE_URI,              // "/oc/core/d"
     OC_RESOURCE_TYPES_URI,      // "/oc/core/d/type"
@@ -865,6 +881,41 @@ OCStackResult OCDoResponse(OCEntityHandlerResponse *response);
  */
 OCStackResult OCCancelResponse(OCResponseHandle responseHandle);
 
+//Utility methods
+
+//-- OCDevAddrToIPv4Addr -------------------------------------------------
+/**
+ * This method is used to retrieved the IPv4 address from OCDev address
+ * data structure.
+ *
+ * @param[in]  ipAddr
+ *              OCDevAddr address.
+ * @param[out]  a first byte of IPv4 address.
+ * @param[out]  b second byte of IPv4 address.
+ * @param[out]  c third byte of IPv4 address.
+ * @param[out]  d fourth byte of IPv4 address.
+ *
+ * @retval 0 for Success, otherwise some error value
+ */
+//------------------------------------------------------------------------
+int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
+            uint8_t *c, uint8_t *d );
+
+
+//-- OCDevAddrToPort -------------------------------------------------
+/**
+ * This method is used to retrieve the port number from OCDev address
+ * data structure.
+ *
+ * @param[in]  ipAddr
+ *              OCDevAddr address.
+ * @param[out] port
+ *              port number
+ *
+ * @retval 0 for Success, otherwise some error value
+ */
+//------------------------------------------------------------------------
+int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port);
 
 #ifdef __cplusplus
 }
index 0ee7095..a09112e 100644 (file)
@@ -5,7 +5,6 @@ arduino_simplecs_env = env.Clone()
 # Build flags
 ######################################################################
 arduino_simplecs_env.PrependUnique(CPPPATH = [
-               '../../../../../ocsocket/include',
                '../../../../../logger/include',
                '../../../../../stack/include',
                '../../../../../../oc_logger/include'
index a010c6f..fea42ba 100644 (file)
@@ -32,7 +32,6 @@ ROOT_DIR = ../../../../..
 LOGGER_DIR = $(ROOT_DIR)/logger
 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
 TBSTACK_DIR = $(ROOT_DIR)/stack
-TBSOCKET_DIR = $(ROOT_DIR)/ocsocket
 
 include $(ROOT_DIR)/local.properties
 include $(ROOT_DIR)/$(PLATFORM).properties
@@ -40,7 +39,6 @@ include $(ROOT_DIR)/$(PLATFORM).properties
 VPATH := $(SDIR_ARD_PLATFORM)
 
 #include directories
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
 LOGGER_DIR = $(ROOT_DIR)/logger
 STACK_DIR  = $(ROOT_DIR)/stack
 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include
index 8f4c731..edbc28b 100644 (file)
@@ -6,7 +6,6 @@ samples_env = env.Clone()
 # Build flags
 ######################################################################
 samples_env.PrependUnique(CPPPATH = [
-               '../../../../ocsocket/include',
                '../../../../logger/include',
                '../../../../stack/include',
                '../../../../ocmalloc/include',
index 2d36f1d..99b5ad8 100644 (file)
@@ -35,7 +35,6 @@ OUT_DIR       = .
 OCLOGGER_DIR   = $(ROOT_DIR)/logger
 OC_LOG_DIR     = $(ROOT_DIR)/../oc_logger
 OCRANDOM_DIR   = $(ROOT_DIR)/ocrandom
-OCSOCKET_DIR   = $(ROOT_DIR)/ocsocket
 OCMALLOC_DIR   = $(ROOT_DIR)/ocmalloc
 OCTBSTACK_DIR  = $(ROOT_DIR)/stack
 EXTLIBS_DIR    = $(ROOT_DIR)/../../extlibs
@@ -46,7 +45,6 @@ CJSON_SRC     = $(CJSON_DIR)
 OCLOGGER_INC   = $(OCLOGGER_DIR)/include
 OC_LOG_INC     = $(OC_LOG_DIR)/include
 OCRANDOM_INC   = $(OCRANDOM_DIR)/include
-OCSOCKET_INC   = $(OCSOCKET_DIR)/include
 OCMALLOC_INC   = $(OCMALLOC_DIR)/include
 OCTBSTACK_INC  = $(OCTBSTACK_DIR)/include
 CJSON_INC      = $(CJSON_DIR)
@@ -54,7 +52,6 @@ CJSON_INC     = $(CJSON_DIR)
 INC_DIRS       := -I$(OCLOGGER_INC)
 INC_DIRS       += -I$(OC_LOG_INC)
 INC_DIRS       += -I$(OCRANDOM_INC)
-INC_DIRS    += -I$(OCSOCKET_INC)
 INC_DIRS       += -I$(OCMALLOC_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)
 INC_DIRS       += -I$(CJSON_INC)
index 5413298..71d8d46 100644 (file)
@@ -495,6 +495,7 @@ int main(int argc, char* argv[])
     }
 
     OC_LOG(DEBUG, TAG, "OCServer is starting...");
+
     if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
     {
         OC_LOG(ERROR, TAG, "OCStack init error");
index 8cb23f6..451d3f5 100644 (file)
@@ -6,7 +6,6 @@ samples_env = env.Clone()
 # Build flags
 ######################################################################
 samples_env.PrependUnique(CPPPATH = [
-               '../../../../ocsocket/include',
                '../../../../logger/include',
                '../../../../stack/include',
                '../../../../security/include',
index 9388163..6b4cec4 100644 (file)
@@ -36,7 +36,6 @@ OUT_DIR       = .
 OCLOGGER_DIR   = $(ROOT_DIR)/logger
 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
 OCRANDOM_DIR   = $(ROOT_DIR)/ocrandom
-OCSOCKET_DIR   = $(ROOT_DIR)/ocsocket
 OCTBSTACK_DIR  = $(ROOT_DIR)/stack
 EXTLIBS_DIR    = $(ROOT_DIR)/../../extlibs
 CJSON_DIR      = $(EXTLIBS_DIR)/cjson
@@ -47,14 +46,12 @@ CONNECTIVITY_DIR= $(ROOT_DIR)/connectivity
 OCLOGGER_INC   = $(OCLOGGER_DIR)/include
 OC_LOG_INC     = $(OC_LOG_DIR)/include
 OCRANDOM_INC   = $(OCRANDOM_DIR)/include
-OCSOCKET_INC   = $(OCSOCKET_DIR)/include
 OCTBSTACK_INC  = $(OCTBSTACK_DIR)/include
 CJSON_INC      = $(CJSON_DIR)
 
 INC_DIRS       := -I$(OCLOGGER_INC)
 INC_DIRS       += -I$(OC_LOG_INC)
 INC_DIRS       += -I$(OCRANDOM_INC)
-INC_DIRS       += -I$(OCSOCKET_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)
 INC_DIRS       += -I$(CJSON_INC)
 
index 2abc9b2..0d5e9ea 100644 (file)
@@ -111,8 +111,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
                 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->token, resourceObserver->resUri, 0,
                         &(resourceObserver->addressInfo), resourceObserver->connectivityType);
 
                 if(request)
@@ -145,8 +144,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr,
                 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->token, resourceObserver->resUri, 0,
                         &(resourceObserver->addressInfo), resourceObserver->connectivityType);
 
                 if(result == OC_STACK_OK)
@@ -212,7 +210,7 @@ OCStackResult SendListObserverNotification (OCResource * resource,
                 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->resUri, 0,
                         &(observation->addressInfo), observation->connectivityType);
 
                 if(request)
@@ -293,7 +291,6 @@ OCStackResult AddObserver (const char         *resUri,
                            const char         *query,
                            OCObservationId    obsId,
                            CAToken_t          *token,
-                           OCDevAddr          *addr,
                            OCResource         *resHandle,
                            OCQualityOfService qos,
                            CAAddress_t          *addressInfo,
@@ -323,9 +320,6 @@ OCStackResult AddObserver (const char         *resUri,
         memset(obsNode->token, 0, CA_MAX_TOKEN_LEN + 1);
         memcpy(obsNode->token, *token, CA_MAX_TOKEN_LEN);
 
-        obsNode->addr = (OCDevAddr *)OCMalloc(sizeof(OCDevAddr));
-        VERIFY_NON_NULL (obsNode->addr);
-        memcpy (obsNode->addr, addr, sizeof(OCDevAddr));
         obsNode->addressInfo = *addressInfo;
         obsNode->connectivityType = connectivityType;
         obsNode->resource = resHandle;
@@ -338,7 +332,6 @@ exit:
     {
         OCFree(obsNode->resUri);
         OCFree(obsNode->query);
-        OCFree(obsNode->addr);
         OCFree(obsNode);
     }
     return OC_STACK_NO_MEMORY;
@@ -395,7 +388,6 @@ OCStackResult DeleteObserverUsingToken (CAToken_t * token)
         LL_DELETE (serverObsList, obsNode);
         OCFree(obsNode->resUri);
         OCFree(obsNode->query);
-        OCFree(obsNode->addr);
         OCFree(obsNode);
     }
     // it is ok if we did not find the observer...
index 4c82788..a4d735c 100644 (file)
@@ -662,7 +662,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request,
         result = AddObserver ((const char*)(request->resourceUrl),
                 (const char *)(request->query),
                 ehRequest.obsInfo.obsId, &request->requestToken,
-                &request->requesterAddr, resource, request->qos,
+                resource, request->qos,
                 &request->addressInfo, request->connectivityType);
         if(result == OC_STACK_OK)
         {
index de93f30..1d82d2e 100644 (file)
@@ -89,7 +89,7 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         OCQualityOfService qos, unsigned char * query,
         OCHeaderOption * rcvdVendorSpecificHeaderOptions,
         unsigned char * reqJSONPayload, CAToken_t * requestToken,
-        OCDevAddr * requesterAddr, unsigned char * resourceUrl, size_t reqTotalSize,
+        unsigned char * resourceUrl, size_t reqTotalSize,
         CAAddress_t *addressInfo, CAConnectivityType_t connectivityType)
 {
     OCServerRequest * serverRequest = NULL;
@@ -112,10 +112,13 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
     serverRequest->qos = qos;
     serverRequest->ehResponseHandler = HandleSingleResponse;
     serverRequest->numResponses = 1;
+
     if(query)
     {
-        memcpy(serverRequest->query, query, strlen((const char *)query) + 1);
+        strncpy((char*)serverRequest->query,
+                (const char*)query, sizeof(serverRequest->query) - 1);
     }
+
     if(rcvdVendorSpecificHeaderOptions)
     {
         memcpy(serverRequest->rcvdVendorSpecificHeaderOptions, rcvdVendorSpecificHeaderOptions,
@@ -136,14 +139,13 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID,
         memset(serverRequest->requestToken, 0, CA_MAX_TOKEN_LEN + 1);
         memcpy(serverRequest->requestToken, *requestToken, CA_MAX_TOKEN_LEN);
     }
-    if(requesterAddr)
-    {
-        memcpy(&serverRequest->requesterAddr, requesterAddr, sizeof(OCDevAddr));
-    }
+
     if(resourceUrl)
     {
-        memcpy(serverRequest->resourceUrl, resourceUrl, strlen((const char *)resourceUrl) + 1);
+        strncpy((char*)serverRequest->resourceUrl,
+                (const char*)resourceUrl, sizeof(serverRequest->resourceUrl) - 1);
     }
+
     if (addressInfo)
     {
         serverRequest->addressInfo = *addressInfo;
index 868a87a..da84aa0 100644 (file)
@@ -52,6 +52,7 @@
 #include <arpa/inet.h>
 #endif
 
+
 //-----------------------------------------------------------------------------
 // Typedefs
 //-----------------------------------------------------------------------------
@@ -131,6 +132,26 @@ static OCStackResult FormOCResponse(OCResponse * * responseLoc,
     return OC_STACK_OK;
 }
 
+/// This method is used to create the IPv4 dev_addr structure.
+/// TODO: Remove in future. Temporary helper function.
+/// Builds a socket interface address using IP address and port number
+static int32_t OCBuildIPv4Address(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
+        uint16_t port, OCDevAddr *ipAddr)
+{
+    if ( !ipAddr ) {
+        OC_LOG(FATAL, TAG, "Invalid argument");
+        return 1;
+    }
+
+    ipAddr->addr[0] = a;
+    ipAddr->addr[1] = b;
+    ipAddr->addr[2] = c;
+    ipAddr->addr[3] = d;
+    *((uint16_t*)&(ipAddr->addr[4])) = port;
+
+    return 0;
+}
+
 //-----------------------------------------------------------------------------
 // Internal API function
 //-----------------------------------------------------------------------------
@@ -873,8 +894,7 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest)
                 protocolRequest->observationOption, protocolRequest->qos,
                 protocolRequest->query, protocolRequest->rcvdVendorSpecificHeaderOptions,
                 protocolRequest->reqJSONPayload, &protocolRequest->requestToken,
-                &protocolRequest->requesterAddr, protocolRequest->resourceUrl,
-                protocolRequest->reqTotalSize,
+                protocolRequest->resourceUrl,protocolRequest->reqTotalSize,
                 &protocolRequest->addressInfo, protocolRequest->connectivityType);
         if (OC_STACK_OK != result)
         {
@@ -2069,11 +2089,8 @@ OCStackResult OCStartPresence(const uint32_t ttl)
 
     if(OC_PRESENCE_UNINITIALIZED == presenceState)
     {
-        OCDevAddr multiCastAddr;
         presenceState = OC_PRESENCE_INITIALIZED;
 
-        OCBuildIPv4Address(224, 0, 1, 187, 5683, &multiCastAddr);
-
         CAAddress_t addressInfo;
         strncpy(addressInfo.IP.ipAddress, "224.0.1.187", CA_IPADDR_SIZE);
         addressInfo.IP.port = 5683;
@@ -2090,7 +2107,7 @@ OCStackResult OCStartPresence(const uint32_t ttl)
         }
 
         AddObserver(OC_PRESENCE_URI, NULL, 0, &caToken,
-                &multiCastAddr, (OCResource *)presenceResource.handle, OC_LOW_QOS,
+                (OCResource *)presenceResource.handle, OC_LOW_QOS,
                 &addressInfo, CA_WIFI);
     }
 
@@ -3681,3 +3698,35 @@ const char* OCGetServerInstanceIDString(void)
 
     return buffer;
 }
+
+/// Retrieve the IPv4 address embedded inside OCDev address data structure
+int32_t OCDevAddrToIPv4Addr(OCDevAddr *ipAddr, uint8_t *a, uint8_t *b,
+        uint8_t *c, uint8_t *d )
+{
+    if ( !ipAddr || !a || !b || !c || !d ) {
+        OC_LOG(FATAL, TAG, "Invalid argument");
+        return OC_STACK_INVALID_PARAM;
+    }
+
+    *a = ipAddr->addr[0];
+    *b = ipAddr->addr[1];
+    *c = ipAddr->addr[2];
+    *d = ipAddr->addr[3];
+
+    return OC_STACK_OK;
+}
+
+
+/// Retrieve the IPv4 address embedded inside OCDev address data structure
+int32_t OCDevAddrToPort(OCDevAddr *ipAddr, uint16_t *port)
+{
+    if ( !ipAddr || !port ) {
+        OC_LOG(FATAL, TAG, "Invalid argument");
+        return OC_STACK_INVALID_PARAM;
+    }
+
+    *port = *((uint16_t*)&ipAddr->addr[4]);
+
+    return OC_STACK_OK;
+}
+
index ff6825c..2f0d389 100644 (file)
@@ -23,7 +23,6 @@ PLATFORM := arduinomega
 
 ROOT_DIR = ../../..
 include $(ROOT_DIR)/local.properties
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
 LOGGER_DIR = $(ROOT_DIR)/logger
 RANDOM_DIR = $(ROOT_DIR)/ocrandom
 JSON_DIR = $(ROOT_DIR)/../../extlibs/cjson
index 43ebff7..d3861d6 100644 (file)
@@ -28,7 +28,6 @@ BUILD  := release
 PLATFORM=linux
 
 ROOT_DIR = ../../..
-OCSOCK_DIR = $(ROOT_DIR)/ocsocket
 OCSTACK_DIR = $(ROOT_DIR)/stack
 LOGGER_DIR = $(ROOT_DIR)/logger
 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
index 08b6a32..493b34e 100644 (file)
@@ -47,19 +47,16 @@ OUT_DIR       := $(PWD)
 LOGGER_DIR     = $(ROOT_DIR)/logger
 OC_LOG_DIR      = $(ROOT_DIR)/../oc_logger
 OCRANDOM_DIR   = $(ROOT_DIR)/ocrandom
-OCSOCKET_DIR   = $(ROOT_DIR)/ocsocket
 OCTBSTACK_DIR  = $(ROOT_DIR)/stack
 
 LOGGER_INC     = $(LOGGER_DIR)/include
 OC_LOG_INC     = $(OC_LOG_DIR)/include
 OCRANDOM_INC   = $(OCRANDOM_DIR)/include
-OCSOCKET_INC   = $(OCSOCKET_DIR)/include
 OCTBSTACK_INC  = $(OCTBSTACK_DIR)/include
 
 INC_DIRS       := -I$(LOGGER_INC)
 INC_DIRS       += -I$(OC_LOG_INC)
 INC_DIRS       += -I$(OCRANDOM_INC)
-INC_DIRS       += -I$(OCSOCKET_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)
 INC_DIRS       += -I$(OCTBSTACK_INC)/internal
 INC_DIRS       += -I$(GTEST_DIR)/include
index 6e1f4a7..d52f212 100644 (file)
@@ -14,7 +14,6 @@ examples_env = lib_env.Clone()
 examples_env.AppendUnique(CPPPATH = [
                '../include/',
                '../csdk/stack/include',
-               '../csdk/ocsocket/include',
                '../csdk/ocrandom/include',
                '../csdk/logger/include',
                '../oc_logger/include'
index 48b0ce5..c222bc2 100644 (file)
@@ -34,7 +34,6 @@ CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
 CXX_INC          := -I../include/
 CXX_INC   += -I../oc_logger/include
 CXX_INC          += -I../csdk/stack/include
-CXX_INC          += -I../csdk/ocsocket/include
 CXX_INC          += -I../csdk/ocrandom/include
 CXX_INC          += -I../csdk/logger/include
 
index 272fa29..6f9f541 100644 (file)
@@ -201,9 +201,7 @@ namespace OC
         private:
             std::string ConvertOCAddrToString(OCSecureType sec, int secureport)
             {
-                char stringAddress[DEV_ADDR_SIZE_MAX];
                 uint16_t port;
-
                 ostringstream os;
 
                 if(sec== OCSecureType::IPv4)
@@ -220,18 +218,19 @@ namespace OC
                     throw ResourceInitException(false, false, false, false, false, true);
                 }
 
-                if(0== OCDevAddrToString(&m_address, stringAddress))
-                {
-                    // nothing to do, successful case.
-                }
-                else
+                uint8_t a;
+                uint8_t b;
+                uint8_t c;
+                uint8_t d;
+                if(OCDevAddrToIPv4Addr(&m_address, &a, &b, &c, &d) != 0)
                 {
                     oclog() << "ConvertOCAddrToString(): Invalid Ip"
                             << std::flush;
                     throw ResourceInitException(false, false, false, false, false, true);
                 }
 
-                os<<stringAddress;
+                os<<static_cast<int>(a)<<"."<<static_cast<int>(b)
+                        <<"."<<static_cast<int>(c)<<"."<<static_cast<int>(d);
 
                 if(sec == OCSecureType::IPv4Secure && secureport>0 && secureport<=65535)
                 {
index d3fe9d1..fa22f75 100644 (file)
@@ -45,7 +45,6 @@ CXX_INC         := -I./include/
 CXX_INC          += -I./oc_logger/include
 
 CXX_INC          += -I./csdk/stack/include
-CXX_INC          += -I./csdk/ocsocket/include
 CXX_INC          += -I./csdk/ocrandom/include
 CXX_INC          += -I./csdk/logger/include
 CXX_INC   += -I./csdk/connectivity/lib/libcoap-4.1.1
index ed57571..bab1646 100644 (file)
@@ -35,7 +35,6 @@ OUT_DIR       = ./
 OCLOGGER_DIR   = $(ROOT_DIR)/logger
 OC_LOG_DIR             = $(ROOT_DIR)/../oc_logger
 OCRANDOM_DIR   = $(ROOT_DIR)/ocrandom
-OCSOCKET_DIR   = $(ROOT_DIR)/ocsocket
 OCTBSTACK_DIR  = $(ROOT_DIR)/stack
 
 OC_LOG_INC             = $(OC_LOG_DIR)/include
@@ -43,13 +42,11 @@ OC_LOG_LIB          = $(OC_LOG_DIR)/lib/oc_logger.a
 
 OCLOGGER_INC   = $(OCLOGGER_DIR)/include
 OCRANDOM_INC   = $(OCRANDOM_DIR)/include
-OCSOCKET_INC   = $(OCSOCKET_DIR)/include
 OCTBSTACK_INC  = $(OCTBSTACK_DIR)/include
 
 INC_DIRS               := -I$(OCLOGGER_INC)
 INC_DIRS               += -I$(OC_LOG_INC)
 INC_DIRS               += -I$(OCRANDOM_INC)
-INC_DIRS               += -I$(OCSOCKET_INC)
 INC_DIRS               += -I$(OCTBSTACK_INC)
 
 CC_FLAGS.debug      := -O0 -g3 -Wall -ffunction-sections -fdata-sections \
index 97fe351..339875c 100644 (file)
@@ -699,14 +699,18 @@ namespace OC
     OCStackApplicationResult subscribePresenceCallback(void* ctx, OCDoHandle handle,
             OCClientResponse* clientResponse)
     {
-        char stringAddress[DEV_ADDR_SIZE_MAX];
         ostringstream os;
         uint16_t port;
+        uint8_t a;
+        uint8_t b;
+        uint8_t c;
+        uint8_t d;
 
-        if(OCDevAddrToString(clientResponse->addr, stringAddress) == 0 &&
+        if(OCDevAddrToIPv4Addr(clientResponse->addr, &a, &b, &c, &d) == 0 &&
                 OCDevAddrToPort(clientResponse->addr, &port) == 0)
         {
-            os<<stringAddress<<":"<<port;
+            os<<static_cast<int>(a)<<"."<<static_cast<int>(b)<<"."<<static_cast<int>(c)
+                    <<"."<<static_cast<int>(d)<<":"<<static_cast<int>(port);
 
             ClientCallbackContext::SubscribePresenceContext* context =
                 static_cast<ClientCallbackContext::SubscribePresenceContext*>(ctx);
@@ -718,7 +722,7 @@ namespace OC
         }
         else
         {
-            oclog() << "subscribePresenceCallback(): OCDevAddrToString() or OCDevAddrToPort() "
+            oclog() << "subscribePresenceCallback(): OCDevAddrToIPv4Addr() or OCDevAddrToPort() "
                     <<"failed"<< std::flush;
         }
         return OC_STACK_KEEP_TRANSACTION;
index e1fe712..e76c4e4 100644 (file)
@@ -14,7 +14,6 @@ oclib_env = lib_env.Clone()
 oclib_env.AppendUnique(CPPPATH = [
                '../include/',
                '../csdk/stack/include',
-               '../csdk/ocsocket/include',
                '../csdk/ocrandom/include',
                '../csdk/logger/include',
                '../oc_logger/include',
index 7b38234..5be263d 100644 (file)
@@ -40,7 +40,6 @@ CONNECTIVITY_DIR= $(ROOT_DIR)/../csdk/connectivity
 INC_DIRS  := -I../include/
 INC_DIRS  += -I../oc_logger/include
 INC_DIRS  += -I../csdk/stack/include
-INC_DIRS  += -I../csdk/ocsocket/include
 INC_DIRS  += -I../csdk/ocrandom/include
 INC_DIRS  += -I../csdk/logger/include
 INC_DIRS  += -I$(GTEST_DIR)/include
index d1e9288..26aa592 100644 (file)
@@ -3,7 +3,6 @@ VPATH = ../../src:../../src/linux:../../../SampleApp/linux/sampleConsumer:../../
 OCPATH = ../../../../../resource
 OCINCLUDE = $(OCPATH)/include
 STACKINCLUDE = $(OCPATH)/csdk/stack/include
-SOCKETINCLUDE = $(OCPATH)/csdk/ocsocket/include
 OCLOGGERINCLUDE = $(OCPATH)/oc_logger/include
 NOTIFICATIONINCLUDE = ../../include
 BOOSTPATH = ../../../../../boost_1_51_0
index 3fa2393..2e33a43 100644 (file)
@@ -4,7 +4,6 @@ SET(NOTI_BASE_DIR "${BASE_SRC_DIR}/notification-manager")
 
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/oic)
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/oic/stack)
-INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/oic/ocsocket)
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
 INCLUDE_DIRECTORIES(${NOTI_BASE_DIR}/NotificationManager/include)
 
index d40b1d1..0babef2 100644 (file)
@@ -12,7 +12,6 @@ DEPEND_DIR:= $(LIB_DIR)/dependencies
 CXX_INC := -I$(LIB_DIR)/include/
 CXX_INC += -I$(LIB_DIR)/oc_logger/include/
 CXX_INC += -I$(LIB_DIR)/csdk/stack/include/
-CXX_INC += -I$(LIB_DIR)/csdk/ocsocket/include/
 CXX_INC += -I$(LIB_DIR)/csdk/ocrandom/include/
 CXX_INC += -I$(LIB_DIR)/csdk/logger/include/
 CXX_INC += -I$(BOOST_DIR)
index d7e7b4e..dbce34a 100644 (file)
@@ -12,7 +12,6 @@ DEPEND_DIR:= $(LIB_DIR)/dependencies
 CXX_INC := -I$(LIB_DIR)/include/
 CXX_INC += -I$(LIB_DIR)/oc_logger/include/
 CXX_INC += -I$(LIB_DIR)/csdk/stack/include/
-CXX_INC += -I$(LIB_DIR)/csdk/ocsocket/include/
 CXX_INC += -I$(LIB_DIR)/csdk/ocrandom/include/
 CXX_INC += -I$(LIB_DIR)/csdk/logger/include/
 CXX_INC += -I$(BOOST_DIR)
index fbce338..4ac7799 100644 (file)
@@ -10,7 +10,6 @@ DEPEND_DIR:= $(LIB_DIR)/dependencies
 CXX_INC := -I$(LIB_DIR)/include/
 CXX_INC += -I$(LIB_DIR)/oc_logger/include/
 CXX_INC += -I$(LIB_DIR)/csdk/stack/include/
-CXX_INC += -I$(LIB_DIR)/csdk/ocsocket/include/
 CXX_INC += -I$(LIB_DIR)/csdk/ocrandom/include/
 CXX_INC += -I$(LIB_DIR)/csdk/logger/include/
 CXX_INC += -I$(BOOST_DIR)
index 8cf72ba..9711461 100644 (file)
@@ -13,7 +13,7 @@ EXCLUDE_LIST=SSMCore_JNI.cpp
 # C++ type Compile Flag define.
 CXX=g++
 CXX_FLAGS=-std=c++0x -Wall -pthread -DLINUX -ldl -DNDEBUG
-CXX_INC=-I${INC_PATH}/ -I${SRC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${INC_PATH}/ -I${SRC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include  -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
 CXX_LIB=-L""
 
 CXX_SRCPATH=${wildcard ${SRC_PATH}/**/*.cpp}
@@ -25,7 +25,7 @@ CXX_OBJLIST=${CXX_USESRCS:.cpp=.o}
 # C type Compile Flag define.
 GCC=gcc
 GCC_FLAGS=-Wall -pthread -DLINUX -ldl -DNDEBUG
-GCC_INC=-I../../ -I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST} -I${SRC_PATH} -I${SRC_PATH}/Common -I${SRC_PATH}/QueryProcessor -I${SRC_PATH}/SensorProcessor -I${SRC_PATH}/SSMInterface
+GCC_INC=-I../../ -I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST} -I${SRC_PATH} -I${SRC_PATH}/Common -I${SRC_PATH}/QueryProcessor -I${SRC_PATH}/SensorProcessor -I${SRC_PATH}/SSMInterface
 
 GCC_SRCPATH=${wildcard ${SRC_PATH}/**/*.c}
 GCC_SRCLIST=${notdir ${GCC_SRCPATH}}
index 4abd7ec..edb5136 100644 (file)
@@ -19,7 +19,6 @@ TB_DIR = ../../../../../../resource/csdk
 LOGGER_DIR = $(TB_DIR)/logger
 OC_LOG_DIR = $(TB_DIR)/../oc_logger
 TBSTACK_DIR = $(TB_DIR)/stack
-TBSOCKET_DIR = $(TB_DIR)/ocsocket
 
 include $(TB_DIR)/local.properties
 include $(TB_DIR)/$(PLATFORM).properties
@@ -27,7 +26,6 @@ include $(TB_DIR)/$(PLATFORM).properties
 VPATH := $(SDIR_ARD_PLATFORM)
 
 #include directories
-OCSOCK_DIR = $(TB_DIR)/ocsocket
 LOGGER_DIR = $(TB_DIR)/logger
 STACK_DIR  = $(TB_DIR)/stack
 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include -I../include
index e3203bc..39a6e69 100644 (file)
@@ -15,7 +15,6 @@ TB_DIR = ../../../../../../resource/csdk
 LOGGER_DIR = $(TB_DIR)/logger
 OC_LOG_DIR = $(TB_DIR)/../oc_logger
 TBSTACK_DIR = $(TB_DIR)/stack
-TBSOCKET_DIR = $(TB_DIR)/ocsocket
 
 include $(TB_DIR)/local.properties
 include $(TB_DIR)/$(PLATFORM).properties
@@ -23,7 +22,6 @@ include $(TB_DIR)/$(PLATFORM).properties
 VPATH := $(SDIR_ARD_PLATFORM)
 
 #include directories
-OCSOCK_DIR = $(TB_DIR)/ocsocket
 LOGGER_DIR = $(TB_DIR)/logger
 STACK_DIR  = $(TB_DIR)/stack
 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include
index e3203bc..39a6e69 100644 (file)
@@ -15,7 +15,6 @@ TB_DIR = ../../../../../../resource/csdk
 LOGGER_DIR = $(TB_DIR)/logger
 OC_LOG_DIR = $(TB_DIR)/../oc_logger
 TBSTACK_DIR = $(TB_DIR)/stack
-TBSOCKET_DIR = $(TB_DIR)/ocsocket
 
 include $(TB_DIR)/local.properties
 include $(TB_DIR)/$(PLATFORM).properties
@@ -23,7 +22,6 @@ include $(TB_DIR)/$(PLATFORM).properties
 VPATH := $(SDIR_ARD_PLATFORM)
 
 #include directories
-OCSOCK_DIR = $(TB_DIR)/ocsocket
 LOGGER_DIR = $(TB_DIR)/logger
 STACK_DIR  = $(TB_DIR)/stack
 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include
index 9f79050..df83b96 100644 (file)
@@ -19,7 +19,6 @@ TB_DIR = ../../../../../../resource/csdk
 LOGGER_DIR = $(TB_DIR)/logger
 OC_LOG_DIR = $(TB_DIR)/../oc_logger
 TBSTACK_DIR = $(TB_DIR)/stack
-TBSOCKET_DIR = $(TB_DIR)/ocsocket
 
 include $(TB_DIR)/local.properties
 include $(TB_DIR)/$(PLATFORM).properties
@@ -27,7 +26,6 @@ include $(TB_DIR)/$(PLATFORM).properties
 VPATH := $(SDIR_ARD_PLATFORM)
 
 #include directories
-OCSOCK_DIR = $(TB_DIR)/ocsocket
 LOGGER_DIR = $(TB_DIR)/logger
 STACK_DIR  = $(TB_DIR)/stack
 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(OC_LOG_DIR)/include -I$(LOGGER_DIR)/include -I$(STACK_DIR)/include -I../include
index 28802e8..f2da903 100644 (file)
@@ -11,7 +11,7 @@ TARGET=THSensorApp
 
 CXX=g++
 CXX_FLAGS=-std=c++0x -Wall -DLINUX
-CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
 
 CXX_LIB+=${IOT_RELEASE}/${IOT_LIB}
 CXX_LIB+=${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB} 
index a195f01..5b449aa 100644 (file)
@@ -11,7 +11,7 @@ TARGET=THSensorApp1
 
 CXX=g++
 CXX_FLAGS=-std=c++0x -Wall -DLINUX
-CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
 
 CXX_LIB+=${IOT_RELEASE}/${IOT_LIB}
 CXX_LIB+=${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB} 
index 7aa6d40..7ec7d7e 100644 (file)
@@ -10,7 +10,6 @@ SET(CMAKE_EXE_LINKER_FLAGS " -Wl,--as-needed -Wl,--hash-style=both")
 
 #INCLUDE_DIRECTORIES(include)
 #INCLUDE_DIRECTORIES(csdk/stack/include)
-#INCLUDE_DIRECTORIES(csdk/ocsocket/include)
 #INCLUDE_DIRECTORIES(csdk/ocrandom/include)
 #INCLUDE_DIRECTORIES(csdk/logger/include)
 #INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
index 85ece27..118d960 100644 (file)
@@ -13,7 +13,6 @@ CXX_FLAGS.release   := -std=c++0x -Wall -pthread
 
 CXX_INC          := -I./include/
 CXX_INC          += -I./csdk/stack/include
-CXX_INC          += -I./csdk/ocsocket/include
 CXX_INC          += -I./csdk/ocrandom/include
 CXX_INC          += -I./csdk/logger/include
 CXX_INC   += -I/usr/local/boost_1_51_0
index 89b15b8..cb0c214 100644 (file)
@@ -5,7 +5,6 @@ SET(SS_SAMPLE_SSMCLIENT_PATH, "${SS_SAMPLE_PATH}/ClientApp");
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/stack/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocsocket/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocrandom/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/logger/include)
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
index d74f5a5..86c8d89 100644 (file)
@@ -5,7 +5,6 @@ SET(SS_SAMPLE_THSEN_PATH, "${SS_SAMPLE_PATH}/THSensorApp");
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/stack/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocsocket/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocrandom/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/logger/include)
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
index d1909c9..192b8e1 100644 (file)
@@ -5,7 +5,6 @@ SET(SS_SAMPLE_THSEN1_PATH, "${SS_SAMPLE_PATH}/THSensorApp1");
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/stack/include)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocsocket/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/ocrandom/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/resource/csdk/logger/include)
 INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
index e0eb57c..32251dd 100644 (file)
@@ -14,10 +14,9 @@ CXX_FLAGS=-std=c++0x -Wall -pthread -DLINUX -ldl
 
 CXX_INC        := -I../../ -I../../inc/ -I../../../sdk/inc/ -I../../../sdk/src/
 CXX_INC        += -I${IOT_BASE}/include/
-CXX_INC        += -I${IOT_BASE}/oc_logger/include
+CXX_INC += -I${IOT_BASE}/oc_logger/include
 CXX_INC        += -I${IOT_BASE}/csdk/stack/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocsocket/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocrandom/include
+CXX_INC += -I${IOT_BASE}/csdk/ocrandom/include
 CXX_INC        += -I${IOT_BASE}/csdk/logger/include
 
 CXX_LIB=-L""
index bddcbe4..985df04 100644 (file)
@@ -15,7 +15,6 @@ CXX_INC       := -I../../ -I../../inc/
 CXX_INC        += -I${IOT_BASE}/include/
 CXX_INC        += -I${IOT_BASE}/oc_logger/include
 CXX_INC        += -I${IOT_BASE}/csdk/stack/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocsocket/include
 CXX_INC        += -I${IOT_BASE}/csdk/ocrandom/include
 CXX_INC        += -I${IOT_BASE}/csdk/logger/include
 CXX_INC        += -I../../../sdk/inc
index b0b767c..0a194cc 100644 (file)
@@ -16,8 +16,7 @@ CXX_INC       := -I../../ -I../../inc/ -I../../../sdk/inc/ -I../../../sdk/src/
 CXX_INC        += -I${IOT_BASE}/include/
 CXX_INC += -I${IOT_BASE}/oc_logger/include
 CXX_INC        += -I${IOT_BASE}/csdk/stack/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocsocket/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocrandom/include
+CXX_INC += -I${IOT_BASE}/csdk/ocrandom/include
 CXX_INC        += -I${IOT_BASE}/csdk/logger/include
 
 CXX_LIB=-L""
index f00a51e..96e8e10 100644 (file)
@@ -19,7 +19,6 @@ CXX_INC       := -I../../ -I../../inc/ -I../../src/
 CXX_INC        += -I${IOT_BASE}/include/
 CXX_INC += -I${IOT_BASE}/oc_logger/include
 CXX_INC        += -I${IOT_BASE}/csdk/stack/include
-CXX_INC        += -I${IOT_BASE}/csdk/ocsocket/include
 CXX_INC        += -I${IOT_BASE}/csdk/ocrandom/include
 CXX_INC        += -I${IOT_BASE}/csdk/logger/include
 
index ac543d2..f979c89 100644 (file)
@@ -47,7 +47,6 @@ lib_env.AppendUnique(CPPPATH = [
                resource_path + '/include' ,
                resource_path + '/oc_logger/include',
                resource_path + '/csdk/stack/include',
-               resource_path + '/csdk/ocsocket/include',
                resource_path + '/csdk/ocrandom/include',
                resource_path + '/csdk/logger/include'
                ])