Commit 052e9e58 authored by Patrick Bellot's avatar Patrick Bellot
Browse files

EDP

parent 2d851b5e
......@@ -43,9 +43,9 @@ public:
void run()
{
int nbExt = 3 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 5 ; // Number of internal loops
int nbPub = 20 ; // Number of publish inside internal loops
int nbExt = 1 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 50 ; // Number of internal loops
int nbPub = 2000 ; // Number of publish inside internal loops
SOPC_StatusCode status = STATUS_OK ;
......@@ -82,10 +82,12 @@ public:
&revisedPublishingInterval,
&revisedLifetimeCount,
&revisedMaxKeepAliveCount) ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_01","Cannot CreateSubscription: status=0x%08x",status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_01","CreateSubscription succeeds") ;
// INTERNAL LOOP
......@@ -108,10 +110,12 @@ public:
&monitoredItemId0,
&revisedSamplingInterval0,
&revisedQueueSize0) ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_01","Cannot CreateMonitoredItems(0): status=0x%08x",status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_01","CreateMonitoredItems (0) succeeds") ;
// CREATE MONITORED ITEMS (1)
......@@ -122,10 +126,12 @@ public:
&monitoredItemId1,
&revisedSamplingInterval1,
&revisedQueueSize1) ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_01","Cannot CreateMonitoredItems (1): status=0x%08x",status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_01","CreateMonitoredItems (1) succeeds") ;
// BEGINNING PUBLISH SEQUENCE
......@@ -149,7 +155,7 @@ public:
}
// END PUBLISH SEQUENCE
if ((sequenceNumber))
if (sequenceNumber != NULL)
sequenceNumber->release() ;
// DELETE MONITORED ITEMS
......@@ -162,6 +168,7 @@ public:
debug_i(COM_ERR,"Client_01","Cannot DeleteMonitoredItems: status=0x%08x",status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_01","DeleteMonitoredItems succeeds") ;
// DELETE CREATE MONITORED ITEMS (0) DATA
......@@ -196,30 +203,8 @@ public:
public:
Client_01(
SOPC_Channel _hChannel,
const char * _sEndpointUrl,
SOPC_String * _stEndpointUrl,
String * _endPointUrl,
Certificate * _crt_cli,
AsymmetricKey * _priv_cli,
Certificate * _crt_srv,
PKIProvider * _pki,
char * _pRequestedSecurityPolicyUri,
OpcUa_MessageSecurityMode _messageSecurityMode
)
: BaseClient(
_hChannel,
_sEndpointUrl,
_stEndpointUrl,
_endPointUrl,
_crt_cli,
_priv_cli,
_crt_srv,
_pki,
_pRequestedSecurityPolicyUri,
_messageSecurityMode
)
Client_01(int num, SOPC_SecureChannel_Config * pScConfig, uint32_t channel_config_idx,String * endpointUrl)
: BaseClient(num, pScConfig, channel_config_idx,endpointUrl)
{}
virtual ~Client_01()
......@@ -251,7 +236,7 @@ private:
new RequestHeader(
SessionAuthenticationToken::nullNodeId,
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -368,7 +353,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
new UInt32(5000) // TimeoutHint
......@@ -411,7 +396,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
new UInt32(5000) // TimeoutHint
......@@ -480,7 +465,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -533,7 +518,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -601,7 +586,7 @@ private:
QualifiedName::defaultBinary) ;
MonitoringParameters * requestedParameters = new MonitoringParameters(
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
new Duration(200.0),
DataChangeFilter::nullFilter,
new Counter(64),
......@@ -622,7 +607,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -695,7 +680,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -766,7 +751,7 @@ private:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......
......@@ -21,8 +21,17 @@
#define STARTCLIENTS_01_H_
#include "lib/Stacks/All.h"
#include "Client_01.h"
#include "../OpcUa_BaseClient.h"
#include "../Client_01_Subscription/Client_01.h"
#include <sopc_toolkit_config.h>
extern "C" {
extern opcua::BaseClient ** the_clients ;
extern int the_nbClient ;
}
#if (WITH_SUBSCRIPTION == 1)
......@@ -33,54 +42,42 @@ class StartClients_01
public:
static SOPC_StatusCode startClients(
const char * sEndpointUrl,
SOPC_String * stEndpointUrl,
String * endpointUrl,
Certificate * crt_cli,
AsymmetricKey * priv_cli,
Certificate * crt_srv,
PKIProvider * pki,
const char * pRequestedSecurityPolicyUri,
OpcUa_MessageSecurityMode messageSecurityMode
SOPC_SecureChannel_Config * pScConfig
)
{
int nbClient = 5 ; // Number of client threads
int nbTry = 2 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
int nbClient = 3 ; // Number of client threads
int nbTry = 1 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
SOPC_Channel hChannel = NULL;
uint32_t channel_config_idx = 0 ;
Client_01 ** clients = NULL ;
SOPC_StatusCode status = STATUS_OK ;
// EXTERNAL LOOP
while (--nbTry >= 0) {
// CREATING CHANNEL CONFIGURATION
channel_config_idx = SOPC_ToolkitClient_AddSecureChannelConfig(pScConfig);
if (channel_config_idx == 0) {
debug(COM_ERR,"StartClientss_02","Cannot add secure channel config") ;
goto error ;
} else {
debug_i(IPCS_DBG,"StartClients_02","channel_config_idx=%d",channel_config_idx) ;
}
SOPC_Toolkit_Configured() ;
debug(MAIN_LIFE_DBG,"StartClients_02","Open Secure Channels config succeeds") ;
// CREATING CHANNEL
debug(MAIN_LIFE_DBG,"StartClients_01","Create channel") ;
status = SOPC_Channel_Create(&hChannel, SOPC_ChannelSerializer_Binary);
if(STATUS_OK != status) {
debug_i(COM_ERR,"StartClients_01","Create channel failed: status=0x%08x",status) ;
goto error ;
}
// EXTERNAL LOOP
while (--nbTry >= 0) {
// CREATING CLIENT
debug(MAIN_LIFE_DBG,"StartClients_01","Building clients") ;
// CREATING CLIENTS
debug(MAIN_LIFE_DBG,"StartClients_02","Building clients") ;
clients = new Client_01 *[nbClient] ;
for (int i = 0 ; i < nbClient ; i++)
clients[i]
= new Client_01(
hChannel,
sEndpointUrl,
stEndpointUrl,
endpointUrl,
crt_cli,
priv_cli,
crt_srv,
pki,
(char *)pRequestedSecurityPolicyUri,
messageSecurityMode
) ;
clients[i] = new Client_01(i,pScConfig,channel_config_idx,endpointUrl) ;
the_clients = (BaseClient **)clients ;
the_nbClient = nbClient ;
// OPEN SECURE CHANNEL
......@@ -117,17 +114,6 @@ public:
debug(MAIN_LIFE_DBG,"StartClients_01","Close Secure Channel succeeds") ;
// DELETING CHANNEL
debug(MAIN_LIFE_DBG,"StartClients_01","Delete channel") ;
status = SOPC_Channel_Delete(&hChannel);
hChannel = NULL ;
if(STATUS_OK != status) {
debug_i(COM_ERR,"StartClients_01","Delete channel failed: status=0x%08x",status) ;
goto error ;
}
debug(MAIN_LIFE_DBG,"StartClients_01","Delete channel succeeds") ;
// DELETING CLIENTS
debug(MAIN_LIFE_DBG,"StartClients_01","Deleting clients") ;
for (int i = 0 ; i < nbClient ; i++)
......@@ -139,6 +125,8 @@ public:
} // while (--nbTry >= 0)
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_01","Stopping with status=0x%08x",STATUS_OK) ;
return STATUS_OK ;
......@@ -146,15 +134,14 @@ public:
error:
debug(MAIN_LIFE_DBG,"StartClients_01","Releasing memory with error") ;
if (hChannel != NULL)
SOPC_Channel_Delete(&hChannel);
if (clients != NULL) {
for (int i = 0 ; i < nbClient ; i++)
delete clients[i] ;
delete[] clients ;
}
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_01","Stopping with error, status=0x%08x",status) ;
return status;
}
......
......@@ -121,12 +121,12 @@ public:
delete[] clients ;
clients = NULL ;
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_02","End of Loop (%d)",nbTry) ;
} // while (--nbTry >= 0)
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_02","Stopping with status=0x%08x",STATUS_OK) ;
return STATUS_OK ;
......@@ -134,14 +134,14 @@ public:
error:
debug(MAIN_LIFE_DBG,"StartClients_02","Releasing memory with error") ;
SOPC_Toolkit_Clear();
if (clients != NULL) {
for (int i = 0 ; i < nbClient ; i++)
delete clients[i] ;
delete[] clients ;
}
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_02","Stopping with error, status=0x%08x",status) ;
return status;
}
......
......@@ -38,8 +38,8 @@ public:
void run()
{
int nbExt = 1 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 1 ; // Number of internal loops (after ActivateSession and before CloseSession)
int nbExt = 1000 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 10000 ; // Number of internal loops (after ActivateSession and before CloseSession)
SOPC_StatusCode status = STATUS_OK ;
......@@ -287,7 +287,7 @@ public:
Nonce * distantNonce = session->getDistantNonce() ;
if (distantNonce == NULL) {
debug(COM_ERR, "Client_03", "activateSession(): distantNonce == NULL");
return 0x00000003 ;PCS_DBG +
return 0x00000003 ;
}
ApplicationInstanceCertificate * distantCertificate = session->getDistantCertificate() ;
......
......@@ -47,7 +47,7 @@ public:
)
{
int nbClient = 3 ; // Number of client threads (max is 256)
int nbTry = 1 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
int nbTry = 100 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
uint32_t channel_config_idx = 0 ;
Client_03 ** clients = NULL ;
......@@ -120,23 +120,27 @@ public:
delete[] clients ;
clients = NULL ;
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_03","End of Loop (%d)",nbTry) ;
} // while (--nbTry >= 0)
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_01","Stopping with status=0x%08x",STATUS_OK) ;
return STATUS_OK ;
error:
debug(MAIN_LIFE_DBG,"StartClients_03","Releasing memory with error") ;
SOPC_Toolkit_Clear();
if (clients != NULL) {
for (int i = 0 ; i < nbClient ; i++)
delete clients[i] ;
delete[] clients ;
}
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_03","Stopping with status=0x%08x",status) ;
return status;
}
......
......@@ -38,8 +38,8 @@ public:
void run()
{
int nbExt = 3 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 10 ; // Number of internal loops (after ActivateSession and before CloseSession)
int nbExt = 1 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 1 ; // Number of internal loops (after ActivateSession and before CloseSession)
SOPC_StatusCode status = STATUS_OK ;
......@@ -47,67 +47,67 @@ public:
while (--nbExt >= 0) {
// CREATE SESSION
debug(MAIN_LIFE_DBG,"Client_04","Create Session begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Create Session begin for client=%d",num) ;
status = createSession() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Create Session: status=0x%08x",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Create Session: client=%d & status=0x%08x",num,status) ;
return ;
}
debug(MAIN_LIFE_DBG,"Client_04","Create Session succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Create Session succeeds for cleint=%d",num) ;
// ACTIVATE SESSION
debug(MAIN_LIFE_DBG,"Client_04","Activate Session begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Activate Session begin for client=%d",num) ;
status = activateSession() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Activate Session: status=0x%08x",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Activate Session: client=%d & status=0x%08x",num,status) ;
return ;
}
debug(MAIN_LIFE_DBG,"Client_04","Activate Session succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Activate Session succeeds for client=%d",num) ;
// INTERNAL LOOP
int _nbInt = nbInt ;
while (--_nbInt >= 0) {
// REGISTER WITH GOOD NODES
debug(MAIN_LIFE_DBG,"Client_04","Register Good begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Register Good begin for client=%d",num) ;
status = doRegisterNodesGood() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Register Good: status=0x%08x",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Register Good: client=%d & status=0x%08x",num,status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_04","Register Good succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Register Good succeeds for client=%d",num) ;
// REGISTER WITH NOT GOOD NODES
debug(MAIN_LIFE_DBG,"Client_04","Register Not Good begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Register Not Good begin for client=%d",num) ;
status = doRegisterNodesNotGood() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Register Not Good: status=0x%08x (this is the good result)",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Register Not Good: client=%d & status=0x%08x (this is the good result)",num,status) ;
} else {
debug(MAIN_LIFE_DBG,"Client_04","Register Not Good succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Register Not Good succeeds for client=%d",num) ;
}
// UNREGISTER WITH GOOD NODES
debug(MAIN_LIFE_DBG,"Client_04","Unregister Good begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Unregister Good begin for client=%d",num) ;
status = doUnregisterNodesGood() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Unregister Good: status=0x%08x",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Unregister Good: client=%d & status=0x%08x",num,status) ;
break ;
}
debug(MAIN_LIFE_DBG,"Client_04","Unregister Good succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Unregister Good succeeds for client=%d",num) ;
} // nbInt
// CLOSE SESSION
debug(MAIN_LIFE_DBG,"Client_04","Close Session begin") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Close Session begin for client=%d",num) ;
status = closeSession() ;
if(status != STATUS_OK) {
debug_i(COM_ERR,"Client_04","Cannot Close Session: status=0x%08x",status) ;
debug_ii(COM_ERR,"Client_04","Cannot Close Session: client=%d & status=0x%08x",num,status) ;
return ;
}
debug(MAIN_LIFE_DBG,"Client_04","Close Session succeeds") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Close Session succeeds for client=%d",num) ;
} // nbExt
debug(MAIN_LIFE_DBG,"Client_04","Ending thread") ;
debug_i(MAIN_LIFE_DBG,"Client_04","Ending thread for client=%d",num) ;
} // run()
public:
......@@ -476,7 +476,7 @@ public:
NodeId * nodeToRegister0 = new NodeId(UInt16::zero,new String("XMouse")) ;
NodeId * nodeToRegister1 = new NodeId(UInt16::zero,new String("ZZZ YMouse")) ;
TableNodeId * nodesToRegister = new TableNodeId (2) ;
TableNodeId * nodesToRegister = new TableNodeId(2) ;
nodesToRegister->set(0,nodeToRegister0) ;
nodesToRegister->set(1,nodeToRegister1) ;
......@@ -552,7 +552,8 @@ public:
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
), nodesToUnregister);
),
nodesToUnregister);
UnregisterNodesResponse * unRegisterNodesResponse = NULL ;
......
......@@ -46,8 +46,8 @@ public:
SOPC_SecureChannel_Config * pScConfig
)
{
int nbClient = 5 ; // Number of client threads
int nbTry = 5 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
int nbClient = 2 ; // Number of client threads
int nbTry = 1 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
uint32_t channel_config_idx = 0 ;
Client_04 ** clients = NULL ;
......@@ -119,12 +119,12 @@ public:
delete[] clients ;
clients = NULL ;
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_04","End of Loop (%d)",nbTry) ;
} // while (--nbTry >= 0)
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_04","Stopping with status=0x%08x",STATUS_OK) ;
return STATUS_OK ;
......@@ -132,14 +132,14 @@ public:
error:
debug(MAIN_LIFE_DBG,"StartClients_04","Releasing memory with error") ;
SOPC_Toolkit_Clear();
if (clients != NULL) {
for (int i = 0 ; i < nbClient ; i++)
delete clients[i] ;
delete[] clients ;
}
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_04","Stopping with error, status=0x%08x",status) ;
return status;
}
......
......@@ -120,12 +120,12 @@ public:
delete[] clients ;
clients = NULL ;
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_05","End of Loop (%d)",nbTry) ;
} // while (--nbTry >= 0)
SOPC_Toolkit_Clear();
debug_i(MAIN_LIFE_DBG,"StartClients_05","Stopping with status=0x%08x",STATUS_OK) ;
return STATUS_OK ;
......@@ -133,14 +133,14 @@ public:
error:
debug(MAIN_LIFE_DBG,"StartClients_05","Releasing memory with error") ;
SOPC_Toolkit_Clear();
if (clients != NULL) {
for (int i = 0 ; i < nbClient ; i++)
delete clients[i] ;
delete[] clients ;
}