Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
osie
Commits
15d8762c
Commit
15d8762c
authored
Feb 10, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Network interface
See merge request
nexedi/osie!24
parents
dc273b64
70f3a710
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
coupler/cli.h
coupler/cli.h
+8
-1
coupler/keep_alive.h
coupler/keep_alive.h
+3
-0
coupler/keep_alive_publisher.h
coupler/keep_alive_publisher.h
+4
-0
coupler/keep_alive_subscriber.h
coupler/keep_alive_subscriber.h
+4
-0
No files found.
coupler/cli.h
View file @
15d8762c
...
@@ -23,7 +23,7 @@ static struct argp_option options[] = {
...
@@ -23,7 +23,7 @@ static struct argp_option options[] = {
{
"heart-beat-id-list"
,
'l'
,
""
,
0
,
"Comma separated list of IDs of couplers to watch for heart beats. \
{
"heart-beat-id-list"
,
'l'
,
""
,
0
,
"Comma separated list of IDs of couplers to watch for heart beats. \
If a heart beat is missing coupler goes to safe mode."
},
If a heart beat is missing coupler goes to safe mode."
},
{
"network-address-url-data-type"
,
'n'
,
"opc.udp://224.0.0.22:4840/"
,
0
,
"Network address URL type used for Pub/Sub."
},
{
"network-address-url-data-type"
,
'n'
,
"opc.udp://224.0.0.22:4840/"
,
0
,
"Network address URL type used for Pub/Sub."
},
{
"network-interface"
,
'j'
,
""
,
0
,
"Network interface to use for Pub/Sub."
},
{
0
}
{
0
}
};
};
...
@@ -44,6 +44,7 @@ struct arguments
...
@@ -44,6 +44,7 @@ struct arguments
int
heart_beat_timeout_interval
;
int
heart_beat_timeout_interval
;
char
*
heart_beat_id_list
;
char
*
heart_beat_id_list
;
char
*
network_address_url_data_type
;
char
*
network_address_url_data_type
;
char
*
network_interface
;
};
};
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
...
@@ -95,6 +96,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
...
@@ -95,6 +96,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
case
'n'
:
case
'n'
:
arguments
->
network_address_url_data_type
=
arg
;
arguments
->
network_address_url_data_type
=
arg
;
break
;
break
;
case
'j'
:
arguments
->
network_interface
=
arg
;
break
;
case
ARGP_KEY_ARG
:
case
ARGP_KEY_ARG
:
return
0
;
return
0
;
default:
default:
...
@@ -128,6 +132,7 @@ void handleCLI(int argc, char **argv) {
...
@@ -128,6 +132,7 @@ void handleCLI(int argc, char **argv) {
arguments
.
heart_beat_timeout_interval
=
DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL
;
arguments
.
heart_beat_timeout_interval
=
DEFAULT_HEART_BEAT_TIMEOUT_INTERVAL
;
arguments
.
heart_beat_id_list
=
""
;
arguments
.
heart_beat_id_list
=
""
;
arguments
.
network_address_url_data_type
=
NETWORK_ADDRESS_URL_DATA_TYPE
;
arguments
.
network_address_url_data_type
=
NETWORK_ADDRESS_URL_DATA_TYPE
;
arguments
.
network_interface
=
""
;
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
arguments
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
arguments
);
printf
(
"Mode=%d
\n
"
,
arguments
.
mode
);
printf
(
"Mode=%d
\n
"
,
arguments
.
mode
);
...
@@ -143,6 +148,7 @@ void handleCLI(int argc, char **argv) {
...
@@ -143,6 +148,7 @@ void handleCLI(int argc, char **argv) {
printf
(
"Heart beat timeout interval=%d ms
\n
"
,
arguments
.
heart_beat_timeout_interval
);
printf
(
"Heart beat timeout interval=%d ms
\n
"
,
arguments
.
heart_beat_timeout_interval
);
printf
(
"Heart beat ID list=%s
\n
"
,
arguments
.
heart_beat_id_list
);
printf
(
"Heart beat ID list=%s
\n
"
,
arguments
.
heart_beat_id_list
);
printf
(
"Network address URL data type=%s
\n
"
,
arguments
.
network_address_url_data_type
);
printf
(
"Network address URL data type=%s
\n
"
,
arguments
.
network_address_url_data_type
);
printf
(
"Network interface=%s
\n
"
,
arguments
.
network_interface
);
// transfer to global variables (CLI input)
// transfer to global variables (CLI input)
COUPLER_ID
=
arguments
.
id
;
COUPLER_ID
=
arguments
.
id
;
...
@@ -152,6 +158,7 @@ void handleCLI(int argc, char **argv) {
...
@@ -152,6 +158,7 @@ void handleCLI(int argc, char **argv) {
PUBLISHING_INTERVAL
=
HEART_BEAT_INTERVAL
;
// we assume that each heart_beat leads to a publish event
PUBLISHING_INTERVAL
=
HEART_BEAT_INTERVAL
;
// we assume that each heart_beat leads to a publish event
HEART_BEAT_TIMEOUT_INTERVAL
=
arguments
.
heart_beat_timeout_interval
;
HEART_BEAT_TIMEOUT_INTERVAL
=
arguments
.
heart_beat_timeout_interval
;
NETWORK_ADDRESS_URL_DATA_TYPE
=
arguments
.
network_address_url_data_type
;
NETWORK_ADDRESS_URL_DATA_TYPE
=
arguments
.
network_address_url_data_type
;
NETWORK_INTERFACE
=
arguments
.
network_interface
;
USERNAME
=
arguments
.
username
;
USERNAME
=
arguments
.
username
;
PASSWORD
=
arguments
.
password
;
PASSWORD
=
arguments
.
password
;
OPC_UA_PORT
=
arguments
.
port
;
OPC_UA_PORT
=
arguments
.
port
;
...
...
coupler/keep_alive.h
View file @
15d8762c
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
char
*
DEFAULT_TRANSPORT_PROFILE
=
"http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp"
;
char
*
DEFAULT_TRANSPORT_PROFILE
=
"http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp"
;
char
*
NETWORK_ADDRESS_URL_DATA_TYPE
=
"opc.udp://224.0.0.22:4840/"
;
char
*
NETWORK_ADDRESS_URL_DATA_TYPE
=
"opc.udp://224.0.0.22:4840/"
;
//network interface to use for Pub / Sub
char
*
NETWORK_INTERFACE
=
""
;
// global HEART BEATs of coupler
// global HEART BEATs of coupler
static
unsigned
int
HEART_BEATS
=
0
;
static
unsigned
int
HEART_BEATS
=
0
;
...
...
coupler/keep_alive_publisher.h
View file @
15d8762c
...
@@ -15,6 +15,10 @@ static void addPubSubConnection(UA_Server *server, UA_String *transportProfile,
...
@@ -15,6 +15,10 @@ static void addPubSubConnection(UA_Server *server, UA_String *transportProfile,
connectionConfig
.
name
=
UA_STRING
(
"UADP Connection 1"
);
connectionConfig
.
name
=
UA_STRING
(
"UADP Connection 1"
);
connectionConfig
.
transportProfileUri
=
*
transportProfile
;
connectionConfig
.
transportProfileUri
=
*
transportProfile
;
connectionConfig
.
enabled
=
UA_TRUE
;
connectionConfig
.
enabled
=
UA_TRUE
;
if
(
strlen
(
NETWORK_INTERFACE
)
>
0
){
// set preferred network interface for Pub / Sub
networkAddressUrl
->
networkInterface
=
UA_STRING
(
NETWORK_INTERFACE
);
}
UA_Variant_setScalar
(
&
connectionConfig
.
address
,
networkAddressUrl
,
UA_Variant_setScalar
(
&
connectionConfig
.
address
,
networkAddressUrl
,
&
UA_TYPES
[
UA_TYPES_NETWORKADDRESSURLDATATYPE
]);
&
UA_TYPES
[
UA_TYPES_NETWORKADDRESSURLDATATYPE
]);
/* Changed to static publisherId from random generation to identify
/* Changed to static publisherId from random generation to identify
...
...
coupler/keep_alive_subscriber.h
View file @
15d8762c
...
@@ -89,6 +89,10 @@ static UA_StatusCode addPubSubConnectionSubscriber(UA_Server *server, UA_String
...
@@ -89,6 +89,10 @@ static UA_StatusCode addPubSubConnectionSubscriber(UA_Server *server, UA_String
connectionConfig
.
name
=
UA_STRING
(
"UDPMC Connection 1"
);
connectionConfig
.
name
=
UA_STRING
(
"UDPMC Connection 1"
);
connectionConfig
.
transportProfileUri
=
*
transportProfile
;
connectionConfig
.
transportProfileUri
=
*
transportProfile
;
connectionConfig
.
enabled
=
UA_TRUE
;
connectionConfig
.
enabled
=
UA_TRUE
;
if
(
strlen
(
NETWORK_INTERFACE
)
>
0
){
// set preferred network interface for Pub / Sub
networkAddressUrl
->
networkInterface
=
UA_STRING
(
NETWORK_INTERFACE
);
}
UA_Variant_setScalar
(
&
connectionConfig
.
address
,
networkAddressUrl
,
UA_Variant_setScalar
(
&
connectionConfig
.
address
,
networkAddressUrl
,
&
UA_TYPES
[
UA_TYPES_NETWORKADDRESSURLDATATYPE
]);
&
UA_TYPES
[
UA_TYPES_NETWORKADDRESSURLDATATYPE
]);
connectionConfig
.
publisherId
.
numeric
=
UA_UInt32_random
();
connectionConfig
.
publisherId
.
numeric
=
UA_UInt32_random
();
...
...
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