Changeset 5284
- Timestamp:
- Jul 24, 2009, 3:23:11 PM (15 years ago)
- Files:
-
- 89 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
etc/pingpong/settings_initiator.cnf
r2483 r5284 1 #node.name = marty2 1 node.initiator = true 3 #ariba.ip.addr = 4 ariba.tcp.port = 5002 5 #ariba.udp.port = 6 #ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 2 ariba.endpoints = tcp{5002} 3 #ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 4 pingpong.name = Marty 5 -
etc/pingpong/settings_node1.cnf
r2454 r5284 1 1 #node.name = docbrown 2 2 node.initiator = false 3 #ariba.ip.addr = 4 ariba.tcp.port = 5003 5 #ariba.udp.port = 6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 3 ariba.endpoints = tcp{5003} 4 ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 5 pingpong.name = Biff 7 6 -
etc/pingpong/settings_node2.cnf
r2483 r5284 1 1 #node.name = biff 2 2 node.initiator = false 3 #ariba.ip.addr = 4 ariba.tcp.port = 5004 5 #ariba.udp.port = 6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 7 3 ariba.endpoints = tcp{5004} 4 ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 5 pingpong.name = McFly -
etc/pingpong/settings_node3.cnf
r3690 r5284 1 1 #node.name = biff 2 2 node.initiator = false 3 #ariba.ip.addr = 4 ariba.tcp.port = 5005 5 #ariba.udp.port = 6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 3 ariba.endpoints = tcp{5005} 4 ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 5 pingpong.name = DocBrown 7 6 -
etc/pingpong/settings_node4.cnf
r3690 r5284 1 1 #node.name = biff 2 2 node.initiator = false 3 #ariba.ip.addr = 4 ariba.tcp.port = 5006 5 #ariba.udp.port = 6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 7 3 ariba.endpoints = tcp{5006} 4 ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 5 pingpong.name = Sebastian -
etc/pingpong/settings_node5.cnf
r3690 r5284 1 1 #node.name = biff 2 2 node.initiator = false 3 #ariba.ip.addr = 4 ariba.tcp.port = 5007 5 #ariba.udp.port = 6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})} 3 ariba.endpoints = tcp{5007} 4 ariba.bootstrap.hints=pingpong{ip{127.0.0.1};tcp{5002}} 5 pingpong.name=DocBrown 7 6 7 -
sample/pingpong/PingPong.cpp
r5151 r5284 49 49 50 50 // configure ariba module 51 if (config.exists("ariba.ip.addr")) ariba->setProperty("ip.addr", 52 config.read<string>("ariba.ip.addr")); 53 if (config.exists("ariba.tcp.port")) ariba->setProperty("tcp.port", 54 config.read<string>("ariba.tcp.port")); 55 if (config.exists("ariba.udp.port")) ariba->setProperty("udp.port", 56 config.read<string>("ariba.udp.port")); 57 if (config.exists("ariba.bootstrap.hints")) ariba->setProperty("bootstrap.hints", 58 config.read<string>("ariba.bootstrap.hints")); 59 if (config.exists("pingpong.name")) name = 60 config.read<string>("pingpong.name"); 51 if (config.exists("ariba.endpoints")) 52 ariba->setProperty("endpoints", config.read<string>("ariba.endpoints")); 53 if (config.exists("ariba.bootstrap.hints")) 54 ariba->setProperty("bootstrap.hints", config.read<string>("ariba.bootstrap.hints")); 55 if (config.exists("pingpong.name")) 56 name = config.read<string>("pingpong.name"); 61 57 62 58 // start ariba module -
source/ariba/AribaModule.cpp
r4065 r5284 50 50 #include "ariba/communication/BaseCommunication.h" 51 51 #include "ariba/communication/EndpointDescriptor.h" 52 #include "ariba/communication/modules/network/NetworkLocator.h"53 52 54 53 using namespace ariba::utility::Helper; … … 58 57 namespace ariba { 59 58 59 use_logging_cpp(AribaModule); 60 60 61 AribaModule::AribaModule() 61 : base_comm(NULL), sideport_sniffer(NULL), 62 ip_addr(NULL), started(false) { 63 64 // init with default values 65 66 this->tcp_port = 41402; 67 this->udp_port = 41402; 62 : base_comm(NULL), sideport_sniffer(NULL), started(false) { 68 63 } 69 64 … … 101 96 Name name(type); 102 97 EndpointDescriptor* desc = EndpointDescriptor::fromString(data); 98 logging_debug("Added bootstap info for " << type << ": " << desc->toString() ); 103 99 addBootstrapNode(name, desc); 104 100 } … … 132 128 } 133 129 134 //logging_debug( "added bootstrap info: " << getBootstrapHints() );130 logging_debug( "Added bootstrap info: " << getBootstrapHints() ); 135 131 } 136 132 … … 171 167 started = true; 172 168 base_comm = new BaseCommunication(); 169 base_comm->setEndpoints(endpoints); 173 170 } 174 171 … … 192 189 // @see Module.h 193 190 void AribaModule::setProperty(string key, string value) { 194 if (key == "ip.addr") { 195 if (ip_addr != NULL) delete ip_addr; 196 communication::IPv4Locator* loc = new communication::IPv4Locator(); 197 *loc = communication::IPv4Locator::fromString(value); 198 ip_addr = loc; 199 } 200 else if (key == "tcp.port") tcp_port = stoi(value); 201 else if (key == "udp.port") udp_port = stoi(value); 191 if (key == "endpoints") endpoints = value; 202 192 else if (key == "bootstrap.hints") addBootstrapHints(value); 203 193 } … … 205 195 // @see Module.h 206 196 const string AribaModule::getProperty(string key) const { 207 if (key == "ip.addr") return ip_addr->toString(); 208 else if (key == "tcp.port") return ultos(tcp_port); 209 else if (key == "udp.port") return ultos(udp_port); 197 if (key == "endpoints") return endpoints; // TODO: return local endpoints 210 198 else if (key == "bootstrap.hints") return getBootstrapHints(); 211 199 } … … 214 202 const vector<string> AribaModule::getProperties() const { 215 203 vector<string> properties; 216 properties.push_back("ip.addr"); 217 properties.push_back("tcp.port"); 218 properties.push_back("udp.port"); 219 properties.push_back("hints"); 204 properties.push_back("endpoints"); 205 properties.push_back("bootstrap.hints"); 220 206 return properties; 221 207 } -
source/ariba/AribaModule.h
r4065 r5284 42 42 #include <string> 43 43 #include <vector> 44 #include "ariba/utility/logging/Logging.h" 45 44 46 45 47 using std::vector; … … 58 60 namespace ariba { 59 61 62 // forward declaration 60 63 namespace communication { 61 class EndpointDescriptor; 62 class NetworkLocator; 63 } 64 namespace communication { 65 class BaseCommunication; 64 class EndpointDescriptor; 65 class BaseCommunication; 66 66 } 67 67 … … 86 86 class AribaModule: public Module { 87 87 friend class Node; 88 use_logging_h(AribaModule); 88 89 public: 89 90 /** … … 186 187 // members 187 188 string bootstrapFile; //< file with bootstrap information 189 string endpoints; 188 190 bool started; //< flag, if module has been started 189 191 … … 196 198 communication::BaseCommunication* base_comm; 197 199 SideportListener* sideport_sniffer; 198 199 // TODO: use "abstract" representations here!200 communication::NetworkLocator* ip_addr;201 uint16_t tcp_port, udp_port;202 200 }; 203 201 -
source/ariba/Makefile.am
r5151 r5284 113 113 # ------------> communication :: modules 114 114 115 nobase_libariba_la_HEADERS += \116 communication/modules/modules.h \117 communication/modules/_namespace.h115 #nobase_libariba_la_HEADERS += \ 116 # communication/modules/modules.h \ 117 # communication/modules/_namespace.h 118 118 119 119 # ------------> communication :: modules :: network 120 libariba_la_SOURCES += \ 121 communication/modules/network/NetworkLocator.cpp \ 122 communication/modules/network/NetworkProtocol.cpp 123 124 nobase_libariba_la_HEADERS += \ 125 communication/modules/network/NetworkLocator.h \ 126 communication/modules/network/NetworkProtocol.h 120 121 #libariba_la_SOURCES += \ 122 # communication/modules/network/NetworkLocator.cpp \ 123 # communication/modules/network/NetworkProtocol.cpp 124 125 #nobase_libariba_la_HEADERS += \ 126 # communication/modules/network/NetworkLocator.h \ 127 # communication/modules/network/NetworkProtocol.h 127 128 128 129 # ------------> communication :: modules :: network :: ip 129 130 130 libariba_la_SOURCES += \131 communication/modules/network/ip/IPv4Locator.cpp \132 communication/modules/network/ip/IPv4NetworkProtocol.cpp133 134 nobase_libariba_la_HEADERS += \135 communication/modules/network/ip/IPv4Locator.h \136 communication/modules/network/ip/IPv4NetworkProtocol.h131 #libariba_la_SOURCES += \ 132 # communication/modules/network/ip/IPv4Locator.cpp \ 133 # communication/modules/network/ip/IPv4NetworkProtocol.cpp 134 135 #nobase_libariba_la_HEADERS += \ 136 # communication/modules/network/ip/IPv4Locator.h \ 137 # communication/modules/network/ip/IPv4NetworkProtocol.h 137 138 138 139 # ------------> communication :: modules :: network :: omnet 139 140 140 if OMNET141 libariba_la_SOURCES += \142 communication/modules/network/omnet/OmnetNetworkProtocol.cpp143 144 nobase_libariba_la_HEADERS += \145 communication/modules/network/omnet/OmnetNetworkProtocol.h146 endif141 #if OMNET 142 #libariba_la_SOURCES += \ 143 # communication/modules/network/omnet/OmnetNetworkProtocol.cpp 144 145 #nobase_libariba_la_HEADERS += \ 146 # communication/modules/network/omnet/OmnetNetworkProtocol.h 147 #endif 147 148 148 149 #------------> communication :: modules :: transport 149 150 150 libariba_la_SOURCES += \151 communication/modules/transport/TransportLocator.cpp \152 communication/modules/transport/TransportProtocol.cpp153 154 nobase_libariba_la_HEADERS += \155 communication/modules/transport/TransportLocator.h \156 communication/modules/transport/TransportProtocol.h151 #libariba_la_SOURCES += \ 152 # communication/modules/transport/TransportLocator.cpp \ 153 # communication/modules/transport/TransportProtocol.cpp 154 155 #nobase_libariba_la_HEADERS += \ 156 # communication/modules/transport/TransportLocator.h \ 157 # communication/modules/transport/TransportProtocol.h 157 158 158 159 #------------> communication :: modules :: transport :: omnet 159 160 160 if OMNET161 libariba_la_SOURCES += \162 communication/modules/transport/omnet/AribaOmnetMessage_m.cc \163 communication/modules/transport/omnet/AribaOmnetModule.cpp164 165 nobase_libariba_la_HEADERS += \166 communication/modules/transport/omnet/AribaOmnetMessage_m.h \167 communication/modules/transport/omnet/AribaOmnetModule.h168 endif161 #if OMNET 162 #libariba_la_SOURCES += \ 163 # communication/modules/transport/omnet/AribaOmnetMessage_m.cc \ 164 # communication/modules/transport/omnet/AribaOmnetModule.cpp 165 166 #nobase_libariba_la_HEADERS += \ 167 # communication/modules/transport/omnet/AribaOmnetMessage_m.h \ 168 # communication/modules/transport/omnet/AribaOmnetModule.h 169 #endif 169 170 170 171 #------------> communication :: modules :: transport :: protlib … … 172 173 if OMNET 173 174 else 174 libariba_la_SOURCES += \175 communication/modules/transport/protlib/timer_module.cpp \176 communication/modules/transport/protlib/threadsafe_db.cpp \177 communication/modules/transport/protlib/address.cpp \178 communication/modules/transport/protlib/ie.cpp \179 communication/modules/transport/protlib/tp_over_tcp.cpp \180 communication/modules/transport/protlib/setuid.cpp \181 communication/modules/transport/protlib/tp.cpp \182 communication/modules/transport/protlib/connectionmap_uds.cpp \183 communication/modules/transport/protlib/logfile.cpp \184 communication/modules/transport/protlib/timer.cpp \185 communication/modules/transport/protlib/connectionmap.cpp \186 communication/modules/transport/protlib/fqueue.cpp \187 communication/modules/transport/protlib/threads.cpp \188 communication/modules/transport/protlib/messages.cpp \189 communication/modules/transport/protlib/queuemanager.cpp \190 communication/modules/transport/protlib/network_message.cpp \191 communication/modules/transport/protlib/configuration.cpp \192 communication/modules/transport/protlib/tp_over_uds.cpp \193 communication/modules/transport/protlib/tp_over_udp.cpp \194 communication/modules/transport/protlib/tp_over_tls_tcp.cpp \195 communication/modules/transport/protlib/fastqueue.c \196 communication/modules/transport/protlib/eclock_gettime.c \197 communication/modules/transport/protlib/testqueue.c198 199 nobase_libariba_la_HEADERS += \200 communication/modules/transport/protlib/tp_over_uds.h \201 communication/modules/transport/protlib/threadsafe_db.h \202 communication/modules/transport/protlib/configuration.h \203 communication/modules/transport/protlib/ie.h \204 communication/modules/transport/protlib/llhashers.h \205 communication/modules/transport/protlib/fqueue.h \206 communication/modules/transport/protlib/assocdata_uds.h \207 communication/modules/transport/protlib/address.h \208 communication/modules/transport/protlib/logfile.h \209 communication/modules/transport/protlib/timer.h \210 communication/modules/transport/protlib/queuemanager.h \211 communication/modules/transport/protlib/messages.h \212 communication/modules/transport/protlib/assocdata.h \213 communication/modules/transport/protlib/protlib_types.h \214 communication/modules/transport/protlib/tp_over_tcp.h \215 communication/modules/transport/protlib/tp.h \216 communication/modules/transport/protlib/threads.h \217 communication/modules/transport/protlib/connectionmap.h \218 communication/modules/transport/protlib/timer_module.h \219 communication/modules/transport/protlib/fastqueue.h \220 communication/modules/transport/protlib/tperror.h \221 communication/modules/transport/protlib/tp_over_tls_tcp.h \222 communication/modules/transport/protlib/network_message.h \223 communication/modules/transport/protlib/tp_over_udp.h \224 communication/modules/transport/protlib/setuid.h \225 communication/modules/transport/protlib/cleanuphandler.h \226 communication/modules/transport/protlib/connectionmap_uds.h175 #libariba_la_SOURCES += \ 176 # communication/modules/transport/protlib/timer_module.cpp \ 177 # communication/modules/transport/protlib/threadsafe_db.cpp \ 178 # communication/modules/transport/protlib/address.cpp \ 179 # communication/modules/transport/protlib/ie.cpp \ 180 # communication/modules/transport/protlib/tp_over_tcp.cpp \ 181 # communication/modules/transport/protlib/setuid.cpp \ 182 # communication/modules/transport/protlib/tp.cpp \ 183 # communication/modules/transport/protlib/connectionmap_uds.cpp \ 184 # communication/modules/transport/protlib/logfile.cpp \ 185 # communication/modules/transport/protlib/timer.cpp \ 186 # communication/modules/transport/protlib/connectionmap.cpp \ 187 # communication/modules/transport/protlib/fqueue.cpp \ 188 # communication/modules/transport/protlib/threads.cpp \ 189 # communication/modules/transport/protlib/messages.cpp \ 190 # communication/modules/transport/protlib/queuemanager.cpp \ 191 # communication/modules/transport/protlib/network_message.cpp \ 192 # communication/modules/transport/protlib/configuration.cpp \ 193 # communication/modules/transport/protlib/tp_over_uds.cpp \ 194 # communication/modules/transport/protlib/tp_over_udp.cpp \ 195 # communication/modules/transport/protlib/tp_over_tls_tcp.cpp \ 196 # communication/modules/transport/protlib/fastqueue.c \ 197 # communication/modules/transport/protlib/eclock_gettime.c \ 198 # communication/modules/transport/protlib/testqueue.c 199 200 #nobase_libariba_la_HEADERS += \ 201 # communication/modules/transport/protlib/tp_over_uds.h \ 202 # communication/modules/transport/protlib/threadsafe_db.h \ 203 # communication/modules/transport/protlib/configuration.h \ 204 # communication/modules/transport/protlib/ie.h \ 205 # communication/modules/transport/protlib/llhashers.h \ 206 # communication/modules/transport/protlib/fqueue.h \ 207 # communication/modules/transport/protlib/assocdata_uds.h \ 208 # communication/modules/transport/protlib/address.h \ 209 # communication/modules/transport/protlib/logfile.h \ 210 # communication/modules/transport/protlib/timer.h \ 211 # communication/modules/transport/protlib/queuemanager.h \ 212 # communication/modules/transport/protlib/messages.h \ 213 # communication/modules/transport/protlib/assocdata.h \ 214 # communication/modules/transport/protlib/protlib_types.h \ 215 # communication/modules/transport/protlib/tp_over_tcp.h \ 216 # communication/modules/transport/protlib/tp.h \ 217 # communication/modules/transport/protlib/threads.h \ 218 # communication/modules/transport/protlib/connectionmap.h \ 219 # communication/modules/transport/protlib/timer_module.h \ 220 # communication/modules/transport/protlib/fastqueue.h \ 221 # communication/modules/transport/protlib/tperror.h \ 222 # communication/modules/transport/protlib/tp_over_tls_tcp.h \ 223 # communication/modules/transport/protlib/network_message.h \ 224 # communication/modules/transport/protlib/tp_over_udp.h \ 225 # communication/modules/transport/protlib/setuid.h \ 226 # communication/modules/transport/protlib/cleanuphandler.h \ 227 # communication/modules/transport/protlib/connectionmap_uds.h 227 228 endif 228 229 229 230 #------------> communication :: modules :: transport :: tcp 230 231 231 if OMNET232 else233 libariba_la_SOURCES += \234 communication/modules/transport/tcp/TCPTransport.cpp \235 communication/modules/transport/tcp/TCPTransportLocator.cpp236 237 nobase_libariba_la_HEADERS += \238 communication/modules/transport/tcp/TCPTransport.h \239 communication/modules/transport/tcp/TCPTransportLocator.h240 endif232 #if OMNET 233 #else 234 #libariba_la_SOURCES += \ 235 # communication/modules/transport/tcp/TCPTransport.cpp \ 236 # communication/modules/transport/tcp/TCPTransportLocator.cpp 237 238 #nobase_libariba_la_HEADERS += \ 239 # communication/modules/transport/tcp/TCPTransport.h \ 240 # communication/modules/transport/tcp/TCPTransportLocator.h 241 #endif 241 242 242 243 #------------> communication :: networkinfo … … 379 380 nobase_libariba_la_HEADERS += \ 380 381 utility/measurement/PathloadMeasurement.h 382 383 #------------> utility :: addressing 384 385 libariba_la_SOURCES += \ 386 utility/addressing/ip_address.cpp \ 387 utility/addressing/tcpip_endpoint.cpp \ 388 utility/addressing/rfcomm_endpoint.cpp \ 389 utility/addressing/mac_address.cpp \ 390 utility/addressing/port_address.cpp 391 392 nobase_libariba_la_HEADERS += \ 393 utility/addressing/ip_address.hpp \ 394 utility/addressing/test_addressing.hpp \ 395 utility/addressing/tcpip_endpoint.hpp \ 396 utility/addressing/endpoint_set.hpp \ 397 utility/addressing/addressing.hpp \ 398 utility/addressing/detail/compare_to_operators.hpp \ 399 utility/addressing/detail/address_convenience.hpp \ 400 utility/addressing/rfcomm_endpoint.hpp \ 401 utility/addressing/mac_address.hpp \ 402 utility/addressing/port_address.hpp \ 403 utility/addressing/facades/to_string_v.hpp \ 404 utility/addressing/facades/address_v.hpp \ 405 utility/addressing/facades/vfacade.hpp \ 406 utility/addressing/facades/comparable_v.hpp \ 407 utility/addressing/facades/to_bytes_v.hpp 408 409 #------------> utility :: transport 410 411 libariba_la_SOURCES += \ 412 utility/transport/tcpip/tcpip.cpp \ 413 utility/transport/tcpip/protlib/timer_module.cpp \ 414 utility/transport/tcpip/protlib/setuid.cpp \ 415 utility/transport/tcpip/protlib/queuemanager.cpp \ 416 utility/transport/tcpip/protlib/messages.cpp \ 417 utility/transport/tcpip/protlib/fqueue.cpp \ 418 utility/transport/tcpip/protlib/fastqueue.c \ 419 utility/transport/tcpip/protlib/eclock_gettime.c \ 420 utility/transport/tcpip/protlib/tp_over_udp.cpp \ 421 utility/transport/tcpip/protlib/connectionmap_uds.cpp \ 422 utility/transport/tcpip/protlib/network_message.cpp \ 423 utility/transport/tcpip/protlib/threadsafe_db.cpp \ 424 utility/transport/tcpip/protlib/timer.cpp \ 425 utility/transport/tcpip/protlib/address.cpp \ 426 utility/transport/tcpip/protlib/connectionmap.cpp \ 427 utility/transport/tcpip/protlib/tp.cpp \ 428 utility/transport/tcpip/protlib/tp_over_tcp.cpp \ 429 utility/transport/tcpip/protlib/configuration.cpp \ 430 utility/transport/tcpip/protlib/ie.cpp \ 431 utility/transport/tcpip/protlib/threads.cpp \ 432 utility/transport/tcpip/protlib/logfile.cpp \ 433 utility/transport/transport_peer.cpp \ 434 utility/transport/rfcomm/rfcomm.cpp \ 435 utility/transport/asio/asio_io_service.cpp 436 437 nobase_libariba_la_HEADERS += \ 438 utility/transport/test_transport.hpp \ 439 utility/transport/tcpip/tcpip.hpp \ 440 utility/transport/transport_peer.hpp \ 441 utility/transport/transport_protocol.hpp \ 442 utility/transport/rfcomm/rfcomm.hpp \ 443 utility/transport/transport.hpp \ 444 utility/transport/asio/bluetooth_endpoint.hpp \ 445 utility/transport/asio/rfcomm.hpp \ 446 utility/transport/transport_listener.hpp \ 447 utility/transport/tcpip/protlib/threadsafe_db.h \ 448 utility/transport/tcpip/protlib/configuration.h \ 449 utility/transport/tcpip/protlib/ie.h \ 450 utility/transport/tcpip/protlib/llhashers.h \ 451 utility/transport/tcpip/protlib/fqueue.h \ 452 utility/transport/tcpip/protlib/assocdata_uds.h \ 453 utility/transport/tcpip/protlib/address.h \ 454 utility/transport/tcpip/protlib/logfile.h \ 455 utility/transport/tcpip/protlib/timer.h \ 456 utility/transport/tcpip/protlib/queuemanager.h \ 457 utility/transport/tcpip/protlib/messages.h \ 458 utility/transport/tcpip/protlib/assocdata.h \ 459 utility/transport/tcpip/protlib/protlib_types.h \ 460 utility/transport/tcpip/protlib/tp_over_tcp.h \ 461 utility/transport/tcpip/protlib/tp.h \ 462 utility/transport/tcpip/protlib/threads.h \ 463 utility/transport/tcpip/protlib/connectionmap.h \ 464 utility/transport/tcpip/protlib/timer_module.h \ 465 utility/transport/tcpip/protlib/fastqueue.h \ 466 utility/transport/tcpip/protlib/tperror.h \ 467 utility/transport/tcpip/protlib/network_message.h \ 468 utility/transport/tcpip/protlib/setuid.h \ 469 utility/transport/tcpip/protlib/cleanuphandler.h \ 470 utility/transport/tcpip/protlib/connectionmap_uds.h 381 471 382 472 #------------> utility :: messages -
source/ariba/Node.cpp
r3718 r5284 67 67 return; 68 68 } 69 ariba_mod.base_comm->start( ariba_mod.ip_addr, ariba_mod.tcp_port);69 ariba_mod.base_comm->start(); 70 70 base_overlay->start( *ariba_mod.base_comm, nodeId ); 71 71 base_overlay->joinSpoVNet( spovnetId, *ep); … … 82 82 nodeId = generateNodeId(name); 83 83 84 ariba_mod.base_comm->start( ariba_mod.ip_addr, ariba_mod.tcp_port);84 ariba_mod.base_comm->start(); 85 85 86 86 base_overlay->start( *ariba_mod.base_comm, nodeId ); -
source/ariba/communication/BaseCommunication.cpp
r5151 r5284 52 52 namespace communication { 53 53 54 #include "networkinfo/AddressDiscovery.hpp" 55 54 56 use_logging_cpp(BaseCommunication); 55 const BaseCommunication::LinkDescriptor BaseCommunication::LinkDescriptor::UNSPECIFIED; 56 57 BaseCommunication::BaseCommunication() 58 : messageReceiver(NULL), network(NULL), transport(NULL), basecommStarted(false){ 57 const BaseCommunication::LinkDescriptor 58 BaseCommunication::LinkDescriptor::UNSPECIFIED; 59 60 BaseCommunication::BaseCommunication() { 61 this->transport = NULL; 62 this->started = false; 59 63 } 60 64 … … 62 66 } 63 67 64 void BaseCommunication::start( const NetworkLocator* _locallocator, const uint16_t _listenport){65 68 void BaseCommunication::start() { 69 logging_info( "Starting up ..." ); 66 70 currentSeqnum = 0; 67 listenport = _listenport; 68 69 logging_info( "starting up base communication and creating transports ..." ); 70 logging_info( "using port " << listenport ); 71 72 // creating transports 73 logging_info( "Creating transports ..." ); 71 74 72 75 #ifdef UNDERLAY_OMNET … … 77 80 network = new OmnetNetworkProtocol( module ); 78 81 #else 79 transport = new TCPTransport( listenport ); 80 network = new IPv4NetworkProtocol(); 82 transport = new transport_peer( localDescriptor.getEndpoints() ); 81 83 #endif 82 84 83 logging_debug( "searching for local locators ..." ); 84 85 NetworkProtocol::NetworkLocatorSet locators = network->getAddresses(); 86 NetworkProtocol::NetworkLocatorSet::iterator i = locators.begin(); 87 NetworkProtocol::NetworkLocatorSet::iterator iend = locators.end(); 88 89 // 90 // choose the first locator that is not localhost 91 // 92 93 bool foundLocator = false; 94 95 for( ; i != iend; i++){ 96 logging_debug( "local locator found " << (*i)->toString() ); 97 IPv4Locator* ipv4locator = dynamic_cast<IPv4Locator*>(*i); 98 99 // TODO: which locators are find to bind to? 100 // localhost is not too bad, works when testing locally 101 // with several instances. the manual override currently 102 // enables to use an arbitrary address, guess this is fine. 103 // so the manual override also can use ANY, LOCALHOST, BROADCAST 104 105 if( *ipv4locator != IPv4Locator::LOCALHOST && 106 *ipv4locator != IPv4Locator::ANY && 107 *ipv4locator != IPv4Locator::BROADCAST ){ 108 109 ipv4locator->setPort(listenport); 110 localDescriptor.locator = ipv4locator; 111 localDescriptor.isUnspec = false; 112 logging_info( "binding to addr = " << ipv4locator->toString() ); 113 foundLocator = true; 114 break; 115 } 116 } // for( ; i != iend; i++) 117 118 119 if( _locallocator != NULL ) { 120 if( localDescriptor.locator != NULL) delete localDescriptor.locator; 121 localDescriptor.locator = new IPv4Locator( IPv4Locator::fromString( _locallocator->toString()) ); 122 localDescriptor.isUnspec = false; 123 logging_debug( "manual locator override, using locator=" << 124 localDescriptor.locator->toString() ); 125 foundLocator = true; 126 } 127 128 // if we found no local locator, exit using logging fatal 129 if( !foundLocator ) 130 logging_fatal( "did not find a useable local locator!" ); 131 132 transport->addMessageReceiver( this ); 85 logging_info( "Searching for local locators ..." ); 86 discoverEndpoints(localDescriptor.getEndpoints()); 87 logging_info( "Done. Local endpoints = " << localDescriptor.toString() ); 88 89 transport->register_listener( this ); 133 90 transport->start(); 134 91 135 92 #ifndef UNDERLAY_OMNET 136 //137 93 // bind to the network change detection 138 //139 140 94 networkMonitor.registerNotification( this ); 141 95 #endif 142 96 143 //144 97 // base comm startup done 145 // 146 147 basecommStarted = true; 148 logging_info( "base communication started up" ); 98 started = true; 99 logging_info( "Started up." ); 149 100 } 150 101 151 102 void BaseCommunication::stop() { 152 153 logging_info( "stopping base communication and transport ..." ); 103 logging_info( "Stopping transports ..." ); 154 104 155 105 transport->stop(); 156 106 delete transport; 157 delete network; 158 159 basecommStarted = false; 160 logging_info( "base communication stopped" ); 107 started = false; 108 109 logging_info( "Stopped." ); 161 110 } 162 111 163 112 bool BaseCommunication::isStarted(){ 164 return basecommStarted; 113 return started; 114 } 115 116 /// Sets the endpoints 117 void BaseCommunication::setEndpoints( string& _endpoints ) { 118 localDescriptor.getEndpoints().assign(_endpoints); 119 logging_info("Setting local end-points: " 120 << localDescriptor.getEndpoints().to_string()); 165 121 } 166 122 … … 175 131 176 132 // debug 177 logging_debug( "request to establish link" ); 178 179 // 180 // just use the first locator in the endp descriptors 181 // 182 if( descriptor.locator == NULL ){ 183 logging_error( "invalid destination endpoint" ); 184 return LinkID::UNSPECIFIED; 185 } 186 187 if( localDescriptor.locator == NULL ){ 188 logging_error( "invalid local endpoint" ); 189 return LinkID::UNSPECIFIED; 190 } 191 192 const NetworkLocator* remote = descriptor.locator; 193 const NetworkLocator* local = localDescriptor.locator; 194 195 // create link identifier and link descriptor 196 if (linkid.isUnspecified()){ 197 linkid = LinkID::create(); 198 assert(!linkid.isUnspecified()); 199 } 200 201 logging_debug( "creating new local descriptor entry with local link id " << linkid.toString() ); 202 LinkDescriptor linkDescriptor( linkid, local, LinkID::UNSPECIFIED, remote, descriptor, false ); 203 addLink( linkDescriptor ); 204 205 // 206 // create a base msg with our link id and 207 // a request to open a link on the other side 208 // 209 210 logging_debug( "sending out base messages with request to open link to " << remote->toString() ); 211 AribaBaseMsg baseMsg( 212 remote, 213 AribaBaseMsg::LINK_STATE_OPEN_REQUEST, 214 linkid, 215 LinkID::UNSPECIFIED ); 216 217 transport->sendMessage(&baseMsg); 133 logging_debug( "Request to establish link" ); 134 135 // create link identifier 136 if (linkid.isUnspecified()) linkid = LinkID::create(); 137 138 // create link descriptor 139 logging_debug( "Creating new descriptor entry with local link id=" << linkid.toString() ); 140 LinkDescriptor* ld = new LinkDescriptor(); 141 ld->localLink = linkid; 142 addLink( ld ); 143 144 // send a message to request new link to remote 145 logging_debug( "Send messages with request to open link to " << descriptor.toString() ); 146 AribaBaseMsg baseMsg( AribaBaseMsg::typeLinkRequest, linkid ); 147 baseMsg.getLocalDescriptor() = localDescriptor; 148 149 // serialize and send message 150 send( &baseMsg, descriptor ); 151 218 152 return linkid; 219 153 } … … 221 155 void BaseCommunication::dropLink(const LinkID link) { 222 156 223 logging_debug( " starting to drop link " + link.toString() );157 logging_debug( "Starting to drop link " + link.toString() ); 224 158 225 159 // see if we have the link 226 LinkDescriptor& descriptor= queryLocalLink( link );227 if( descriptor.isUnspecified() ){228 logging_error( " don't know the link you want to drop "+ link.toString() );160 LinkDescriptor& ld = queryLocalLink( link ); 161 if( ld.isUnspecified() ) { 162 logging_error( "Don't know the link you want to drop "+ link.toString() ); 229 163 return; 230 164 } 231 165 166 // tell the registered listeners 167 BOOST_FOREACH( CommunicationEvents* i, eventListener ) { 168 i->onLinkDown( link, ld.localLocator, ld.remoteLocator ); 169 } 170 232 171 // create message to drop the link 233 logging_debug( "sending out link close request. for us, the link is closed now" ); 234 AribaBaseMsg msg( 235 descriptor.remoteLocator, 236 AribaBaseMsg::LINK_STATE_CLOSE_REQUEST, 237 descriptor.localLink, 238 descriptor.remoteLink 239 ); 172 logging_debug( "Sending out link close request. for us, the link is closed now" ); 173 AribaBaseMsg msg( AribaBaseMsg::typeLinkClose, ld.localLink, ld.remoteLink ); 240 174 241 175 // send message to drop the link 242 transport->sendMessage( &msg ); 243 244 // tell the registered listeners 245 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 246 i->onLinkDown( link, descriptor.localLocator, descriptor.remoteLocator ); 247 } 176 send( &msg, ld ); 248 177 249 178 // remove from map … … 253 182 seqnum_t BaseCommunication::sendMessage( const LinkID lid, const Message* message) { 254 183 255 logging_debug( " sending out message to link " << lid.toString() );184 logging_debug( "Sending out message to link " << lid.toString() ); 256 185 257 186 // query local link info 258 LinkDescriptor& l inkDesc= queryLocalLink(lid);259 if( l inkDesc.isUnspecified() ){260 logging_error( " don't know the link with id " << lid.toString() );187 LinkDescriptor& ld = queryLocalLink(lid); 188 if( ld.isUnspecified() ){ 189 logging_error( "Don't know the link with id " << lid.toString() ); 261 190 return -1; 262 191 } 263 192 193 // link not up-> error 194 if( !ld.up ) { 195 logging_error("Can not send on link " << lid.toString() << ": link not up"); 196 return -1; 197 } 198 264 199 // create message 265 AribaBaseMsg msg( 266 linkDesc.remoteLocator, 267 AribaBaseMsg::LINK_STATE_DATA, 268 linkDesc.localLink, 269 linkDesc.remoteLink 270 ); 200 AribaBaseMsg msg( AribaBaseMsg::typeData, ld.localLink, ld.remoteLink ); 271 201 272 202 // encapsulate the payload message 273 203 msg.encapsulate( const_cast<Message*>(message) ); 274 204 275 if( !linkDesc.linkup ){276 logging_error("cant send message on link " << lid.toString() << ", link not up");277 return -1;278 }279 280 205 // send message 281 transport->sendMessage( &msg ); 206 send( &msg, ld ); 207 208 // return sequence number 282 209 return ++currentSeqnum; 283 210 } 284 211 285 212 const EndpointDescriptor& BaseCommunication::getEndpointDescriptor(const LinkID link) const { 286 287 213 if( link == LinkID::UNSPECIFIED){ 288 214 return localDescriptor; … … 294 220 } 295 221 296 void BaseCommunication::registerMessageReceiver(MessageReceiver* _receiver) {297 messageReceiver = _receiver;298 }299 300 void BaseCommunication::unregisterMessageReceiver(MessageReceiver* _receiver) {301 messageReceiver = NULL;302 }303 304 222 void BaseCommunication::registerEventListener(CommunicationEvents* _events){ 305 306 223 if( eventListener.find( _events ) == eventListener.end() ) 307 224 eventListener.insert( _events ); … … 309 226 310 227 void BaseCommunication::unregisterEventListener(CommunicationEvents* _events){ 311 312 228 EventListenerSet::iterator i = eventListener.find( _events ); 313 229 if( i != eventListener.end() ) … … 315 231 } 316 232 317 318 bool BaseCommunication::receiveMessage(const Message* message, const LinkID& /*invalid*/, const NodeID& ){ 319 320 // 321 // these messages arrive from the Transport module 322 // and are incoming network messages. Unpack the 323 // AribaBaseMsg and handle control packets, 324 // deliver data packets to the overlay 325 // 326 327 AribaBaseMsg* spovmsg = ((Message*)message)->decapsulate<AribaBaseMsg>(); 328 logging_debug( "receiving base comm message of type " << spovmsg->getTypeString() ); 329 330 // 331 // deliver data to the overlays. we just give the 332 // inner packet to every registered overlay ... 333 // 334 335 if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_DATA ){ 336 337 logging_debug( "received data message, forwarding to overlay" ); 338 339 // 340 // put the linkid as address into the message 341 // and sent it to the receiver 342 // 343 344 if( messageReceiver != NULL ) { 345 messageReceiver->receiveMessage( 346 spovmsg, 347 spovmsg->getRemoteLink(), 348 NodeID::UNSPECIFIED 233 SystemEventType TransportEvent("Transport"); 234 SystemEventType MessageDispatchEvent("MessageDispatchEvent", TransportEvent ); 235 236 class DispatchMsg { 237 public: 238 address_v* local; 239 address_v* remote; 240 Message* message; 241 }; 242 243 /// called when a system event is emitted by system queue 244 void BaseCommunication::handleSystemEvent(const SystemEvent& event) { 245 246 // dispatch received messages 247 if ( event.getType() == MessageDispatchEvent ){ 248 logging_debug( "Forwarding message receiver" ); 249 DispatchMsg* dmsg = event.getData<DispatchMsg>(); 250 Message* msg = dmsg->message; 251 receiveMessage(msg, dmsg->local, dmsg->remote); 252 msg->dropPayload(); 253 delete dmsg; 254 delete msg; 255 } 256 } 257 258 /// called when a message is received form transport_peer 259 void BaseCommunication::receive_message(transport_protocol* transport, 260 const address_vf local, const address_vf remote, const uint8_t* data, 261 size_t size) { 262 263 // logging_debug( "Dispatching message" ); 264 265 // convert data 266 Data data_( const_cast<uint8_t*>(data), size * 8 ); 267 DispatchMsg* dmsg = new DispatchMsg(); 268 269 Message* msg = new Message(data_); 270 dmsg->local = local->clone(); 271 dmsg->remote = remote->clone(); 272 dmsg->message = msg; 273 274 SystemQueue::instance().scheduleEvent( 275 SystemEvent( this, MessageDispatchEvent, dmsg ) 276 ); 277 } 278 279 /// handles a message from the underlay transport 280 void BaseCommunication::receiveMessage(const Message* message, 281 const address_v* local, const address_v* remote ){ 282 283 /// decapsulate message 284 AribaBaseMsg* msg = ((Message*)message)->decapsulate<AribaBaseMsg>(); 285 logging_debug( "Receiving message of type " << msg->getTypeString() ); 286 287 // handle message 288 switch (msg->getType()) { 289 290 // --------------------------------------------------------------------- 291 // data message 292 // --------------------------------------------------------------------- 293 case AribaBaseMsg::typeData: { 294 logging_debug( "Received data message, forwarding to overlay" ); 295 if( messageReceiver != NULL ) { 296 messageReceiver->receiveMessage( 297 msg, msg->getRemoteLink(), NodeID::UNSPECIFIED 298 ); 299 } 300 break; 301 } 302 303 // --------------------------------------------------------------------- 304 // handle link request from remote 305 // --------------------------------------------------------------------- 306 case AribaBaseMsg::typeLinkRequest: { 307 logging_debug( "Received link open request" ); 308 309 /// only answer the first request 310 if (!queryRemoteLink(msg->getLocalLink()).isUnspecified()) { 311 logging_debug("Link request already received. Ignore!"); 312 break; 313 } 314 315 /// create link ids 316 LinkID localLink = LinkID::create(); 317 LinkID remoteLink = msg->getLocalLink(); 318 logging_debug( "local=" << local->to_string() 319 << " remote=" << remote->to_string() 349 320 ); 321 322 // check if link creation is allowed by ALL listeners 323 bool allowlink = true; 324 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 325 allowlink &= i->onLinkRequest( localLink, local, remote ); 326 } 327 328 // not allowed-> warn 329 if( !allowlink ){ 330 logging_warn( "Overlay denied creation of link" ); 331 return; 332 } 333 334 // create descriptor 335 LinkDescriptor* ld = new LinkDescriptor(); 336 ld->localLink = localLink; 337 ld->remoteLink = remoteLink; 338 ld->localLocator = local->clone(); 339 ld->remoteLocator = remote->clone(); 340 ld->remoteEndpoint = msg->getLocalDescriptor(); 341 342 // add layer 1-3 addresses 343 ld->remoteEndpoint.getEndpoints().add( 344 ld->remoteLocator, endpoint_set::Layer1_3); 345 localDescriptor.getEndpoints().add( 346 local, endpoint_set::Layer1_3 347 ); 348 349 // link is now up-> add it 350 ld->up = true; 351 addLink(ld); 352 353 // link is up! 354 logging_debug( "Link (initiated from remote) is up with " 355 << "local(id=" << ld->localLink.toString() << "," 356 << "locator=" << ld->localLocator->to_string() << ") " 357 << "remote(id=" << ld->remoteLink.toString() << ", " 358 << "locator=" << ld->remoteLocator->to_string() << ")" 359 ); 360 361 // sending link request reply 362 logging_debug( "Sending link request reply with ids " 363 << "local=" << localLink.toString() << ", " 364 << "remote=" << remoteLink.toString() ); 365 AribaBaseMsg reply( AribaBaseMsg::typeLinkReply, localLink, remoteLink ); 366 reply.getLocalDescriptor() = localDescriptor; 367 reply.getRemoteDescriptor() = ld->remoteEndpoint; 368 369 send( &reply, *ld ); 370 371 // inform listeners about new open link 372 BOOST_FOREACH( CommunicationEvents* i, eventListener ) { 373 i->onLinkUp( localLink, ld->localLocator, ld->remoteLocator); 374 } 375 376 // done 377 break; 350 378 } 351 379 352 } // LINK_STATE_DATA 353 354 // 355 // handle link open requests 356 // 357 358 else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_OPEN_REQUEST ){ 359 360 logging_debug( "received link open request" ); 361 362 // 363 // create a link context 364 // 365 366 // in an incoming packet the localLink is from 367 // the sender perspective local and from our 368 // perspective remote 369 370 logging_debug( "creating local link" ); 371 372 LinkID localLink = LinkID::create(); 373 LinkID remoteLink = spovmsg->getLocalLink(); 374 375 if(localLink.isUnspecified()){ 376 logging_error("local link is unspecified"); 377 return false; 380 // --------------------------------------------------------------------- 381 // handle link request reply 382 // --------------------------------------------------------------------- 383 case AribaBaseMsg::typeLinkReply: { 384 logging_debug( "Received link open reply for a link we initiated" ); 385 386 // this is a reply to a link open request, so we have already 387 // a link mapping and can now set the remote link to valid 388 LinkDescriptor& ld = queryLocalLink( msg->getRemoteLink() ); 389 390 // no link found-> warn! 391 if (ld.isUnspecified()) { 392 logging_warn("Failed to find local link " << msg->getRemoteLink().toString()); 393 return; 394 } 395 396 // set remote locator and link id 397 ld.remoteLink = msg->getLocalLink(); 398 ld.remoteLocator = remote->clone(); 399 localDescriptor.getEndpoints().add( 400 msg->getRemoteDescriptor().getEndpoints(), 401 endpoint_set::Layer1_3 402 ); 403 ld.up = true; 404 405 logging_debug( "Link is now up with local id " 406 << ld.localLink.toString() << " and remote id " 407 << ld.remoteLink.toString() ); 408 409 410 // inform lisneters about link up event 411 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 412 i->onLinkUp( ld.localLink, ld.localLocator, ld.remoteLocator ); 413 } 414 415 // done 416 break; 378 417 } 379 418 380 if(remoteLink.isUnspecified()){ 381 logging_error("remote link is unspecified"); 382 return false; 419 // --------------------------------------------------------------------- 420 // handle link close requests 421 // --------------------------------------------------------------------- 422 case AribaBaseMsg::typeLinkClose: { 423 // get remote link 424 const LinkID& localLink = msg->getRemoteLink(); 425 logging_debug( "Received link close request for link " << localLink.toString() ); 426 427 // searching for link, not found-> warn 428 LinkDescriptor& linkDesc = queryLocalLink( localLink ); 429 if (linkDesc.isUnspecified()) { 430 logging_warn("Failed to find local link " << localLink.toString()); 431 return; 432 } 433 434 // inform listeners 435 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 436 i->onLinkDown( linkDesc.localLink, 437 linkDesc.localLocator, linkDesc.remoteLocator ); 438 } 439 440 // remove the link descriptor 441 removeLink( localLink ); 442 443 // done 444 break; 383 445 } 384 446 385 const NetworkLocator* localLocator = dynamic_cast<const NetworkLocator*>(localDescriptor.locator); 386 const NetworkLocator* remoteLocator = dynamic_cast<const NetworkLocator*>(message->getSourceAddress()); 387 388 logging_debug( "localLocator=" << localLocator->toString() 389 << " remoteLocator=" << remoteLocator->toString()); 390 391 // ask the registered listeners if this link 392 // creation is fine. we will only allow the 393 // link if all of them agree 394 395 bool allowlink = true; 396 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 397 allowlink &= i->onLinkRequest( localLink, localLocator, remoteLocator ); 447 // --------------------------------------------------------------------- 448 // handle link locator changes 449 // --------------------------------------------------------------------- 450 case AribaBaseMsg::typeLinkUpdate: { 451 const LinkID& localLink = msg->getRemoteLink(); 452 logging_debug( "Received link update for link " 453 << localLink.toString() ); 454 455 // find the link description 456 LinkDescriptor& linkDesc = queryLocalLink( localLink ); 457 if (linkDesc.isUnspecified()) { 458 logging_warn("Failed to update local link " 459 << localLink.toString()); 460 return; 461 } 462 463 // update the remote locator 464 const address_v* oldremote = linkDesc.remoteLocator; 465 linkDesc.remoteLocator = remote->clone(); 466 467 // inform the listeners (local link has _not_ changed!) 468 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 469 i->onLinkChanged( 470 linkDesc.localLink, // linkid 471 linkDesc.localLocator, // old local 472 linkDesc.localLocator, // new local 473 oldremote, // old remote 474 linkDesc.remoteLocator // new remote 475 ); 476 } 477 478 // done 479 break; 398 480 } 399 400 if( !allowlink ){ 401 logging_warn( "overlay denied creation of link" ); 402 return true; 403 } 404 405 // 406 // create and save the descriptor for the link 407 // 408 409 LinkDescriptor linkDescriptor(localLink, localLocator, remoteLink, 410 remoteLocator, EndpointDescriptor(remoteLocator), true); 411 412 logging_debug( "saving new link descriptor with " << 413 "[local link " << localLink.toString() << "] " << 414 "[local locator " << localLocator->toString() << "] " << 415 "[remote link " << remoteLink.toString() << "] " << 416 "[remote locator " << remoteLocator->toString() << "]" << 417 "[link up true]" ); 418 419 addLink( linkDescriptor ); 420 421 // 422 // send out a link reply 423 // 424 425 logging_debug( "sending back link open reply for " << 426 "[local link " << localLink.toString() << "] " << 427 "[remote link " << remoteLink.toString() << "]" ); 428 429 AribaBaseMsg reply(remoteLocator, 430 AribaBaseMsg::LINK_STATE_OPEN_REPLY, 431 localLink, 432 remoteLink); 433 434 transport->sendMessage( &reply ); 435 436 // 437 // the link is now open 438 // 439 440 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 441 i->onLinkUp( localLink, localLocator, remoteLocator ); 442 } 443 444 } // LINK_STATE_OPEN_REQUEST 445 446 // 447 // handle link open replies 448 // 449 450 else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_OPEN_REPLY ){ 451 452 logging_debug( "received link open reply for a link we initiated" ); 453 454 // this is a reply to a link open request, so we have already 455 // a link mapping and can now set the remote link to valid 456 LinkDescriptor& linkDesc = queryLocalLink( spovmsg->getRemoteLink() ); 457 458 if (linkDesc.isUnspecified()) { 459 logging_warn("failed to find local link " << spovmsg->getRemoteLink().toString()); 460 return false; 461 } 462 463 linkDesc.remoteLink = spovmsg->getLocalLink(); 464 linkDesc.linkup = true; 465 466 logging_debug( "the link is now up with local link id " << linkDesc.localLink.toString() << 467 " and remote link id " << linkDesc.remoteLink.toString() ); 468 469 // notify the baseoverlay that the link is up, so 470 // it can exchange nodeids over this link. then we 471 // can send the queued messages, as both nodes have 472 // to know their nodeids first 473 474 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 475 i->onLinkUp( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator ); 476 } 477 478 } // LINK_STATE_OPEN_REPLY 479 480 // 481 // handle link close requests 482 // 483 484 else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_CLOSE_REQUEST ){ 485 486 const LinkID& localLink = spovmsg->getRemoteLink(); 487 logging_debug( "received link close request for link " << localLink.toString() ); 488 489 // 490 // the link is closed immediately, we 491 // don't need to send out a reply, so we 492 // delete the mapping and inform 493 // 494 495 LinkDescriptor& linkDesc = queryLocalLink( localLink ); 496 if (linkDesc.isUnspecified()) { 497 logging_warn("Failed to find local link " << localLink.toString()); 498 return false; 499 } 500 501 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 502 i->onLinkDown( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator ); 503 } 504 505 // 506 // remove the link descriptor 507 // 508 509 removeLink( localLink ); 510 511 } // LINK_STATE_CLOSE_REQUEST 512 513 // 514 // handle locator updates 515 // 516 517 else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_UPDATE ){ 518 519 const LinkID& localLink = spovmsg->getRemoteLink(); 520 logging_debug( "received link update for link " << localLink.toString() ); 521 522 // 523 // find the link description 524 // 525 526 LinkDescriptor& linkDesc = queryLocalLink( localLink ); 527 if (linkDesc.isUnspecified()) { 528 logging_warn("Failed to update local link " << localLink.toString()); 529 return false; 530 } 531 532 // 533 // update the remote locator 534 // 535 536 const NetworkLocator* oldremote = linkDesc.remoteLocator; 537 linkDesc.remoteLocator = dynamic_cast<const NetworkLocator*>(message->getSourceAddress()); 538 539 // 540 // inform the listeners (local link has _not_ changed!) 541 // 542 543 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 544 i->onLinkChanged( 545 linkDesc.localLink, // linkid 546 linkDesc.localLocator, // old local 547 linkDesc.localLocator, // new local 548 oldremote, // old remote 549 linkDesc.remoteLocator // new remote 550 ); 551 } 552 553 } // LINK_STATE_UPDATE 554 555 return true; 556 } 557 558 void BaseCommunication::addLink( const LinkDescriptor& link ) { 481 } 482 } 483 484 /// add a newly allocated link to the set of links 485 void BaseCommunication::addLink( LinkDescriptor* link ) { 559 486 linkSet.push_back( link ); 560 487 } 561 488 489 /// remove a link from set 562 490 void BaseCommunication::removeLink( const LinkID& localLink ) { 563 564 LinkSet::iterator i = linkSet.begin(); 565 LinkSet::iterator iend = linkSet.end(); 566 567 for( ; i != iend; i++){ 568 if( (*i).localLink != localLink) continue; 569 491 for(LinkSet::iterator i=linkSet.begin(); i != linkSet.end(); i++){ 492 if( (*i)->localLink != localLink) continue; 493 delete *i; 570 494 linkSet.erase( i ); 571 495 break; … … 573 497 } 574 498 499 /// query a descriptor by local link id 575 500 BaseCommunication::LinkDescriptor& BaseCommunication::queryLocalLink( const LinkID& link ) const { 576 501 for (int i=0; i<linkSet.size();i++) 577 if (linkSet[i] .localLink == link) return (LinkDescriptor&)linkSet[i];502 if (linkSet[i]->localLink == link) return (LinkDescriptor&)*linkSet[i]; 578 503 return (LinkDescriptor&)LinkDescriptor::UNSPECIFIED; 579 504 } 580 505 506 /// query a descriptor by remote link id 581 507 BaseCommunication::LinkDescriptor& BaseCommunication::queryRemoteLink( const LinkID& link ) const { 582 508 for (int i=0; i<linkSet.size();i++) 583 if (linkSet[i] .remoteLink == link) return (LinkDescriptor&)linkSet[i];509 if (linkSet[i]->remoteLink == link) return (LinkDescriptor&)*linkSet[i]; 584 510 return (LinkDescriptor&)LinkDescriptor::UNSPECIFIED; 585 511 } 586 512 587 LinkIDs BaseCommunication::getLocalLinks( const EndpointDescriptor& ep) const {513 LinkIDs BaseCommunication::getLocalLinks( const address_v* addr ) const { 588 514 LinkIDs ids; 589 590 515 for (int i=0; i<linkSet.size(); i++){ 591 if( ep == EndpointDescriptor::UNSPECIFIED){592 ids.push_back( linkSet[i] .localLink );516 if( addr == NULL ){ 517 ids.push_back( linkSet[i]->localLink ); 593 518 } else { 594 if ( linkSet[i].remoteLocator == ep.locator )595 ids.push_back( linkSet[i] .localLink );519 if ( *linkSet[i]->remoteLocator == *addr ) 520 ids.push_back( linkSet[i]->localLink ); 596 521 } 597 522 } 598 599 523 return ids; 600 524 } … … 609 533 #endif // UNDERLAY_OMNET 610 534 611 // 535 /*- disabled! 536 612 537 // we only care about address changes, not about interface changes 613 538 // as address changes are triggered by interface changes, we are safe here 614 //615 616 539 if( info.type != NetworkChangeInterface::EventTypeAddressNew && 617 540 info.type != NetworkChangeInterface::EventTypeAddressDelete ) return; … … 619 542 logging_info( "base communication is handling network address changes" ); 620 543 621 //622 544 // get all now available addresses 623 //624 625 545 NetworkInformation networkInformation; 626 546 AddressInformation addressInformation; … … 745 665 transport->sendMessage( &updateMsg ); 746 666 } 667 */ 668 } 669 670 /// sends a message to all end-points in the end-point descriptor 671 void BaseCommunication::send(Message* message, const EndpointDescriptor& endpoint) { 672 Data data = data_serialize( message, DEFAULT_V ); 673 transport->send( endpoint.getEndpoints(), data.getBuffer(), data.getLength() / 8); 674 } 675 676 /// sends a message to the remote locator inside the link descriptor 677 void BaseCommunication::send(Message* message, const LinkDescriptor& desc) { 678 Data data = data_serialize( message, DEFAULT_V ); 679 transport->send( desc.remoteLocator, data.getBuffer(), data.getLength() / 8); 747 680 } 748 681 -
source/ariba/communication/BaseCommunication.h
r4983 r5284 40 40 #define BASECOMMUNICATION_H_ 41 41 42 // boost & std includes 42 43 #include <ext/hash_map> 43 44 #include <ext/hash_set> … … 49 50 #include <boost/foreach.hpp> 50 51 52 // utilities 51 53 #include "ariba/utility/types.h" 52 54 #include "ariba/utility/messages.h" 53 55 #include "ariba/utility/logging/Logging.h" 54 56 #include "ariba/utility/misc/Demultiplexer.hpp" 55 57 #include "ariba/utility/system/SystemEventListener.h" 58 59 // new transport and addressing 60 #include "ariba/utility/addressing/addressing.hpp" 61 #include "ariba/utility/transport/transport.hpp" 62 63 // communication 56 64 #include "ariba/communication/CommunicationEvents.h" 57 65 #include "ariba/communication/EndpointDescriptor.h" 66 #include "ariba/communication/messages/AribaBaseMsg.h" 67 68 // network changes 58 69 #include "ariba/communication/networkinfo/NetworkChangeInterface.h" 59 70 #include "ariba/communication/networkinfo/NetworkChangeDetection.h" 60 71 #include "ariba/communication/networkinfo/NetworkInformation.h" 61 72 #include "ariba/communication/networkinfo/AddressInformation.h" 62 #include "ariba/communication/messages/AribaBaseMsg.h" 63 #include "ariba/communication/modules/transport/TransportProtocol.h" 64 #include "ariba/communication/modules/network/NetworkProtocol.h" 65 #include "ariba/communication/modules/network/NetworkLocator.h" 66 67 #ifndef UNDERLAY_OMNET 68 #include "ariba/communication/modules/transport/tcp/TCPTransport.h" 69 #include "ariba/communication/modules/network/ip/IPv4NetworkProtocol.h" 70 #endif 71 72 using __gnu_cxx::hash_set; 73 using __gnu_cxx::hash_map; 74 75 using std::cout; 76 using std::set; 77 using std::map; 78 using std::vector; 79 using std::pair; 80 using std::make_pair; 81 using std::find; 82 83 using ariba::communication::NetworkChangeDetection; 84 using ariba::communication::NetworkChangeInterface; 85 using ariba::communication::NetworkInterfaceList; 86 using ariba::communication::NetworkInformation; 87 using ariba::communication::AddressInformation; 88 using ariba::communication::AddressList; 89 using ariba::communication::AribaBaseMsg; 90 using ariba::communication::CommunicationEvents; 91 92 using ariba::utility::Demultiplexer; 93 using ariba::utility::QoSParameterSet; 94 using ariba::utility::SecurityParameterSet; 95 using ariba::utility::Address; 96 using ariba::utility::LinkID; 97 using ariba::utility::LinkIDs; 98 using ariba::utility::Message; 99 using ariba::utility::MessageReceiver; 100 using ariba::utility::seqnum_t; 101 102 using ariba::communication::TransportProtocol; 103 using ariba::communication::NetworkProtocol; 104 using ariba::communication::NetworkLocator; 105 #ifndef UNDERLAY_OMNET 106 using ariba::communication::IPv4NetworkProtocol; 107 using ariba::communication::TCPTransport; 108 #endif 73 74 // deprecated 75 //#include "ariba/communication/modules/transport/TransportProtocol.h" 76 //#include "ariba/communication/modules/network/NetworkProtocol.h" 77 //#include "ariba/communication/modules/network/NetworkLocator.h" 78 79 // disabled 80 //#ifndef UNDERLAY_OMNET 81 // #include "ariba/communication/modules/transport/tcp/TCPTransport.h" 82 // #include "ariba/communication/modules/network/ip/IPv4NetworkProtocol.h" 83 //#endif 84 85 // deprecated 86 //using ariba::communication::TransportProtocol; 87 //using ariba::communication::NetworkProtocol; 88 //using ariba::communication::NetworkLocator; 89 90 // disabled 91 //#ifndef UNDERLAY_OMNET 92 // using ariba::communication::IPv4NetworkProtocol; 93 // using ariba::communication::TCPTransport; 94 //#endif 109 95 110 96 namespace ariba { 111 97 namespace communication { 98 99 using namespace std; 100 using namespace ariba::addressing; 101 using namespace ariba::transport; 102 using namespace ariba::utility; 103 104 // use base ariba types (clarifies multiple definitions) 105 using ariba::utility::Message; 106 using ariba::utility::seqnum_t; 112 107 113 108 /** … … 119 114 * @author Sebastian Mies, Christoph Mayer 120 115 */ 121 class BaseCommunication : public MessageReceiver, NetworkChangeInterface { 116 class BaseCommunication: public NetworkChangeInterface, 117 public SystemEventListener, public transport_listener { 122 118 use_logging_h(BaseCommunication); 119 123 120 public: 124 125 /** 126 * Default ctor that just creates an empty 127 * non functional base communication 128 */ 121 /// Default ctor that just creates an non-functional base communication 129 122 BaseCommunication(); 130 123 131 /** 132 * Default dtor that does nothing 133 */ 124 /// Default dtor that does nothing 134 125 virtual ~BaseCommunication(); 135 126 136 /** 137 * Startup the base communication, start modules etc. 138 */ 139 void start(const NetworkLocator* _locallocator, const uint16_t _listenport); 140 141 /** 142 * stop the base communication, stop modules etc. 143 */ 127 /// Startup the base communication, start modules etc. 128 void start(); 129 130 /// Stops the base communication, stop modules etc. 144 131 void stop(); 145 132 146 /* 147 * Check whether the base communication has been started up 148 */ 133 /// Sets the endpoints 134 void setEndpoints( string& endpoints ); 135 136 /// Check whether the base communication has been started up 149 137 bool isStarted(); 150 138 151 152 /** 153 * Establishes a link to another end-point. 154 */ 155 const LinkID establishLink( 156 const EndpointDescriptor& descriptor, 157 const LinkID& linkid = LinkID::UNSPECIFIED, 158 const QoSParameterSet& qos = QoSParameterSet::DEFAULT, 159 const SecurityParameterSet& sec = SecurityParameterSet::DEFAULT 160 ); 161 162 /** 163 * Drops a link. 164 * 165 * @param The link id of the link that should be dropped 166 */ 139 /// Establishes a link to another end-point. 140 const LinkID establishLink(const EndpointDescriptor& descriptor, 141 const LinkID& linkid = LinkID::UNSPECIFIED, const QoSParameterSet& qos = 142 QoSParameterSet::DEFAULT, const SecurityParameterSet& sec = 143 SecurityParameterSet::DEFAULT); 144 145 /// Drops a link 167 146 void dropLink(const LinkID link); 168 147 … … 182 161 * @return The end-point descriptor of the link's end-point 183 162 */ 184 const EndpointDescriptor& getEndpointDescriptor( const LinkID link = LinkID::UNSPECIFIED ) const; 163 const EndpointDescriptor& getEndpointDescriptor(const LinkID link = 164 LinkID::UNSPECIFIED) const; 185 165 186 166 /** … … 190 170 * @return List of LinkID 191 171 */ 192 LinkIDs getLocalLinks( const EndpointDescriptor& ep = EndpointDescriptor::UNSPECIFIED) const;172 LinkIDs getLocalLinks(const address_v* addr) const; 193 173 194 174 /** … … 197 177 * @param _receiver The receiving side 198 178 */ 199 void registerMessageReceiver( MessageReceiver* _receiver ); 179 void registerMessageReceiver(MessageReceiver* receiver) { 180 messageReceiver = receiver; 181 } 200 182 201 183 /** … … 204 186 * @param _receiver The receiving side 205 187 */ 206 void unregisterMessageReceiver( MessageReceiver* _receiver ); 207 208 void registerEventListener( CommunicationEvents* _events ); 209 void unregisterEventListener( CommunicationEvents* _events ); 188 void unregisterMessageReceiver(MessageReceiver* receiver) { 189 messageReceiver = NULL; 190 } 191 192 void registerEventListener(CommunicationEvents* _events); 193 194 void unregisterEventListener(CommunicationEvents* _events); 195 196 public: 197 198 /// called when a system event is emitted by system queue 199 virtual void handleSystemEvent(const SystemEvent& event); 200 201 /// called when a message is received form transport_peer 202 virtual void receive_message(transport_protocol* transport, 203 const address_vf local, const address_vf remote, const uint8_t* data, 204 size_t size); 210 205 211 206 protected: 212 207 213 /** 214 * Called from the Transport when async items 215 * from the SystemQueue are delivered 216 */ 217 virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node ); 218 219 /** 220 * Called when a network interface change happens 221 */ 222 virtual void onNetworkChange( const NetworkChangeInterface::NetworkChangeInfo& info ); 208 /// handle received message from a transport module 209 void receiveMessage(const Message* message, 210 const address_v* local, const address_v* remote ); 211 212 /// called when a network interface change happens 213 virtual void onNetworkChange( 214 const NetworkChangeInterface::NetworkChangeInfo& info); 223 215 224 216 private: 225 226 /** 227 * A link descriptor consisting of the 228 * end-point descriptor and currently used locator and 229 * message receiver 217 /** 218 * A link descriptor consisting of the end-point descriptor and currently 219 * used underlay address. 230 220 */ 231 221 class LinkDescriptor { … … 233 223 static const LinkDescriptor UNSPECIFIED; 234 224 225 /// default constructor 235 226 LinkDescriptor() : 236 localLink(LinkID::UNSPECIFIED), 237 localLocator(NULL), 238 remoteLink(LinkID::UNSPECIFIED), 239 remoteLocator(NULL), 240 remoteEndpoint(EndpointDescriptor::UNSPECIFIED), 241 linkup(false) { 227 localLink(LinkID::UNSPECIFIED), localLocator(NULL), 228 remoteLink(LinkID::UNSPECIFIED), remoteLocator(NULL), 229 remoteEndpoint(EndpointDescriptor::UNSPECIFIED), up(false) { 242 230 } 243 231 244 LinkDescriptor(const LinkID& _localLink, const NetworkLocator*& _localLocator, 245 const LinkID& _remoteLink, const NetworkLocator*& _remoteLocator, 246 const EndpointDescriptor& _remoteEndpoint, bool _linkup ) : 247 localLink(_localLink), 248 localLocator(_localLocator), 249 remoteLink(_remoteLink), 250 remoteLocator(_remoteLocator), 251 remoteEndpoint(_remoteEndpoint), 252 linkup(_linkup) { 232 ~LinkDescriptor() { 233 if (localLocator!=NULL) delete localLocator; 234 if (remoteLocator!=NULL) delete remoteLocator; 253 235 } 254 236 255 LinkDescriptor( const LinkDescriptor& desc ) : 256 localLink(desc.localLink), 257 localLocator(desc.localLocator), 258 remoteLink(desc.remoteLink), 259 remoteLocator(desc.remoteLocator), 260 remoteEndpoint(desc.remoteEndpoint), 261 linkup(desc.linkup) { 237 /// returns true if this is the UNSPECIFIED object 238 bool isUnspecified() const { 239 return this == &UNSPECIFIED; 262 240 } 263 241 264 bool isUnspecified() const { 265 return (this == &UNSPECIFIED); 266 } 267 268 LinkID localLink; 269 const NetworkLocator* localLocator; 270 LinkID remoteLink; 271 const NetworkLocator* remoteLocator; 272 EndpointDescriptor remoteEndpoint; 273 274 bool linkup; 242 /// link identifiers 243 LinkID localLink; 244 LinkID remoteLink; 245 246 /// used underlay addresses for the link 247 const address_v* localLocator; 248 const address_v* remoteLocator; 249 250 /// the remote end-point descriptor 251 EndpointDescriptor remoteEndpoint; 252 253 /// flag, whether this link is up 254 bool up; 275 255 }; 276 256 277 /** 278 * Link management: add a link 279 */ 280 void addLink( const LinkDescriptor& link ); 281 282 /** 283 * Link management: remove alink 284 */ 285 void removeLink( const LinkID& localLink ); 286 287 /** 288 * Link management: get link information using the local link 289 */ 290 LinkDescriptor& queryLocalLink( const LinkID& localLink ) const; 291 292 /** 293 * Link management: get link information using the remote link 294 */ 295 LinkDescriptor& queryRemoteLink( const LinkID& remoteLink ) const; 296 297 /** 298 * Link management: list of links 299 */ 300 typedef vector<LinkDescriptor> LinkSet; 301 302 /** 303 * Link management: the set of currently managed links 304 */ 257 /// Link management: list of links 258 typedef vector<LinkDescriptor*> LinkSet; 259 260 /// Link management: the set of currently managed links 305 261 LinkSet linkSet; 306 262 307 /** 308 * The message receiver 309 */ 310 MessageReceiver* messageReceiver; 311 312 /** 313 * The local end-point descriptor 314 */ 263 /// Link management: add a link 264 void addLink( LinkDescriptor* link ); 265 266 /// Link management: remove a link 267 void removeLink(const LinkID& localLink); 268 269 /// Link management: get link information using the local link 270 LinkDescriptor& queryLocalLink(const LinkID& localLink) const; 271 272 /// Link management: get link information using the remote link 273 LinkDescriptor& queryRemoteLink(const LinkID& remoteLink) const; 274 275 /// The local end-point descriptor 315 276 EndpointDescriptor localDescriptor; 316 277 317 /**318 * Network information and protocol319 */320 NetworkProtocol* network;321 322 /**323 * Transport information and protocol324 */325 TransportProtocol* transport;326 327 278 #ifndef UNDERLAY_OMNET 328 /** 329 * Detect changes in the routing/interface, etc. 330 * stuff needed for mobility detection 331 */ 279 /// network change detector 332 280 NetworkChangeDetection networkMonitor; 333 281 #endif 334 335 /** 336 * The local listen port 337 */ 338 uint16_t listenport; 339 282 /// event listener 340 283 typedef set<CommunicationEvents*> EventListenerSet; 341 284 EventListenerSet eventListener; 342 285 286 /// sequence numbers 343 287 seqnum_t currentSeqnum; 344 288 345 /** 346 * state of the base communication 347 */ 348 bool basecommStarted; 289 /// transport peer 290 transport_peer* transport; 291 292 /// the base overlay message receiver 293 MessageReceiver* messageReceiver; 294 295 /// convenience: send message to peer 296 void send( Message* message, const EndpointDescriptor& endpoint ); 297 void send( Message* message, const LinkDescriptor& descriptor ); 298 299 /// state of the base communication 300 bool started; 349 301 350 302 }; … … 352 304 }} // namespace ariba, communication 353 305 354 #endif /* BASECOMMUNICATION_H_*/306 #endif /* BASECOMMUNICATION_H_ */ -
source/ariba/communication/CommunicationEvents.cpp
r3690 r5284 48 48 } 49 49 50 bool CommunicationEvents::onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) { 50 bool CommunicationEvents::onLinkRequest(const LinkID& id, 51 const address_v* local, const address_v* remote) { 51 52 return true; 52 53 } 53 54 54 void CommunicationEvents::onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) { 55 void CommunicationEvents::onLinkUp(const LinkID& id, const address_v* local, 56 const address_v* remote) { 55 57 } 56 58 57 void CommunicationEvents::onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) { 59 void CommunicationEvents::onLinkDown(const LinkID& id, const address_v* local, 60 const address_v* remote) { 58 61 } 59 62 60 61 void CommunicationEvents::onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote ) { 63 void CommunicationEvents::onLinkChanged(const LinkID& id, 64 const address_v* oldlocal, const address_v* newlocal, 65 const address_v* oldremote, const address_v* newremote) { 62 66 } 63 67 64 void CommunicationEvents::onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ){ 68 void CommunicationEvents::onLinkFail(const LinkID& id, const address_v* local, 69 const address_v* remote) { 65 70 } 66 71 67 void CommunicationEvents::onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos ){ 72 void CommunicationEvents::onLinkQoSChanged(const LinkID& id, 73 const address_v* local, const address_v* remote, const QoSParameterSet& qos) { 68 74 } 69 75 -
source/ariba/communication/CommunicationEvents.h
r3690 r5284 41 41 42 42 #include "ariba/utility/types/LinkID.h" 43 #include "ariba/communication/modules/network/NetworkLocator.h"44 43 #include "ariba/utility/types/QoSParameterSet.h" 45 46 using ariba::utility::LinkID; 47 using ariba::utility::QoSParameterSet; 48 using ariba::communication::NetworkLocator; 44 #include "ariba/utility/addressing/addressing.hpp" 49 45 50 46 namespace ariba { 51 47 namespace communication { 52 48 49 using ariba::utility::LinkID; 50 using ariba::utility::QoSParameterSet; 51 using namespace ariba::addressing; 52 53 53 class CommunicationEvents { 54 55 54 friend class BaseCommunication; 56 55 … … 69 68 * @return True, if the link should be established 70 69 */ 71 virtual bool onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 70 virtual bool onLinkRequest(const LinkID& id, const address_v* local, 71 const address_v* remote); 72 72 73 73 /** … … 77 77 * @param id The link id of the established link 78 78 */ 79 virtual void onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 79 virtual void onLinkUp(const LinkID& id, const address_v* local, 80 const address_v* remote); 80 81 81 82 /** … … 84 85 * @param id The link identifier of the dropped link 85 86 */ 86 virtual void onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 87 virtual void onLinkDown(const LinkID& id, const address_v* local, 88 const address_v* remote); 87 89 88 90 /** … … 94 96 * @param id The link identifier of the changed link 95 97 */ 96 virtual void onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote ); 98 virtual void onLinkChanged(const LinkID& id, 99 const address_v* oldlocal, const address_v* newlocal, 100 const address_v* oldremote, const address_v* newremote 101 ); 97 102 98 virtual void onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 103 virtual void onLinkFail(const LinkID& id, const address_v* local, 104 const address_v* remote); 99 105 100 virtual void onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos ); 106 virtual void onLinkQoSChanged(const LinkID& id, const address_v* local, 107 const address_v* remote, const QoSParameterSet& qos); 101 108 }; 102 109 -
source/ariba/communication/EndpointDescriptor.cpp
r4986 r5284 48 48 const EndpointDescriptor EndpointDescriptor::UNSPECIFIED; 49 49 50 EndpointDescriptor::EndpointDescriptor() : locator( NULL ), isUnspec( true ){ 51 } 52 53 EndpointDescriptor::EndpointDescriptor(const EndpointDescriptor& rh){ 54 locator = (rh.locator != NULL) ? new IPv4Locator(*rh.locator) : NULL; 55 isUnspec = rh.isUnspec; 56 } 57 58 EndpointDescriptor::EndpointDescriptor(const Locator* _locator){ 59 if( _locator == NULL ) return; 60 61 locator = new IPv4Locator(*dynamic_cast<IPv4Locator*>((Locator*)_locator)); 62 isUnspec = false; 63 } 64 65 EndpointDescriptor::EndpointDescriptor(const string str) { 66 using namespace boost::xpressive; 67 using namespace ariba::utility::string_format; 68 using namespace ariba::utility::Helper; 69 using namespace std; 70 71 locator = NULL; 72 isUnspec = true; 73 74 smatch match; 75 if (regex_search(str, match, robjects)) { 76 regex_nav nav = match; 77 for (int i=0; i<nav.size(); i++) { 78 string type = nav[i][robject_id].str(); 79 if (type=="ip") { 80 string ip = nav[i][robject_data].str(); 81 ip = ip.substr(1,ip.size()-2); 82 this->locator = new IPv4Locator(); 83 this->locator->setIP(ip); 84 this->isUnspec = false; 85 } else 86 if (type=="tcp") { 87 string port = nav[i][robject_data][rfields][1].str(); 88 port = port.substr(1,port.size()-2); 89 this->locator->setPort(stoi(port)); 90 } 91 } 92 } 93 } 94 50 /// destructor. 95 51 EndpointDescriptor::~EndpointDescriptor() { 96 }97 98 bool EndpointDescriptor::isUnspecified() const {99 return isUnspec;100 }101 102 string EndpointDescriptor::toString() const {103 if( locator == NULL ) return "<undefined locator>";104 std::ostringstream o;105 o << "ip{" << locator->getIP() << "}";106 o << ",";107 o << "tcp(ip,{" << locator->getPort() << "})";108 return o.str();109 }110 111 EndpointDescriptor* EndpointDescriptor::fromString( string str ) {112 return new EndpointDescriptor( str );113 }114 115 bool EndpointDescriptor::operator!=( const EndpointDescriptor& rh ) const {116 return !operator==(rh);117 }118 119 bool EndpointDescriptor::operator==(const EndpointDescriptor& rh) const {120 121 if( isUnspecified() && rh.isUnspecified() ) {122 123 // both unspec bit set124 return true;125 126 } else if( (!isUnspecified()) && (!rh.isUnspecified()) ) {127 128 //129 // both are valid, check locators130 //131 132 if( locator == NULL && rh.locator == NULL ){133 134 // both locators are invalid, ok true135 return true;136 137 } else if( locator == NULL ^ rh.locator == NULL ) {138 139 // one locator is invalid, the other not, false140 return false;141 142 } else {143 144 // both locators are valid, compare145 assert( locator != NULL && rh.locator != NULL );146 return ( locator->operator==(*rh.locator) );147 148 }149 150 } else {151 152 // one is unspec, the other not153 assert( isUnspecified() ^ rh.isUnspecified() );154 return false;155 156 }157 52 158 53 } 159 54 55 160 56 }} // namespace ariba, communication -
source/ariba/communication/EndpointDescriptor.h
r4986 r5284 40 40 #define ENDPOINTDESCRIPTOR_H_ 41 41 42 // deprecated 43 //#include "ariba/communication/modules/network/ip/IPv4Locator.h" 44 45 // deprecated 46 //using ariba::utility::Locator; 47 //using ariba::communication::IPv4Locator; 48 49 // typical types 42 50 #include "ariba/utility/types.h" 43 51 #include "ariba/utility/serialization.h" 44 #include "ariba/communication/modules/network/ip/IPv4Locator.h" 52 53 // new addressing and transport 54 #include "ariba/utility/addressing/addressing.hpp" 55 #include "ariba/utility/transport/transport.hpp" 56 57 // stdlibc++ 45 58 #include <string> 46 59 #include <set> 47 48 using std::string;49 using std::set;50 using ariba::utility::Locator;51 using ariba::communication::IPv4Locator;52 60 53 61 namespace ariba { … … 55 63 56 64 using_serialization; 65 using namespace std; 66 using namespace ariba::addressing; 57 67 58 class EndpointDescriptor : public VSerializeable { 59 VSERIALIZEABLE; 60 68 class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE 61 69 friend class BaseCommunication; 62 70 63 71 public: 64 /** 65 * The default constructor. 66 */ 67 EndpointDescriptor(); 72 /// the unspecified endpoint descriptor 73 static const EndpointDescriptor UNSPECIFIED; 68 74 69 EndpointDescriptor(const EndpointDescriptor& rh);70 EndpointDescriptor( const Locator* _locator);71 EndpointDescriptor(const string str);75 /// creates an empty endpoint descriptor with zero endpoints 76 EndpointDescriptor() : endpoints() { 77 } 72 78 73 /** 74 * The destructor. 75 */ 79 /// destructor. 76 80 virtual ~EndpointDescriptor(); 77 81 78 / **79 * An unspecified end-point80 */81 static const EndpointDescriptor UNSPECIFIED;82 /// copy constructor 83 EndpointDescriptor(const EndpointDescriptor& rh) : 84 endpoints(rh.endpoints) { 85 } 82 86 83 /** 84 * Returns true, if the descriptor is unspecified. 85 * 86 * @return True, if the descriptor is unspecified. 87 */ 88 bool isUnspecified() const; 87 /// construct end-points from an endpoint set 88 EndpointDescriptor(const endpoint_set& endpoints ) : 89 endpoints(endpoints) { 90 } 89 91 90 virtual string toString() const; 91 static EndpointDescriptor* fromString( string str ); 92 /// construct end-points from a string 93 EndpointDescriptor(const string& str) : endpoints(str) { 94 } 92 95 93 bool operator==( const EndpointDescriptor& rh ) const; 94 bool operator!=( const EndpointDescriptor& rh ) const; 96 /// convert end-points to string 97 string toString() const { 98 return endpoints.to_string(); 99 } 100 101 /// returns true, if this object is the unspecified object 102 bool isUnspecified() const { 103 return this == &UNSPECIFIED; 104 } 105 106 /// create endpoint 107 static EndpointDescriptor* fromString(string str) { 108 return new EndpointDescriptor(str); 109 } 110 111 bool operator==(const EndpointDescriptor& rh) const { 112 if (rh.isUnspecified() && isUnspecified()) return true; 113 return false; 114 } 115 116 bool operator!=(const EndpointDescriptor& rh) const { 117 if (!rh.isUnspecified() && !isUnspecified()) return true; 118 return false; 119 } 120 121 EndpointDescriptor& operator=( const EndpointDescriptor& rhs) { 122 endpoints = rhs.endpoints; 123 } 124 125 /// returns the end-points of this descriptor 126 endpoint_set& getEndpoints() { 127 return endpoints; 128 } 129 130 /// returns the end-points of this descriptor 131 const endpoint_set& getEndpoints() const { 132 return endpoints; 133 } 95 134 96 135 private: 97 bool isUnspec; 98 IPv4Locator* locator; 136 endpoint_set endpoints; 99 137 }; 100 138 101 139 }} // namespace ariba, communication 102 140 103 sznBeginDefault( ariba::communication::EndpointDescriptor, X ) { 104 uint8_t unspec = isUnspec; 105 106 X && unspec && VO(locator); 107 108 // when deserializing reset unspec flag 109 if (X.isDeserializer()) isUnspec = unspec; 110 } sznEnd(); 141 sznBeginDefault( ariba::communication::EndpointDescriptor, X ){ 142 // serialize endpoints 143 uint16_t len = endpoints.to_bytes_size(); 144 X && len; 145 uint8_t* buffer = X.bytes( len ); 146 if (buffer!=NULL) { 147 if (X.isDeserializer()) endpoints.assign(buffer,len); 148 else endpoints.to_bytes(buffer); 149 } 150 }sznEnd(); 111 151 112 152 #endif /*ENDPOINTDESCRIPTOR_H_*/ -
source/ariba/communication/messages/AribaBaseMsg.cpp
r4582 r5284 44 44 vsznDefault(AribaBaseMsg); 45 45 46 AribaBaseMsg::AribaBaseMsg( 47 const Address* address, 48 LINK_STATE _state, 49 const LinkID& _localLink, 50 const LinkID& _remoteLink ) 51 : state( (uint8_t)_state ), 52 localLink( _localLink ), 53 remoteLink( _remoteLink ){ 54 55 Message::setDestinationAddress( address ); 46 AribaBaseMsg::AribaBaseMsg( type_ _type, 47 const LinkID& localLink, const LinkID& remoteLink ) : 48 type((uint8_t)_type), 49 localLink(localLink),remoteLink(remoteLink) { 56 50 } 57 51 58 AribaBaseMsg::~AribaBaseMsg() {52 AribaBaseMsg::~AribaBaseMsg() { 59 53 } 60 54 61 const AribaBaseMsg::LINK_STATE AribaBaseMsg::getType(){ 62 return (LINK_STATE)state; 63 } 64 65 const LinkID& AribaBaseMsg::getLocalLink(){ 66 return localLink; 67 } 68 69 const LinkID& AribaBaseMsg::getRemoteLink(){ 70 return remoteLink; 71 } 72 73 const string AribaBaseMsg::getTypeString(){ 74 75 switch( getType() ){ 76 case LINK_STATE_DATA: return "LINK_STATE_DATA"; 77 case LINK_STATE_OPEN_REQUEST: return "LINK_STATE_OPEN_REQUEST"; 78 case LINK_STATE_OPEN_REPLY: return "LINK_STATE_OPEN_REPLY"; 79 case LINK_STATE_CLOSE_REQUEST: return "LINK_STATE_CLOSE_REQUEST"; 80 case LINK_STATE_UPDATE: return "LINK_STATE_UPDATE"; 81 default: "unknown"; 55 const string AribaBaseMsg::getTypeString() const { 56 switch (getType()) { 57 case typeData: 58 return "typeData"; 59 case typeLinkRequest: 60 return "typeLinkRequest"; 61 case typeLinkReply: 62 return "typeLinkReply"; 63 case typeLinkClose: 64 return "typeLinkClose"; 65 case typeLinkUpdate: 66 return "typeLinkUpdate"; 67 default: 68 "unknown"; 82 69 } 83 84 70 return "unknown"; 85 71 } -
source/ariba/communication/messages/AribaBaseMsg.h
r4625 r5284 48 48 #include "ariba/utility/types/ServiceID.h" 49 49 50 #include "../EndpointDescriptor.h" 51 50 52 using std::string; 51 53 using ariba::utility::Address; … … 62 64 VSERIALIZEABLE; 63 65 public: 66 enum type_ { 67 typeData = 0, 68 typeLinkRequest = 1, 69 typeLinkReply = 2, 70 typeLinkClose = 3, 71 typeLinkUpdate = 4 72 }; 64 73 65 typedef enum _LINK_STATE { 66 LINK_STATE_DATA = 0, 67 LINK_STATE_OPEN_REQUEST = 1, 68 LINK_STATE_OPEN_REPLY = 2, 69 LINK_STATE_CLOSE_REQUEST = 3, // there is no close reply. send request and local link is closed 70 LINK_STATE_UPDATE = 4, 71 } LINK_STATE; 72 73 AribaBaseMsg( 74 const Address* address = NULL, 75 LINK_STATE _state = LINK_STATE_DATA, 76 const LinkID& _localLink = LinkID::UNSPECIFIED, 77 const LinkID& _remoteLink = LinkID::UNSPECIFIED ); 74 AribaBaseMsg( type_ type = typeData, 75 const LinkID& localLink = LinkID::UNSPECIFIED, 76 const LinkID& remoteLink = LinkID::UNSPECIFIED ); 78 77 79 78 virtual ~AribaBaseMsg(); 80 79 81 const LINK_STATE getType(); 82 const string getTypeString(); 83 const LinkID& getLocalLink(); 84 const LinkID& getRemoteLink(); 80 const string getTypeString() const; 81 82 const type_ getType() const { 83 return (type_)type; 84 } 85 86 const LinkID& getLocalLink() const { 87 return localLink; 88 } 89 90 const LinkID& getRemoteLink() const { 91 return remoteLink; 92 } 93 94 EndpointDescriptor& getLocalDescriptor() { 95 return localDescriptor; 96 } 97 98 EndpointDescriptor& getRemoteDescriptor() { 99 return remoteDescriptor; 100 } 85 101 86 102 private: 87 uint8_t state; // the link message type 103 uint8_t type; // the link message type 104 105 // remote and local link ids 88 106 LinkID localLink; // the local link id 89 107 LinkID remoteLink; // the remote link id 90 108 109 // remote and local endpoint descriptors 110 EndpointDescriptor localDescriptor; 111 EndpointDescriptor remoteDescriptor; 91 112 }; 92 113 … … 94 115 95 116 sznBeginDefault( ariba::communication::AribaBaseMsg, X ) { 96 X && state && &localLink && &remoteLink && Payload(); 117 X && type && &localLink && &remoteLink; 118 if (type == typeLinkReply || type == typeLinkRequest) 119 X && localDescriptor && remoteDescriptor; 120 X && Payload(); 97 121 } sznEnd(); 98 122 -
source/ariba/communication/networkinfo/AddressInformation.cpp
r3690 r5284 39 39 #include "AddressInformation.h" 40 40 41 #include <ifaddrs.h> 42 43 #include <boost/asio/ip/address.hpp> 44 #include <boost/asio/ip/address_v4.hpp> 45 41 46 namespace ariba { 42 47 namespace communication { 48 49 using namespace ariba::addressing; 43 50 44 51 AddressInformation::AddressInformation(){ … … 52 59 AddressList retlist; 53 60 54 //55 61 // gather transport addresses 56 //57 58 62 struct ifaddrs* ifap; 59 63 getifaddrs( &ifap ); 60 64 61 65 for( struct ifaddrs* p = ifap; p != NULL; p=p->ifa_next ){ 66 67 // no name set? ->continue 62 68 if( interface.name.compare(string(p->ifa_name)) != 0 ) continue; 63 69 64 // TODO: currently only handle IPv470 // handle IPv4 entry 65 71 struct sockaddr* addr = p->ifa_addr; 66 if( addr->sa_family != AF_INET ) continue; 72 if( addr->sa_family == AF_INET ) { 73 // get address 74 const struct sockaddr_in& ipv4 = (const struct sockaddr_in&)*addr; 75 boost::asio::ip::address_v4::bytes_type bytes; 76 for( int i=0; i<4; i++ ) 77 bytes[i] = (ipv4.sin_addr.s_addr >> (24-i*8)) & 0xff; 67 78 68 const struct sockaddr_in& ipv4 = (const struct sockaddr_in&)*addr; 69 boost::asio::ip::address_v4::bytes_type bytes; 70 for( int i=0; i<4; i++ ) 71 bytes[i] = (ipv4.sin_addr.s_addr >> (24-i*8)) & 0xff; 72 73 boost::asio::ip::address boost_addr = boost::asio::ip::address_v4( bytes ); 74 retlist.push_back( IPv4Locator::fromString(boost_addr.to_string()) ); 79 // add ipv4 address 80 boost::asio::ip::address boost_addr = boost::asio::ip::address_v4( bytes ); 81 retlist.push_back( vcapsule<address_v>( ip_address(boost_addr) ) ); 82 } 75 83 } 76 84 77 85 freeifaddrs( ifap ); 78 79 //80 // TODO: gather further addresses like MAC etc.81 //82 86 83 87 return retlist; -
source/ariba/communication/networkinfo/AddressInformation.h
r3690 r5284 40 40 #define __ADDRESS_INFORMATION_H 41 41 42 #include <ifaddrs.h>43 42 #include <vector> 44 #include <boost/asio/ip/address.hpp> 45 #include <boost/asio/ip/address_v4.hpp> 43 46 44 #include "ariba/communication/networkinfo/NetworkInterface.h" 47 #include "ariba/communication/modules/network/ip/IPv4Locator.h" 48 49 using std::vector; 50 using ariba::communication::NetworkInterface; 51 using ariba::communication::IPv4Locator; 45 #include "ariba/utility/addressing/addressing.hpp" 52 46 53 47 namespace ariba { 54 48 namespace communication { 55 49 56 typedef vector<IPv4Locator> AddressList; // TODO: make more general, not only ipv4 50 using namespace std; 51 using namespace ariba::addressing; 52 53 /// a list of addresses 54 typedef vector<address_v*> AddressList; 57 55 58 56 class AddressInformation { … … 62 60 63 61 AddressList getAddresses(const NetworkInterface& interface); 64 65 62 }; 66 63 -
source/ariba/overlay/BaseOverlay.cpp
r5274 r5284 185 185 // route message using overlay 186 186 else { 187 logging_error("Could not send message ");187 logging_error("Could not send message descriptor=" << ld ); 188 188 logging_debug( "sendMessage: Routing message to node " << ld->remoteNode.toString() ); 189 189 overlayInterface->routeMessage( ld->remoteNode, message ); … … 689 689 690 690 void BaseOverlay::onLinkUp(const LinkID& id, 691 const NetworkLocator* local, const NetworkLocator* remote) {691 const address_v* local, const address_v* remote) { 692 692 logging_debug( "Link up with base communication link id=" << id ); 693 693 … … 740 740 // if link is a relayed link ->convert to direct link 741 741 if (ld->relay) { 742 logging_force( "Converting to direct link: " << ld ); 742 743 ld->up = true; 743 744 ld->relay = false; … … 756 757 757 758 void BaseOverlay::onLinkDown(const LinkID& id, 758 const NetworkLocator* local, const NetworkLocator* remote) {759 const address_v* local, const address_v* remote) { 759 760 760 761 // get descriptor for link … … 780 781 781 782 void BaseOverlay::onLinkChanged(const LinkID& id, 782 const NetworkLocator* oldlocal, const NetworkLocator* newlocal,783 const NetworkLocator* oldremote, const NetworkLocator* newremote) {783 const address_v* oldlocal, const address_v* newlocal, 784 const address_v* oldremote, const address_v* newremote) { 784 785 785 786 // get descriptor for link … … 797 798 798 799 void BaseOverlay::onLinkFail(const LinkID& id, 799 const NetworkLocator* local, const NetworkLocator* remote) {800 const address_v* local, const address_v* remote) { 800 801 logging_debug( "Link fail with base communication link id=" << id ); 801 802 … … 813 814 } 814 815 815 void BaseOverlay::onLinkQoSChanged(const LinkID& id, const NetworkLocator* local,816 const NetworkLocator* remote, const QoSParameterSet& qos) {816 void BaseOverlay::onLinkQoSChanged(const LinkID& id, const address_v* local, 817 const address_v* remote, const QoSParameterSet& qos) { 817 818 logging_debug( "Link quality changed with base communication link id=" << id ); 818 819 … … 826 827 } 827 828 828 bool BaseOverlay::onLinkRequest( const LinkID& id, const NetworkLocator* local,829 const NetworkLocator* remote ) {830 logging_debug("Accepting link request from " << remote->to String() );829 bool BaseOverlay::onLinkRequest( const LinkID& id, const address_v* local, 830 const address_v* remote ) { 831 logging_debug("Accepting link request from " << remote->to_string() ); 831 832 return true; 832 833 } … … 1358 1359 case OverlayMsg::typeDirectLink: { 1359 1360 LinkDescriptor* rld = getDescriptor( overlayMsg->getRelayLink() ); 1361 logging_force( "Received direct link convert notification for " << rld ); 1360 1362 rld->communicationId = ld->communicationId; 1361 1363 rld->communicationUp = true; -
source/ariba/overlay/BaseOverlay.h
r5151 r5284 118 118 namespace overlay { 119 119 120 using namespace ariba::addressing; 121 120 122 class LinkDescriptor; 121 123 … … 285 287 * @see ariba::communication::CommunicationEvents.h 286 288 */ 287 virtual void onLinkUp(const LinkID& id, const NetworkLocator* local,288 const NetworkLocator* remote);289 290 /** 291 * @see ariba::communication::CommunicationEvents.h 292 */ 293 virtual void onLinkDown(const LinkID& id, const NetworkLocator* local,294 const NetworkLocator* remote);289 virtual void onLinkUp(const LinkID& id, const address_v* local, 290 const address_v* remote); 291 292 /** 293 * @see ariba::communication::CommunicationEvents.h 294 */ 295 virtual void onLinkDown(const LinkID& id, const address_v* local, 296 const address_v* remote); 295 297 296 298 /** … … 298 300 */ 299 301 virtual void onLinkChanged(const LinkID& id, 300 const NetworkLocator* oldlocal, const NetworkLocator* newlocal,301 const NetworkLocator* oldremote, const NetworkLocator* newremote);302 303 /** 304 * @see ariba::communication::CommunicationEvents.h 305 */ 306 virtual void onLinkFail(const LinkID& id, const NetworkLocator* local,307 const NetworkLocator* remote);302 const address_v* oldlocal, const address_v* newlocal, 303 const address_v* oldremote, const address_v* newremote); 304 305 /** 306 * @see ariba::communication::CommunicationEvents.h 307 */ 308 virtual void onLinkFail(const LinkID& id, const address_v* local, 309 const address_v* remote); 308 310 309 311 /** … … 311 313 */ 312 314 virtual void onLinkQoSChanged(const LinkID& id, 313 const NetworkLocator* local, const NetworkLocator* remote,315 const address_v* local, const address_v* remote, 314 316 const QoSParameterSet& qos); 315 317 … … 317 319 * @see ariba::communication::CommunicationEvents.h 318 320 */ 319 virtual bool onLinkRequest(const LinkID& id, const NetworkLocator* local,320 const NetworkLocator* remote);321 virtual bool onLinkRequest(const LinkID& id, const address_v* local, 322 const address_v* remote); 321 323 322 324 /** -
source/ariba/overlay/LinkDescriptor.h
r5151 r5284 128 128 s << "serv=" << service.toString() << " "; 129 129 s << "overId=" << overlayId.toString().substr(0,6) << " "; 130 s << "commUp=" << communicationUp << " "; 130 131 s << "commId=" << communicationId.toString().substr(0,6) << " "; 131 132 s << "usedAsRel=" << usedAsRelay << " "; -
source/ariba/utility/bootstrap/modules/multicastdns/MulticastDns.cpp
r4850 r5284 1 1 2 // [License] 2 3 // The Ariba-Underlay Copyright -
source/ariba/utility/serialization/DataStream.hpp
r4619 r5284 44 44 #include <boost/type_traits/make_unsigned.hpp> 45 45 46 #include <cassert> 46 47 #include <iostream> 47 48 #include <vector> … … 331 332 bits.setLength(index); 332 333 return bits; 334 } 335 336 finline uint8_t* bytes( size_t length ) { 337 assert((index%bits.word_width)==0); 338 if (!isMeasure()) { 339 bits.ensureLength( index + length * 8); 340 uint8_t* buffer = (uint8_t*)bits.getBuffer()+(index/bits.word_width); 341 index += length*8; 342 return buffer; 343 } else { 344 index += length*8; 345 return NULL; 346 } 333 347 } 334 348 -
source/ariba/utility/system/StartupWrapper.cpp
r5151 r5284 98 98 { 99 99 log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger()); 100 logger->setLevel(log4cxx::Level::get Debug());100 logger->setLevel(log4cxx::Level::getError()); 101 101 } 102 102 103 103 // set up again an individual level if you like 104 104 { 105 //log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("PingPong"));106 //logger->setLevel(log4cxx::Level::getDebug());105 log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("PingPong")); 106 logger->setLevel(log4cxx::Level::getDebug()); 107 107 } 108 108 { 109 //log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BaseCommunication"));110 // logger->setLevel(log4cxx::Level::getDebug());109 log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BaseCommunication")); 110 logger->setLevel(log4cxx::Level::getInfo()); 111 111 } 112 112
Note:
See TracChangeset
for help on using the changeset viewer.