Skip to content

Commit ba5c948

Browse files
Merge pull request #49 from connectivecpp/deutsch_python_monitor
Split monitor_msg_handling.hpp into two separate classes
2 parents 6e2bc41 + 1544a9d commit ba5c948

File tree

4 files changed

+108
-42
lines changed

4 files changed

+108
-42
lines changed

test/test_data_blaster/monitor_msg_handling.hpp renamed to test/test_data_blaster/monitor_connector.hpp

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*
1414
*/
1515

16-
#ifndef MONITOR_MSG_HANDLING_HPP_INCLUDED
17-
#define MONITOR_MSG_HANDLING_HPP_INCLUDED
16+
#ifndef MONITOR_CONNECTOR_HPP_INCLUDED
17+
#define MONITOR_CONNECTOR_HPP_INCLUDED
1818

1919
#include <string>
2020
#include <string_view>
@@ -23,42 +23,17 @@
2323
#include <utility> // std::move
2424
#include <type_traits> // std::is_same
2525

26+
#include "asio/ip/basic_endpoint.hpp"
27+
2628
#include "net_ip/net_ip.hpp"
2729
#include "net_ip/net_entity.hpp"
2830
#include "net_ip_component/error_delivery.hpp"
2931

30-
#include "asio/ip/basic_endpoint.hpp"
32+
#include "test_data_blaster/monitor_msg.hpp"
3133

3234
namespace chops {
3335
namespace test {
3436

35-
template <typename AsioIpProtocol>
36-
std::string format_addr (const asio::ip::basic_endpoint<AsioIpProtocol>& endpoint) {
37-
return endpoint.address().to_string() + ":" + std::to_string(endpoint.port());
38-
}
39-
40-
struct monitor_msg_data {
41-
42-
static constexpr std::size_t max_msg_data_to_capture = 15;
43-
enum msg_direction { incoming, outgoing };
44-
45-
std::string m_dsr_name;
46-
std::string m_protocol; // "tcp" or "udp"
47-
std::string m_remote_addr; // in "host:port" format, see format_addr above
48-
msg_direction m_direction;
49-
std::size_t m_curr_msg_num;
50-
std::size_t m_curr_msg_size;
51-
std::string m_curr_msg_beginning; // up to max_msg_data_to_capture chars
52-
std::size_t m_total_msgs_to_send; // 0 if direction is incoming, since total not known in advance
53-
std::size_t m_outgoing_queue_size;
54-
55-
};
56-
57-
struct shutdown_msg {
58-
// to be filled in
59-
};
60-
61-
6237
// shutdown message from monitor process will set promise, which causes future to pop, which
6338
// tells DSR to shutdown
6439
class monitor_connector {
@@ -90,16 +65,5 @@ class monitor_connector {
9065

9166
};
9267

93-
inline chops::const_shared_buffer marshall_monitor_msg_data (const monitor_msg_data& msg_data) {
94-
95-
}
96-
97-
inline monitor_msg_data unmarshall_monitor_msg_data (const chops::const_shared_buffer& buf) {
98-
9968
}
100-
101-
} // end namespace test
102-
} // end namespace chops
103-
104-
#endif
105-
69+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/** @file
2+
*
3+
* @ingroup test_module
4+
*
5+
* @brief Unit tests for monitor_connector.hpp
6+
*
7+
* @author (fill in)
8+
*
9+
* Copyright (c) 2019 by Cliff Green, (fill in)
10+
*
11+
* Distributed under the Boost Software License, Version 1.0.
12+
* (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13+
*
14+
*/
15+
16+
#include "catch2/catch.hpp"
17+
#include "test_data_blaster/monitor_connector.hpp"
18+
19+
TEST_CASE("monitor connector test", "[monitor_connector_test]") {
20+
21+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/** @file
2+
*
3+
* @ingroup test_module
4+
*
5+
* @brief Data structures sent between nodes in test data blaster
6+
*
7+
* @author (fill in)
8+
*
9+
* Copyright (c) 2019 by Cliff Green, (fill in)
10+
*
11+
* Distributed under the Boost Software License, Version 1.0.
12+
* (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13+
*
14+
*/
15+
16+
#ifndef MONITOR_MSG_HPP_INCLUDED
17+
#define MONITOR_MSG_HPP_INCLUDED
18+
19+
#include <string>
20+
#include <string_view>
21+
22+
#include "net_ip/net_ip.hpp"
23+
#include "net_ip/net_entity.hpp"
24+
#include "net_ip_component/error_delivery.hpp"
25+
26+
#include "asio/ip/basic_endpoint.hpp"
27+
28+
namespace chops {
29+
namespace test {
30+
31+
32+
template <typename AsioIpProtocol>
33+
std::string format_addr (const asio::ip::basic_endpoint<AsioIpProtocol>& endpoint) {
34+
return endpoint.address().to_string() + ":" + std::to_string(endpoint.port());
35+
}
36+
37+
struct monitor_msg_data {
38+
39+
static constexpr std::size_t max_msg_data_to_capture = 15;
40+
enum msg_direction { incoming, outgoing };
41+
42+
std::string m_dsr_name;
43+
std::string m_protocol; // "tcp" or "udp"
44+
std::string m_remote_addr; // in "host:port" format, see format_addr above
45+
msg_direction m_direction;
46+
std::size_t m_curr_msg_num;
47+
std::size_t m_curr_msg_size;
48+
std::string m_curr_msg_beginning; // up to max_msg_data_to_capture chars
49+
std::size_t m_total_msgs_to_send; // 0 if direction is incoming, since total not known in advance
50+
std::size_t m_outgoing_queue_size;
51+
52+
};
53+
54+
struct shutdown_msg {
55+
// to be filled in
56+
};
57+
58+
59+
inline chops::const_shared_buffer marshall_monitor_msg_data (const monitor_msg_data& msg_data) {
60+
// work in progress
61+
return null;
62+
}
63+
64+
inline monitor_msg_data unmarshall_monitor_msg_data (const chops::const_shared_buffer& buf) {
65+
// work in progress
66+
return null;
67+
}
68+
69+
inline chops::const_shared_buffer marshall_shutdown_message() {
70+
// work in progress
71+
return null;
72+
}
73+
74+
inline std::string unmarshall_shutdown_message() {
75+
// work in progress
76+
return null;
77+
}
78+
79+
80+
}
81+
}
File renamed without changes.

0 commit comments

Comments
 (0)