help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False))
help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False))
help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
if env.get('SECURED') == '1':
defines.append('-D__WITH_TLS__=1')
+if env.get('DISABLE_TCP_SERVER'):
+ defines.append('-DDISABLE_TCP_SERVER=1')
+
libs = []
if env.get('SECURED') == '1':
defines.append('-D__WITH_DTLS__=1')
%{!?WITH_MQ: %define WITH_MQ OFF}
%{!?WITH_PROXY: %define WITH_PROXY 0}
%{!?WITH_TCP: %define WITH_TCP 1}
+%{!?DISABLE_TCP_SERVER: %define DISABLE_TCP_SERVER 1}
%{!?RD_MODE: %define RD_MODE CLIENT}
%{!?BLE_CUSTOM_ADV: %define BLE_CUSTOM_ADV False}
%{!?BLE_DIVISION: %define BLE_DIVISION VD}
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \
build_sample = env.get('BUILD_SAMPLE')
with_ra = env.get('WITH_RA')
with_tcp = env.get('WITH_TCP')
+disable_tcp_server = env.get('DISABLE_TCP_SERVER')
with_mq = env.get('WITH_MQ')
ble_custom_adv = env.get('BLE_CUSTOM_ADV')
env.AppendUnique(CPPDEFINES = ['RA_ADAPTER'])
if with_tcp == True:
env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
+ if disable_tcp_server == True:
+ env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
if target_os in ['linux']:
env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','LE_ADAPTER'])
elif target_os == 'tizen':
else:
env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+ if disable_tcp_server == True:
+ if target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'tizenrt']:
+ env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
+
if 'NFC' in transport:
if target_os in['android']:
env.AppendUnique(CPPDEFINES = ['NFC_ADAPTER'])
help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
help_vars.Add(BoolVariable('WITH_TCP', 'Enable TCP', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
target_os = env.get('TARGET_OS')
transport = env.get('TARGET_TRANSPORT')
with_tcp = env.get('WITH_TCP')
+disable_tcp_server = env.get('DISABLE_TCP_SERVER')
print "Given Transport is %s" % transport
else:
env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+ if disable_tcp_server == True:
+ env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
+ print "TCP server is disabled"
+
env.SConscript(['../con/lib/libcoap-4.1.1/SConscript'])
env.SConscript(['../con/SConscript'])
{
flags |= caglobals.clientFlags;
}
+
+#ifndef DISABLE_TCP_SERVER
if (caglobals.server)
{
flags |= caglobals.serverFlags;
}
+#endif
caglobals.tcp.ipv4tcpenabled = flags & CA_IPV4;
caglobals.tcp.ipv6tcpenabled = flags & CA_IPV6;
CAResult_t CAStartTCPListeningServer()
{
-#ifndef SINGLE_THREAD
+#if !defined(SINGLE_THREAD) && !defined(DISABLE_TCP_SERVER)
if (!caglobals.server)
{
caglobals.server = true; // only needed to run CA tests
#endif
}
+#ifndef DISABLE_TCP_SERVER
#define NEWSOCKET(FAMILY, NAME) \
caglobals.tcp.NAME.fd = CACreateAcceptSocket(FAMILY, &caglobals.tcp.NAME); \
if (caglobals.tcp.NAME.fd == -1) \
caglobals.tcp.ipv6s.fd, caglobals.tcp.ipv6s.port);
#endif
}
+#endif // DISABLE_TCP_SERVER
CAResult_t CATCPStartServer(const ca_thread_pool_t threadPool)
{
caglobals.tcp.svrlist = u_arraylist_create();
}
+#ifndef DISABLE_TCP_SERVER
if (caglobals.server)
{
CATCPInitializeSocket();
}
+#endif
+
#ifndef __TIZENRT__
// create pipe for fast shutdown
CAInitializePipe(caglobals.tcp.shutdownFds);
OIC_LOG(DEBUG, TAG, "data is removed from session list");
+#ifndef DISABLE_TCP_SERVER
if (caglobals.server && MAX_CONNECTION_COUNTS == u_arraylist_length(caglobals.tcp.svrlist) + 1)
{
CATCPInitializeSocket();
}
+#endif
+
return CA_STATUS_OK;
}
OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t size);
void OCSecurityPayloadDestroy(OCSecurityPayload* payload);
-#ifndef TCP_ADAPTER
+#if !defined(TCP_ADAPTER) || defined(DISABLE_TCP_SERVER)
void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
uint16_t securePort);
#else
help_vars.Add(BoolVariable('WITH_PROXY', 'CoAP-HTTP Proxy', False)) # set to 'no', 'false' or 0 for debug
help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
else:
env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+ if env.get('DISABLE_TCP_SERVER'):
+ env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
+
if 'SUB' in with_mq:
env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
print "MQ SUB support"
return NULL;
}
-#ifndef TCP_ADAPTER
+#if !defined(TCP_ADAPTER) || defined(DISABLE_TCP_SERVER)
static OCResourcePayload* OCCopyResource(const OCResource* res, uint16_t securePort)
#else
static OCResourcePayload* OCCopyResource(const OCResource* res, uint16_t securePort,
);
pl->secure = (res->resourceProperties & OC_SECURE) != 0;
pl->port = securePort;
-#ifdef TCP_ADAPTER
+#if defined(TCP_ADAPTER) && !defined(DISABLE_TCP_SERVER)
pl->tcpPort = tcpPort;
#endif
return pl;
}
-#ifndef TCP_ADAPTER
+#if !defined(TCP_ADAPTER) || defined(DISABLE_TCP_SERVER)
void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
uint16_t securePort)
{
return OC_STACK_OK;
}
-#ifdef TCP_ADAPTER
+#if defined(TCP_ADAPTER) && !defined(DISABLE_TCP_SERVER)
/* This method will retrieve the tcp port */
static OCStackResult GetTCPPortInfo(OCDevAddr *endpoint, uint16_t *port, bool secured)
{
}
}
-#ifdef TCP_ADAPTER
+#if defined(TCP_ADAPTER) && !defined(DISABLE_TCP_SERVER)
uint16_t tcpPort = 0;
GetTCPPortInfo(devAddr, &tcpPort, (resourcePtr->resourceProperties & OC_SECURE));
help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
%{!?WITH_MQ: %define WITH_MQ OFF}
%{!?WITH_PROXY: %define WITH_PROXY 0}
%{!?WITH_TCP: %define WITH_TCP 1}
+%{!?DISABLE_TCP_SERVER: %define DISABLE_TCP_SERVER 1}
%{!?RD_MODE: %define RD_MODE CLIENT}
%{!?BLE_CUSTOM_ADV: %define BLE_CUSTOM_ADV False}
%{!?BLE_DIVISION: %define BLE_DIVISION VD}
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \
%{!?WITH_MQ: %define WITH_MQ OFF}
%{!?WITH_PROXY: %define WITH_PROXY 0}
%{!?WITH_TCP: %define WITH_TCP 1}
+%{!?DISABLE_TCP_SERVER: %define DISABLE_TCP_SERVER 1}
%{!?RD_MODE: %define RD_MODE CLIENT}
%{!?BLE_CUSTOM_ADV: %define BLE_CUSTOM_ADV False}
%{!?BLE_DIVISION: %define BLE_DIVISION VD}
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \
WITH_MQ=%{WITH_MQ} \
WITH_PROXY=%{WITH_PROXY} \
WITH_TCP=%{WITH_TCP} \
+ DISABLE_TCP_SERVER=%{DISABLE_TCP_SERVER} \
RD_MODE=%{RD_MODE} \
BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
BLE_DIVISION=%{BLE_DIVISION} \