#include <boost/algorithm/string.hpp>
#define TARGET_IP_V4 "10.144.169.70"
-#define TARGET_IP_V6 "fe80::213:21ff:feb5:555a%eth0"
+//#define TARGET_IP_V6 "fe80::213:21ff:feb5:555a%eth0"
+#define TARGET_IP_V6 "2001::10"
#define TARGET_HOSTNAME "um08"
+#define REPLICATION_PORT "40000"
+#define RECV_IP_V4 "10.144.169.70"
+//#define RECV_IP_V6 "fe80::213:21ff:feb5:555a%eth0"
+#define RECV_IP_V6 "2001::10"
int get_string_stubmode = 0;
int get_int_stubmode = 0;
TARGET_IP_V6
};
+char recv_ip_table[][256] = {
+ RECV_IP_V4,
+ RECV_IP_V6
+};
+
char get_string_table[][ 256 ] = {
TARGET_IP_V4, // "ip_addr"
- "40000", // "service_name"
- "eth0", // "nic"
+ REPLICATION_PORT, // "service_name"
+ RECV_IP_V4, // "recv_ip_addr"
"virtualservice", // "cmponent_id_00"
"chash", // "cmponent_id_01"
"sslid", // "cmponent_id_02"
boost::asio::io_service global_receive_io;
boost::asio::io_service global_send_io;
-void receiver_thread( const char* target_ip ){
- //boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( target_ip ), 40000 );
- boost::asio::ip::udp::endpoint udp_endpoint( make_endpoint<boost::asio::ip::udp>( target_ip, "40000" ) );
+void receiver_thread( const char* recv_ip ){
+ //boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( recv_ip ), 40000 );
+ boost::asio::ip::udp::endpoint udp_endpoint( make_endpoint<boost::asio::ip::udp>( recv_ip, REPLICATION_PORT ) );
boost::asio::ip::udp::socket receiver_socket( global_receive_io, udp_endpoint );
char *recv_memory;
void sender2_thread( const char* target_ip ){
// boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( target_ip, 40000 );
- boost::asio::ip::udp::endpoint udp_endpoint( make_endpoint<boost::asio::ip::udp>( target_ip, "40000" ) );
+ boost::asio::ip::udp::endpoint udp_endpoint( make_endpoint<boost::asio::ip::udp>( target_ip, REPLICATION_PORT ) );
// boost::asio::ip::udp::socket sender_socket( global_send_io, udp_endpoint );
boost::asio::ip::udp::socket sender_socket( global_send_io );
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
BOOST_CHECK_EQUAL( repli1.initialize(), -1 );
BOOST_CHECK_EQUAL( repli1.get_status(), l7vs::replication::REPLICATION_SINGLE );
- // unit_test[6] initializeのテスト(nicが存在しない)
+ // unit_test[6] initializeのテスト(recv_ip_addrが存在しない)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
get_string_stubmode = 3;
repli1.finalize();
BOOST_CHECK_EQUAL( repli1.initialize(), -1 );
BOOST_CHECK_EQUAL( repli1.get_status(), l7vs::replication::REPLICATION_SINGLE );
- // unit_test[11] initializeのテスト(nicが不正)
+ // unit_test[11] initializeのテスト(recv_ip_addrが不正)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
get_string_stubmode = 103;
repli1.finalize();
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
BOOST_CHECK_EQUAL( repli1.get_status(), l7vs::replication::REPLICATION_MASTER );
receiver_end = false;
- boost::thread thread_item1( boost::bind ( &receiver_thread, target_ip_table[proto] ) );
+ boost::thread thread_item1( boost::bind ( &receiver_thread, recv_ip_table[proto] ) );
repli1.force_replicate();
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
repli1.switch_to_master();
receiver_end = false;
- boost::thread thread_item1( boost::bind ( &receiver_thread, target_ip_table[proto] ) );
+ boost::thread thread_item1( boost::bind ( &receiver_thread, recv_ip_table[proto] ) );
// unit_test[141] send_thread&handle_sendのテスト(MASTER時)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_string_stubmode = 0;
get_int_stubmode = 0;
strcpy( get_string_table[0], target_ip_table[proto] ); // "ip_addr"
- strcpy( get_string_table[1], "40000" ); // "service_name"
- strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[1], REPLICATION_PORT ); // "service_name"
+ strcpy( get_string_table[2], recv_ip_table[proto] ); // "recv_ip_addr"
strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
{
receiver_end = false;
- boost::thread thread_item( boost::bind ( &receiver_thread, target_ip_table[proto] ) );
+ boost::thread thread_item( boost::bind ( &receiver_thread, recv_ip_table[proto] ) );
while( !receiver_end ){
global_receive_io.poll();