-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEDPClient.patch
More file actions
55 lines (51 loc) · 1.99 KB
/
EDPClient.patch
File metadata and controls
55 lines (51 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp
index 5dbba3856..bb08d4a2f 100644
--- a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp
+++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp
@@ -37,6 +37,26 @@ namespace rtps {
using namespace fastrtps::rtps;
+//////////////////////////////// PATCH ////////////////////////////////
+// add the topics name you want allow (specific namespaces can be discarded e.g., /robot_1/cmd_vel, /robot_2/cmd_vel)
+const std::vector<std::string> allowed_remote_topic_list = {
+ "/cmd_vel"
+};
+
+static bool is_allowed(eprosima::fastrtps::string_255& topic)
+{
+ std::string _topic = topic.to_string();
+
+ for(auto allowed_pattern : allowed_remote_topic_list)
+ {
+ if (_topic.find(allowed_pattern) != std::string::npos) {
+ return true;
+ }
+ }
+ return false;
+}
+///////////////////////////////////////////////////////////////////////
+
bool EDPClient::processLocalReaderProxyData(
RTPSReader* local_reader,
ReaderProxyData* rdata)
@@ -53,6 +73,11 @@ bool EDPClient::processLocalReaderProxyData(
}
#endif // if HAVE_SECURITY
+//////////////////////////////// PATCH ////////////////////////////////
+ if(!is_allowed(rdata->topicName()))
+ return true;
+///////////////////////////////////////////////////////////////////////
+
CacheChange_t* change = nullptr;
bool ret_val = serialize_reader_proxy_data(*rdata, *writer, true, &change);
if (change != nullptr)
@@ -86,6 +111,11 @@ bool EDPClient::processLocalWriterProxyData(
}
#endif // if HAVE_SECURITY
+//////////////////////////////// PATCH ////////////////////////////////
+ if(!is_allowed(wdata->topicName()))
+ return true;
+///////////////////////////////////////////////////////////////////////
+
CacheChange_t* change = nullptr;
bool ret_val = serialize_writer_proxy_data(*wdata, *writer, true, &change);
if (change != nullptr)