...
 
Commits (2)
......@@ -42,6 +42,14 @@ CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.10"
CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.255.0"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2"
CONFIG_PUBLISHER_ADDRESS="232.1.2.100:4840"
CONFIG_SUBSCRIBER_ADDRESS="232.1.2.101:4840"
CONFIG_ETH_NATIVE_POSIX_DRV_NAME="zeth"
CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:01"
CONFIG_NET_PROMISCUOUS_MODE=y
# MbedTLS
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_DTLS=y
......
......@@ -5,7 +5,6 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(pubsub_test_server)
add_definitions (-DWITH_STATIC_SECURITY_DATA=1 -DPUBSUB_STATIC_CONFIG=1 -DWITH_NANO_EXTENDED=1)
add_definitions (-DPUBLISHER_ADDRESS="232.1.2.100:4840" -DSUBSCRIBER_ADDRESS="232.1.2.101:4840")
add_definitions (-DPUBLISH_PERIOD=1000 -DSUBSCRIBE_PERIOD=1000)
# add_definitions (-DDEBUG_PUBSUB_SCHEDULER_INFO=1)
......
......@@ -38,10 +38,19 @@ CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_PROMISCUOUS_MODE=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.10"
CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.255.0"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2"
CONFIG_PUBLISHER_ADDRESS="232.1.2.100:4840"
CONFIG_SUBSCRIBER_ADDRESS="232.1.2.101:4840"
CONFIG_ETH_NATIVE_POSIX_DRV_NAME="zeth"
CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:01"
# MbedTLS
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_DTLS=y
......
......@@ -31,12 +31,16 @@
#define SUBSCRIBE_PERIOD 1000
#endif
#ifndef PUBLISHER_ADDRESS
#ifndef CONFIG_PUBLISHER_ADDRESS
#define PUBLISHER_ADDRESS "232.1.2.100:4840"
#else
#define PUBLISHER_ADDRESS CONFIG_PUBLISHER_ADDRESS
#endif
#ifndef SUBSCRIBER_ADDRESS
#ifndef CONFIG_SUBSCRIBER_ADDRESS
#define SUBSCRIBER_ADDRESS "232.1.2.101:4840"
#else
#define SUBSCRIBER_ADDRESS CONFIG_SUBSCRIBER_ADDRESS
#endif
static SOPC_DataSetWriter* SOPC_PubSubConfig_SetPubMessageAt(SOPC_PubSubConnection* connection,
......
......@@ -140,11 +140,17 @@ SOPC_ReturnStatus P_MULTICAST_join_or_leave_mcast_group(int32_t sock, struct in_
if (SOPC_INVALID_SOCKET == sock || NULL == pAddr)
{
#if P_MULTICAST_DEBUG == 1
printk("\r\nP_MULTICAST: Enter join_mcast_group invalid socket\r\n");
#endif
return SOPC_STATUS_INVALID_PARAMETERS;
}
if (!net_ipv4_is_addr_mcast(pAddr))
{
#if P_MULTICAST_DEBUG == 1
printk("\r\nP_MULTICAST: Enter join_mcast_group not mcast addr\r\n");
#endif
return SOPC_STATUS_INVALID_PARAMETERS;
}
......@@ -377,6 +383,10 @@ SOPC_ReturnStatus P_MULTICAST_join_or_leave_mcast_group(int32_t sock, struct in_
}
} while ((MULTCAST_STATUS_INITIALIZED != expectedStatus) && (status != SOPC_STATUS_INVALID_STATE));
#if P_MULTICAST_DEBUG == 1
printk("\r\nP_MULTICAST: Exit join_mcast_group\r\n");
#endif
return status;
}
......@@ -483,13 +493,18 @@ void P_MULTICAST_remove_sock_from_mcast(int32_t sock)
{
return;
}
struct in_addr addr;
addr.s_addr = 0;
// Remove socket from mcast and remove mcast if necessary
for (uint32_t i = 0; i < MAX_MCAST; i++)
{
for (uint32_t j = 0; j < MAX_ZEPHYR_SOCKET; j++)
{
(void) P_MULTICAST_join_or_leave_mcast_group(sock, &tabMCast[i].addr, false);
__atomic_load(&tabMCast[i].addr.s_addr, &addr.s_addr, __ATOMIC_SEQ_CST);
if (addr.s_addr != 0)
{
(void) P_MULTICAST_join_or_leave_mcast_group(sock, &addr, false);
}
}
}
#if P_MULTICAST_DEBUG == 1
......
......@@ -7,3 +7,18 @@ menuconfig S2OPC
bool "S2OPC Support"
help
This option enables the S2OPC library.
config PUBLISHER_ADDRESS
string "Publisher address"
default "232.1.2.100:4840"
depends on S2OPC
help
This value is used by PubSub sample
config SUBSCRIBER_ADDRESS
string "Subscriber address"
default "232.1.2.101:4840"
depends on S2OPC
help
This value is used by PubSub sample