Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zepeng Liu
OPC UA PubSub
Commits
3a221152
Commit
3a221152
authored
Jun 09, 2018
by
Patrick Bellot
Browse files
EDP
parent
0ee7fe44
Changes
9
Hide whitespace changes
Inline
Side-by-side
opcua-client/client/Client_03_Read_Write/Client_03.h
View file @
3a221152
...
...
@@ -38,8 +38,8 @@ public:
void
run
()
{
int
nbExt
=
1000
0
;
// 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
=
100
0
;
// 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
...
...
opcua-client/client/Client_03_Read_Write/StartClients_03.h
View file @
3a221152
...
...
@@ -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
;
...
...
opcua-client/client/OpcUa_BaseError.h
View file @
3a221152
...
...
@@ -89,8 +89,6 @@ public:
sessionActivated
(
false
),
responsesQueue
(
new
SyncQueue
<
BaseDataType
>
(
MAX_RESPONSES_PER_CLIENT
)),
noEvent
(
1
),
noResp
(
1
)
,
disconnect
(
0
),
...
...
opcua-client/client/main.cpp
View file @
3a221152
...
...
@@ -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
)
;
}
...
...
opcua-client/client/s2opc_server/S2OPC_Services.cpp
View file @
3a221152
...
...
@@ -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_i
i
(
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
ActivateSession
Respone 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
CloseSession
Respone 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
Read
Respone 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
)
;
}
...
...
opcua-client/linux.sh
View file @
3a221152
...
...
@@ -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
opcua-client/linux_valgrind.sh
View file @
3a221152
...
...
@@ -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
opcua/lib/OpcUa.h
View file @
3a221152
...
...
@@ -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)
...
...
opcua/lib/Utils/OpcUa_Sequence.h
View file @
3a221152
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment