Commit 3a221152 authored by Patrick Bellot's avatar Patrick Bellot
Browse files

EDP

parent 0ee7fe44
......@@ -38,8 +38,8 @@ public:
void run()
{
int nbExt = 10000 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 0 ; // Number of internal loops (after ActivateSession and before CloseSession)
int nbExt = 1000 ; // Number of total loops from CreateSession to CloseSession
int nbInt = 1000 ; // Number of internal loops (after ActivateSession and before CloseSession)
SOPC_StatusCode status = STATUS_OK ;
......@@ -154,7 +154,7 @@ public:
new RequestHeader(
SessionAuthenticationToken::nullNodeId,
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -271,7 +271,7 @@ public:
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
......@@ -287,7 +287,7 @@ public:
Nonce * distantNonce = session->getDistantNonce() ;
if (distantNonce == NULL) {
debug(COM_ERR, "Client_03", "activateSession(): distantNonce == NULL");
return 0x00000003 ;
return 0x00000003 ;PCS_DBG +
}
ApplicationInstanceCertificate * distantCertificate = session->getDistantCertificate() ;
......@@ -314,7 +314,7 @@ public:
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
......@@ -383,7 +383,7 @@ public:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -462,7 +462,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
......@@ -598,7 +598,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
......@@ -678,7 +678,7 @@ error:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -863,7 +863,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
......@@ -963,7 +963,7 @@ error:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......@@ -1142,7 +1142,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
......@@ -1235,7 +1235,7 @@ error:
new RequestHeader(
new SessionAuthenticationToken(authenticationTokenNum),
UtcTime::now(),
new IntegerId(sequence),
new IntegerId(sequence<<8 | num),
UInt32::zero, // ReturnDiagnostics
String::empty, // auditEntryId
UInt32::zero // TimeoutHint
......
......@@ -46,8 +46,8 @@ public:
SOPC_SecureChannel_Config * pScConfig
)
{
int nbClient = 1 ; // Number of client threads
int nbTry = 1 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
int nbClient = 3 ; // Number of client threads (max is 256)
int nbTry = 1 ; // Number of total loops from OpenSecureChannel to CloseSecureChannel
uint32_t channel_config_idx = 0 ;
Client_03 ** clients = NULL ;
......
......@@ -89,8 +89,6 @@ public:
sessionActivated(false),
responsesQueue(new SyncQueue<BaseDataType>(MAX_RESPONSES_PER_CLIENT)),
noEvent(1),
noResp(1) ,
disconnect(0),
......
......@@ -331,7 +331,6 @@ extern "C" {
void ComEvent_FctClient(SOPC_App_Com_Event event, uint32_t idOrStatus, void* param, uintptr_t appContext)
{
fprintf(stderr,"--------------------------------------------------------------\n") ;
opcua::_ComEvent_FctClient(event,idOrStatus,param,appContext) ;
}
......
......@@ -134,18 +134,22 @@ MYDLL void Service_CreateSession(
return ;
}
if (requestId > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_CreateSession","Not a client number (<%d): client=%d",the_nbClient,requestId) ;
uint32_t client = r->getResponseHeader()->getRequestHandle()->get() & 0x000000FF ;
if (client > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_CreateSession","Not a client number (<%d): client=%d",the_nbClient,client) ;
delete r ;
return ;
}
debug_ii(IPCS_DBG,"Service_CreateSession","Receiving CreateSessionRespone with scId=%d and requestId=%d",scConnectionId,requestId) ;
debug_i(IPCS_DBG,"Service_CreateSession","Receiving Respone with client=%u",client) ;
the_clients[requestId]->pushResponse(r) ;
the_clients[client]->pushResponse(r) ;
OpcUa_ResponseHeader_Clear(responseHeader) ;
OpcUa_CreateSessionResponse_Clear(response) ;
free(responseHeader) ;
free(response) ;
}
......@@ -170,18 +174,22 @@ MYDLL void Service_ActivateSession(
return ;
}
if (requestId > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_ActivateSession","Not a client number (<%d): client=%d",the_nbClient,requestId) ;
uint32_t client = r->getResponseHeader()->getRequestHandle()->get() & 0x000000FF ;
if (client > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_ActivateSession","Not a client number (<%d): client=%d",the_nbClient,client) ;
delete r ;
return ;
}
debug_ii(IPCS_DBG,"Service_ActivateSession","Receiving ActivateSessionRespone with scId=%d and requestId=%d",scConnectionId,requestId) ;
debug_ii(IPCS_DBG,"Service_ActivateSession","Receiving Respone with scId=%d and requestId=%d",scConnectionId,requestId) ;
the_clients[requestId]->pushResponse(r) ;
the_clients[client]->pushResponse(r) ;
OpcUa_ResponseHeader_Clear(responseHeader) ;
OpcUa_ActivateSessionResponse_Clear(response) ;
free(responseHeader) ;
free(response) ;
}
......@@ -206,18 +214,22 @@ MYDLL void Service_CloseSession(
return ;
}
if (requestId > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_CloseSession","Not a client number (<%d): client=%d",the_nbClient,requestId) ;
uint32_t client = r->getResponseHeader()->getRequestHandle()->get() & 0x000000FF ;
if (client > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_CloseSession","Not a client number (<%d): client=%d",the_nbClient,client) ;
delete r ;
return ;
}
debug_ii(IPCS_DBG,"Service_CloseSession","Receiving CloseSessionRespone with scId=%d and requestId=%d",scConnectionId,requestId) ;
debug_ii(IPCS_DBG,"Service_CloseSession","Receiving Respone with scId=%d and requestId=%d",scConnectionId,requestId) ;
the_clients[requestId]->pushResponse(r) ;
the_clients[client]->pushResponse(r) ;
OpcUa_ResponseHeader_Clear(responseHeader) ;
OpcUa_CloseSessionResponse_Clear(response) ;
free(responseHeader) ;
free(response) ;
}
......@@ -242,18 +254,22 @@ MYDLL void Service_Read(
return ;
}
if (requestId > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_Read","Not a client number (<%d): client=%d",the_nbClient,requestId) ;
uint32_t client = r->getResponseHeader()->getRequestHandle()->get() & 0x000000FF ;
if (client > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_Read","Not a client number (<%d): client=%d",the_nbClient,client) ;
delete r ;
return ;
}
debug_ii(IPCS_DBG,"Service_Read","Receiving ReadRespone with scId=%d and requestId=%d",scConnectionId,requestId) ;
debug_ii(IPCS_DBG,"Service_Read","Receiving Respone with scId=%d and requestId=%d",scConnectionId,requestId) ;
the_clients[requestId]->pushResponse(r) ;
the_clients[client]->pushResponse(r) ;
OpcUa_ResponseHeader_Clear(responseHeader) ;
OpcUa_ReadResponse_Clear(response) ;
free(responseHeader) ;
free(response) ;
}
......@@ -278,18 +294,22 @@ MYDLL void Service_Write(
return ;
}
if (requestId > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_Write","Not a client number (<%d): client=%d",the_nbClient,requestId) ;
uint32_t client = r->getResponseHeader()->getRequestHandle()->get() & 0x000000FF ;
if (client > (uint32_t)the_nbClient) {
debug_ii(IPCS_ERR,"Service_Write","Not a client number (<%d): client=%d",the_nbClient,client) ;
delete r ;
return ;
}
debug_ii(IPCS_DBG,"Service_Write","Receiving WriteRespone with scId=%d and requestId=%d",scConnectionId,requestId) ;
the_clients[requestId]->pushResponse(r) ;
the_clients[client]->pushResponse(r) ;
OpcUa_ResponseHeader_Clear(responseHeader) ;
OpcUa_WriteResponse_Clear(response) ;
free(responseHeader) ;
free(response) ;
}
......
......@@ -2,7 +2,7 @@
echo $PWD
export LD_LIBRARY_PATH=../opcua/Debug:../ingopcs/libraries/mbedtls-2.3.0/library/Debug:../ingopcs/stack/src/Debug:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=../opcua/Debug:../s2opc_stack/Debug:/usr/local/lib:$LD_LIBRARY_PATH
./Debug/opcua-client 127.0.0.1 $1 certificates.127.0.0.1 127.0.0.1 10000
......@@ -2,9 +2,10 @@
echo $PWD
export LD_LIBRARY_PATH=../opcua/Debug:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=../opcua/Debug:../s2opc_stack/Debug:/usr/local/lib:$LD_LIBRARY_PATH
# valgrind -v --leak-check=full ./Debug/opcua-client 127.0.0.1 $1 certificates.127.0.0.1 127.0.0.1 10000
valgrind -v --leak-check=full ./Debug/opcua-client 127.0.0.1 $1 certificates.127.0.0.1 127.0.0.1 10000
#valgrind -v --track-origins=yes --show-reachable=yes --tool=memcheck --leak-check=full --show-leak-kinds=all --gen-suppressions=all --suppressions=/home/bellot/Desktop/opc-rosa/opcua-client/valgrind.supp ./Debug/opcua-client 127.0.0.1 $1 certificates.127.0.0.1 127.0.0.1 10000
valgrind -v --track-origins=yes --show-reachable=yes --tool=memcheck --leak-check=full --show-leak-kinds=all --gen-suppressions=all --suppressions=/home/bellot/Desktop/opc-rosa/opcua-client/valgrind.supp ./Debug/opcua-client 127.0.0.1 $1 certificates.127.0.0.1 127.0.0.1 10000
......@@ -242,9 +242,9 @@
/* Current debug level. */
//#define DEBUG_LEVEL (COM_ERR + IPCS_ERR + S2OPC_ERR + MAIN_LIFE_DBG + SERVER_DBG + CLIENT_DBG)
#define DEBUG_LEVEL (COM_ERR + IPCS_ERR + S2OPC_ERR + MAIN_LIFE_DBG + SERVER_DBG + CLIENT_DBG)
#define DEBUG_LEVEL (COM_ERR + COM_DBG + IPCS_ERR + IPCS_DBG + S2OPC_ERR + S2OPC_DBG + MAIN_LIFE_DBG + SERVER_DBG + CLIENT_DBG)
//#define DEBUG_LEVEL (COM_ERR + COM_DBG + IPCS_ERR + S2OPC_ERR + S2OPC_DBG + MAIN_LIFE_DBG + SERVER_DBG + CLIENT_DBG)
// #define DEBUG_LEVEL (COM_ERR + IPCS_ERR + S2OPC_ERR + MAIN_LIFE_DBG + SERVER_DBG + CLIENT_DBG + BIN_DBG + S2OPC_DBG)
......
......@@ -18,7 +18,7 @@ class Sequence: public RefCount {
private:
/* page 37, part 6*/
const static uint32_t MAX_SEQUENCE = UINT32_MAX - 1024;
const static uint32_t MAX_SEQUENCE = 0x00FFFFFF - 1024 ;
const static uint32_t START_SEQUENCE = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment