summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/OICMiddle/SConscript1
-rw-r--r--examples/OICMiddle/makefile6
-rw-r--r--examples/OICSensorBoard/SConstruct2
-rw-r--r--resource/csdk/SConscript2
-rw-r--r--resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak2
-rw-r--r--resource/csdk/makefile15
-rw-r--r--resource/csdk/ocmalloc/test/linux/makefile3
-rw-r--r--resource/csdk/ocsocket/README.txt28
-rw-r--r--resource/csdk/ocsocket/include/ocsocket.h274
-rw-r--r--resource/csdk/ocsocket/src/ocsocket.c253
-rw-r--r--resource/csdk/ocsocket/src/ocsocket_arduino.c199
-rw-r--r--resource/csdk/ocsocket/src/ocsocket_arduino_wifi.c273
-rw-r--r--resource/csdk/ocsocket/test/android/makefile70
-rw-r--r--resource/csdk/ocsocket/test/android/ocsocket_gtest.cpp243
-rw-r--r--resource/csdk/ocsocket/test/arduino/makefile104
-rw-r--r--resource/csdk/ocsocket/test/arduino/ocsocket_test.cpp285
-rw-r--r--resource/csdk/ocsocket/test/arduino/ocsocket_wifi_test.cpp204
-rw-r--r--resource/csdk/ocsocket/test/linux/makefile65
-rw-r--r--resource/csdk/ocsocket/test/linux/ocsocket_gtest.cpp271
-rw-r--r--resource/csdk/ocsocket/test/makefile36
-rw-r--r--resource/csdk/ocsocket/test/sendrecv.cpp226
-rw-r--r--resource/csdk/ocsocket/test/sendrecv_README.txt3
-rw-r--r--resource/csdk/stack/include/internal/ocobserve.h4
-rw-r--r--resource/csdk/stack/include/internal/ocserverrequest.h5
-rw-r--r--resource/csdk/stack/include/internal/ocstackinternal.h9
-rw-r--r--resource/csdk/stack/include/ocstack.h55
-rw-r--r--resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript1
-rw-r--r--resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile2
-rw-r--r--resource/csdk/stack/samples/linux/SimpleClientServer/SConscript1
-rw-r--r--resource/csdk/stack/samples/linux/SimpleClientServer/makefile3
-rw-r--r--resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp1
-rw-r--r--resource/csdk/stack/samples/linux/secure/SConscript1
-rw-r--r--resource/csdk/stack/samples/linux/secure/makefile3
-rw-r--r--resource/csdk/stack/src/ocobserve.c14
-rw-r--r--resource/csdk/stack/src/ocresource.c2
-rw-r--r--resource/csdk/stack/src/ocserverrequest.c16
-rw-r--r--resource/csdk/stack/src/ocstack.c61
-rw-r--r--resource/csdk/stack/test/arduino/makefile1
-rw-r--r--resource/csdk/stack/test/linux/makefile1
-rw-r--r--resource/csdk/stack/test/makefile3
-rw-r--r--resource/examples/SConscript1
-rw-r--r--resource/examples/makefile1
-rw-r--r--resource/include/OCSerialization.h15
-rw-r--r--resource/makefile1
-rw-r--r--resource/oc_logger/samples/linux/makefile3
-rw-r--r--resource/src/InProcClientWrapper.cpp12
-rw-r--r--resource/src/SConscript1
-rw-r--r--resource/unittests/makefile1
-rw-r--r--service/notification-manager/NotificationManager/build/linux/Makefile1
-rw-r--r--service/notification-manager/build/tizen/CMakeLists.txt1
-rw-r--r--service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile1
-rw-r--r--service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile1
-rw-r--r--service/protocol-plugin/sample-app/linux/mqtt/Makefile1
-rw-r--r--service/soft-sensor-manager/SSMCore/build/linux/Makefile4
-rw-r--r--service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile2
-rw-r--r--service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt1
-rw-r--r--service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org1
-rw-r--r--service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt1
-rw-r--r--service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt1
-rw-r--r--service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt1
-rw-r--r--service/things-manager/sampleapp/linux/configuration/makefile5
-rw-r--r--service/things-manager/sampleapp/linux/groupaction/makefile1
-rw-r--r--service/things-manager/sampleapp/linux/groupsyncaction/makefile3
-rw-r--r--service/things-manager/sdk/build/linux/Makefile1
-rw-r--r--service/third_party_libs.scons1
70 files changed, 154 insertions, 2666 deletions
diff --git a/examples/OICMiddle/SConscript b/examples/OICMiddle/SConscript
index 9feaaf001..db55684a6 100644
--- a/examples/OICMiddle/SConscript
+++ b/examples/OICMiddle/SConscript
@@ -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'
diff --git a/examples/OICMiddle/makefile b/examples/OICMiddle/makefile
index 7b3960579..1a034bb05 100644
--- a/examples/OICMiddle/makefile
+++ b/examples/OICMiddle/makefile
@@ -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
diff --git a/examples/OICSensorBoard/SConstruct b/examples/OICSensorBoard/SConstruct
index e9acb2d8e..8a4ef04dd 100644
--- a/examples/OICSensorBoard/SConstruct
+++ b/examples/OICSensorBoard/SConstruct
@@ -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:
diff --git a/resource/csdk/SConscript b/resource/csdk/SConscript
index 6067d13b8..1466f7207 100644
--- a/resource/csdk/SConscript
+++ b/resource/csdk/SConscript
@@ -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'
diff --git a/resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak b/resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak
index 7e3a3693e..e12a01e69 100644
--- a/resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak
+++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/makefile_arduino.mak
@@ -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))
diff --git a/resource/csdk/makefile b/resource/csdk/makefile
index 727be87f8..24363bbd8 100644
--- a/resource/csdk/makefile
+++ b/resource/csdk/makefile
@@ -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)
diff --git a/resource/csdk/ocmalloc/test/linux/makefile b/resource/csdk/ocmalloc/test/linux/makefile
index 2529d1285..fad040120 100644
--- a/resource/csdk/ocmalloc/test/linux/makefile
+++ b/resource/csdk/ocmalloc/test/linux/makefile
@@ -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
index 61dc001f9..000000000
--- a/resource/csdk/ocsocket/README.txt
+++ /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
index af4ab3183..000000000
--- a/resource/csdk/ocsocket/include/ocsocket.h
+++ /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
index ecf61b852..000000000
--- a/resource/csdk/ocsocket/src/ocsocket.c
+++ /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
index c85a828cc..000000000
--- a/resource/csdk/ocsocket/src/ocsocket_arduino.c
+++ /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
index 497ef26fd..000000000
--- a/resource/csdk/ocsocket/src/ocsocket_arduino_wifi.c
+++ /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
index f68574ddb..000000000
--- a/resource/csdk/ocsocket/test/android/makefile
+++ /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
index 2d58ac9e0..000000000
--- a/resource/csdk/ocsocket/test/android/ocsocket_gtest.cpp
+++ /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
index 682a5a845..000000000
--- a/resource/csdk/ocsocket/test/arduino/makefile
+++ /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
index 993ab26b3..000000000
--- a/resource/csdk/ocsocket/test/arduino/ocsocket_test.cpp
+++ /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
index 0138afbf8..000000000
--- a/resource/csdk/ocsocket/test/arduino/ocsocket_wifi_test.cpp
+++ /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
index adf6abcf7..000000000
--- a/resource/csdk/ocsocket/test/linux/makefile
+++ /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
index 3c941e9b4..000000000
--- a/resource/csdk/ocsocket/test/linux/ocsocket_gtest.cpp
+++ /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
index 8d6598e23..000000000
--- a/resource/csdk/ocsocket/test/makefile
+++ /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
index e657d6bcf..000000000
--- a/resource/csdk/ocsocket/test/sendrecv.cpp
+++ /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
index 2c4553058..000000000
--- a/resource/csdk/ocsocket/test/sendrecv_README.txt
+++ /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
diff --git a/resource/csdk/stack/include/internal/ocobserve.h b/resource/csdk/stack/include/internal/ocobserve.h
index b9a88ffdf..9125b9f79 100644
--- a/resource/csdk/stack/include/internal/ocobserve.h
+++ b/resource/csdk/stack/include/internal/ocobserve.h
@@ -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,
diff --git a/resource/csdk/stack/include/internal/ocserverrequest.h b/resource/csdk/stack/include/internal/ocserverrequest.h
index bfa4511e7..beb63aa0e 100644
--- a/resource/csdk/stack/include/internal/ocserverrequest.h
+++ b/resource/csdk/stack/include/internal/ocserverrequest.h
@@ -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);
diff --git a/resource/csdk/stack/include/internal/ocstackinternal.h b/resource/csdk/stack/include/internal/ocstackinternal.h
index bd44976d9..2952f010b 100644
--- a/resource/csdk/stack/include/internal/ocstackinternal.h
+++ b/resource/csdk/stack/include/internal/ocstackinternal.h
@@ -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;
diff --git a/resource/csdk/stack/include/ocstack.h b/resource/csdk/stack/include/ocstack.h
index 2c5184ef3..0038ec81d 100644
--- a/resource/csdk/stack/include/ocstack.h
+++ b/resource/csdk/stack/include/ocstack.h
@@ -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
}
diff --git a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
index 0ee709522..a09112ed0 100644
--- a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
+++ b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
@@ -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'
diff --git a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile
index a010c6ff6..fea42ba69 100644
--- a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile
+++ b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/makefile
@@ -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
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript b/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
index 8f4c7313b..edbc28bc0 100644
--- a/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
+++ b/resource/csdk/stack/samples/linux/SimpleClientServer/SConscript
@@ -6,7 +6,6 @@ samples_env = env.Clone()
# Build flags
######################################################################
samples_env.PrependUnique(CPPPATH = [
- '../../../../ocsocket/include',
'../../../../logger/include',
'../../../../stack/include',
'../../../../ocmalloc/include',
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/makefile b/resource/csdk/stack/samples/linux/SimpleClientServer/makefile
index 2d36f1d64..99b5ad802 100644
--- a/resource/csdk/stack/samples/linux/SimpleClientServer/makefile
+++ b/resource/csdk/stack/samples/linux/SimpleClientServer/makefile
@@ -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)
diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
index 541329887..71d8d4675 100644
--- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
+++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
@@ -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");
diff --git a/resource/csdk/stack/samples/linux/secure/SConscript b/resource/csdk/stack/samples/linux/secure/SConscript
index 8cb23f6f4..451d3f50c 100644
--- a/resource/csdk/stack/samples/linux/secure/SConscript
+++ b/resource/csdk/stack/samples/linux/secure/SConscript
@@ -6,7 +6,6 @@ samples_env = env.Clone()
# Build flags
######################################################################
samples_env.PrependUnique(CPPPATH = [
- '../../../../ocsocket/include',
'../../../../logger/include',
'../../../../stack/include',
'../../../../security/include',
diff --git a/resource/csdk/stack/samples/linux/secure/makefile b/resource/csdk/stack/samples/linux/secure/makefile
index 9388163be..6b4cec448 100644
--- a/resource/csdk/stack/samples/linux/secure/makefile
+++ b/resource/csdk/stack/samples/linux/secure/makefile
@@ -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)
diff --git a/resource/csdk/stack/src/ocobserve.c b/resource/csdk/stack/src/ocobserve.c
index 2abc9b215..0d5e9ea35 100644
--- a/resource/csdk/stack/src/ocobserve.c
+++ b/resource/csdk/stack/src/ocobserve.c
@@ -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...
diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c
index 4c82788ab..a4d735c33 100644
--- a/resource/csdk/stack/src/ocresource.c
+++ b/resource/csdk/stack/src/ocresource.c
@@ -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)
{
diff --git a/resource/csdk/stack/src/ocserverrequest.c b/resource/csdk/stack/src/ocserverrequest.c
index de93f301a..1d82d2e5b 100644
--- a/resource/csdk/stack/src/ocserverrequest.c
+++ b/resource/csdk/stack/src/ocserverrequest.c
@@ -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;
diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c
index 868a87af5..da84aa0e5 100644
--- a/resource/csdk/stack/src/ocstack.c
+++ b/resource/csdk/stack/src/ocstack.c
@@ -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;
+}
+
diff --git a/resource/csdk/stack/test/arduino/makefile b/resource/csdk/stack/test/arduino/makefile
index ff6825c02..2f0d38914 100644
--- a/resource/csdk/stack/test/arduino/makefile
+++ b/resource/csdk/stack/test/arduino/makefile
@@ -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
diff --git a/resource/csdk/stack/test/linux/makefile b/resource/csdk/stack/test/linux/makefile
index 43ebff71a..d3861d6f2 100644
--- a/resource/csdk/stack/test/linux/makefile
+++ b/resource/csdk/stack/test/linux/makefile
@@ -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
diff --git a/resource/csdk/stack/test/makefile b/resource/csdk/stack/test/makefile
index 08b6a32c2..493b34e96 100644
--- a/resource/csdk/stack/test/makefile
+++ b/resource/csdk/stack/test/makefile
@@ -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
diff --git a/resource/examples/SConscript b/resource/examples/SConscript
index 6e1f4a7bc..d52f212f4 100644
--- a/resource/examples/SConscript
+++ b/resource/examples/SConscript
@@ -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'
diff --git a/resource/examples/makefile b/resource/examples/makefile
index 48b0ce578..c222bc2bc 100644
--- a/resource/examples/makefile
+++ b/resource/examples/makefile
@@ -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
diff --git a/resource/include/OCSerialization.h b/resource/include/OCSerialization.h
index 272fa297a..6f9f541b7 100644
--- a/resource/include/OCSerialization.h
+++ b/resource/include/OCSerialization.h
@@ -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)
{
diff --git a/resource/makefile b/resource/makefile
index d3fe9d130..fa22f75b1 100644
--- a/resource/makefile
+++ b/resource/makefile
@@ -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
diff --git a/resource/oc_logger/samples/linux/makefile b/resource/oc_logger/samples/linux/makefile
index ed57571e4..bab164663 100644
--- a/resource/oc_logger/samples/linux/makefile
+++ b/resource/oc_logger/samples/linux/makefile
@@ -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 \
diff --git a/resource/src/InProcClientWrapper.cpp b/resource/src/InProcClientWrapper.cpp
index 97fe351e6..339875c4e 100644
--- a/resource/src/InProcClientWrapper.cpp
+++ b/resource/src/InProcClientWrapper.cpp
@@ -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;
diff --git a/resource/src/SConscript b/resource/src/SConscript
index e1fe71216..e76c4e4d7 100644
--- a/resource/src/SConscript
+++ b/resource/src/SConscript
@@ -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',
diff --git a/resource/unittests/makefile b/resource/unittests/makefile
index 7b3823414..5be263d51 100644
--- a/resource/unittests/makefile
+++ b/resource/unittests/makefile
@@ -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
diff --git a/service/notification-manager/NotificationManager/build/linux/Makefile b/service/notification-manager/NotificationManager/build/linux/Makefile
index d1e9288c7..26aa59207 100644
--- a/service/notification-manager/NotificationManager/build/linux/Makefile
+++ b/service/notification-manager/NotificationManager/build/linux/Makefile
@@ -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
diff --git a/service/notification-manager/build/tizen/CMakeLists.txt b/service/notification-manager/build/tizen/CMakeLists.txt
index 3fa239345..2e33a43c3 100644
--- a/service/notification-manager/build/tizen/CMakeLists.txt
+++ b/service/notification-manager/build/tizen/CMakeLists.txt
@@ -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)
diff --git a/service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile b/service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile
index d40b1d121..0babef25c 100644
--- a/service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile
+++ b/service/protocol-plugin/plugins/mqtt-fan/build/linux/Makefile
@@ -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)
diff --git a/service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile b/service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile
index d7e7b4e2a..dbce34a5a 100644
--- a/service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile
+++ b/service/protocol-plugin/plugins/mqtt-light/build/linux/Makefile
@@ -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)
diff --git a/service/protocol-plugin/sample-app/linux/mqtt/Makefile b/service/protocol-plugin/sample-app/linux/mqtt/Makefile
index fbce338b0..4ac77993b 100644
--- a/service/protocol-plugin/sample-app/linux/mqtt/Makefile
+++ b/service/protocol-plugin/sample-app/linux/mqtt/Makefile
@@ -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)
diff --git a/service/soft-sensor-manager/SSMCore/build/linux/Makefile b/service/soft-sensor-manager/SSMCore/build/linux/Makefile
index 8cf72ba7d..9711461b7 100644
--- a/service/soft-sensor-manager/SSMCore/build/linux/Makefile
+++ b/service/soft-sensor-manager/SSMCore/build/linux/Makefile
@@ -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}}
diff --git a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile
index 4abd7ec98..edb513604 100644
--- a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile
+++ b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/build/makefile
@@ -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
diff --git a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile
index e3203bc85..39a6e69c5 100644
--- a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile
+++ b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/makefile
@@ -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
diff --git a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile
index e3203bc85..39a6e69c5 100644
--- a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile
+++ b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/build/makefile
@@ -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
diff --git a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile
index 9f7905099..df83b9660 100644
--- a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile
+++ b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/build/makefile
@@ -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
diff --git a/service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile b/service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile
index 28802e8d7..f2da903b4 100644
--- a/service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile
+++ b/service/soft-sensor-manager/SampleApp/linux/THSensorApp/build/Makefile
@@ -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}
diff --git a/service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile b/service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile
index a195f01bc..5b449aac7 100644
--- a/service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile
+++ b/service/soft-sensor-manager/SampleApp/linux/THSensorApp1/build/Makefile
@@ -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}
diff --git a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt
index 7aa6d406b..7ec7d7e54 100644
--- a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt
+++ b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/CMakeLists.txt
@@ -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)
diff --git a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org
index 85ece274d..118d960e2 100644
--- a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org
+++ b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/makefile_org
@@ -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
diff --git a/service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt b/service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt
index 89b15b876..cb0c214ba 100644
--- a/service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt
+++ b/service/soft-sensor-manager/build/tizen/SampleApp/ClientApp/CMakeLists.txt
@@ -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)
diff --git a/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt b/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt
index d74f5a520..86c8d8939 100644
--- a/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt
+++ b/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp/CMakeLists.txt
@@ -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)
diff --git a/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt b/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt
index d1909c90d..192b8e12a 100644
--- a/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt
+++ b/service/soft-sensor-manager/build/tizen/SampleApp/THSensorApp1/CMakeLists.txt
@@ -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)
diff --git a/service/things-manager/sampleapp/linux/configuration/makefile b/service/things-manager/sampleapp/linux/configuration/makefile
index e0eb57c26..32251dd63 100644
--- a/service/things-manager/sampleapp/linux/configuration/makefile
+++ b/service/things-manager/sampleapp/linux/configuration/makefile
@@ -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""
diff --git a/service/things-manager/sampleapp/linux/groupaction/makefile b/service/things-manager/sampleapp/linux/groupaction/makefile
index bddcbe451..985df0476 100644
--- a/service/things-manager/sampleapp/linux/groupaction/makefile
+++ b/service/things-manager/sampleapp/linux/groupaction/makefile
@@ -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
diff --git a/service/things-manager/sampleapp/linux/groupsyncaction/makefile b/service/things-manager/sampleapp/linux/groupsyncaction/makefile
index b0b767ce4..0a194cc2f 100644
--- a/service/things-manager/sampleapp/linux/groupsyncaction/makefile
+++ b/service/things-manager/sampleapp/linux/groupsyncaction/makefile
@@ -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""
diff --git a/service/things-manager/sdk/build/linux/Makefile b/service/things-manager/sdk/build/linux/Makefile
index f00a51ef9..96e8e1046 100644
--- a/service/things-manager/sdk/build/linux/Makefile
+++ b/service/things-manager/sdk/build/linux/Makefile
@@ -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
diff --git a/service/third_party_libs.scons b/service/third_party_libs.scons
index ac543d2b6..f979c8984 100644
--- a/service/third_party_libs.scons
+++ b/service/third_party_libs.scons
@@ -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'
])