Changeset 5638
- Timestamp:
- Aug 4, 2009, 10:17:33 AM (15 years ago)
- Location:
- source/ariba
- Files:
-
- 3 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/Makefile.am
r5630 r5638 245 245 246 246 libariba_la_SOURCES += \ 247 communication/networkinfo/Address Information.cpp \247 communication/networkinfo/AddressDiscovery.cpp \ 248 248 communication/networkinfo/NetworkChangeDetection.cpp \ 249 249 communication/networkinfo/NetworkInformation.cpp \ … … 251 251 252 252 nobase_libariba_la_HEADERS += \ 253 communication/networkinfo/Address Information.h \253 communication/networkinfo/AddressDiscovery.h \ 254 254 communication/networkinfo/NetworkChangeDetection.h \ 255 255 communication/networkinfo/NetworkChangeInterface.h \ -
source/ariba/communication/BaseCommunication.cpp
r5636 r5638 38 38 39 39 #include "BaseCommunication.h" 40 #include "networkinfo/AddressDiscovery.h" 40 41 41 42 #ifdef UNDERLAY_OMNET … … 51 52 namespace ariba { 52 53 namespace communication { 53 54 #include "networkinfo/AddressDiscovery.hpp"55 54 56 55 use_logging_cpp(BaseCommunication); … … 115 114 116 115 logging_info( "Searching for local locators ..." ); 117 discover_endpoints(localDescriptor.getEndpoints());116 AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() ); 118 117 logging_info( "Done. Local endpoints = " << localDescriptor.toString() ); 119 118 -
source/ariba/communication/networkinfo/NetworkInformation.cpp
r4843 r5638 38 38 39 39 #include "NetworkInformation.h" 40 #include "ariba/config.h" 41 42 #ifdef HAVE_BLUETOOTH_BLUETOOTH_H 43 #include <bluetooth/bluetooth.h> 44 #include <bluetooth/hci.h> 45 #include <bluetooth/hci_lib.h> 46 #endif 40 47 41 48 namespace ariba { … … 192 199 } // for( ; i != iend; i++ )*/ 193 200 201 // 202 // not we try to get bluetooth interfaces 203 // 204 205 #ifdef HAVE_BLUETOOTH_BLUETOOTH_H 206 207 int btsock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); 208 if(btsock < 0){ 209 logging_error("failed getting bluetooth raw socket"); 210 return retlist; 211 } 212 213 struct hci_dev_list_req* btlist = NULL; 214 struct hci_dev_req* btdev = NULL; 215 216 btlist = (hci_dev_list_req*)malloc(HCI_MAX_DEV * 217 sizeof(struct hci_dev_list_req) + sizeof(struct hci_dev_req)); 218 219 btlist->dev_num = HCI_MAX_DEV; 220 btdev = btlist->dev_req; 221 222 if(ioctl(btsock, HCIGETDEVLIST, btlist) < 0){ 223 logging_error("failed getting requesting bluetooth devices"); 224 free(btlist); 225 close(btsock); 226 return retlist; 227 } 228 229 btdev = btlist->dev_req; 230 231 for(int i=0; i<btlist->dev_num; i++, btdev++){ 232 struct hci_dev_info di; 233 NetworkInterface interface; 234 235 if(hci_devinfo(btdev->dev_id, &di) < 0) continue; 236 if(hci_test_bit(HCI_RAW, &di.flags)) continue; 237 238 interface.name = string(di.name); 239 interface.index = di.dev_id; 240 interface.mtu = di.sco_mtu; 241 interface.isBroadcast = false; 242 interface.isLoopback = false; 243 interface.isMulticast = false; 244 interface.isUp = hci_test_bit(HCI_UP, &di.flags); 245 interface.isRunning = hci_test_bit(HCI_RUNNING, &di.flags); 246 247 retlist.push_back( interface ); 248 } 249 250 free(btlist); 251 close(btsock); 252 #endif 253 194 254 return retlist; 195 255 } -
source/ariba/communication/networkinfo/NetworkInterface.h
r3690 r5638 63 63 bool isBroadcast; 64 64 bool isMulticast; 65 int mtu;66 int txQueueLen;65 int mtu; 66 int txQueueLen; 67 67 68 68 static NetworkInterface UNDEFINED; 69 69 70 inline bool operator==(const NetworkInterface& rh ){ 70 NetworkInterface& operator=(const NetworkInterface& rh){ 71 name = rh.name; 72 index = rh.index; 73 isRunning = rh.isRunning; 74 isUp = rh.isUp; 75 isLoopback = rh.isLoopback; 76 isBroadcast = rh.isBroadcast; 77 isMulticast = rh.isMulticast; 78 mtu = rh.mtu; 79 txQueueLen = rh.txQueueLen; 80 return *this; 81 } 82 83 bool operator==(const NetworkInterface& rh ){ 71 84 // equality means same name 72 85 return ( name.compare(rh.name) == 0 ); -
source/ariba/overlay/BaseOverlay.cpp
r5624 r5638 127 127 // get descriptor of first hop 128 128 rld = getDescriptor(rlid); 129 logging_ force( rld );129 logging_info( rld ); 130 130 131 131 // is first hop a relay path? yes-> try to find real link! … … 154 154 return NodeID::UNSPECIFIED; 155 155 else { 156 logging_ force( "Returning relay node " << relayNode.toString() );156 logging_info( "Returning relay node " << relayNode.toString() ); 157 157 return relayNode; 158 158 } … … 810 810 // if link is a relayed link ->convert to direct link 811 811 if (ld->relay) { 812 logging_ force( "Converting to direct link: " << ld );812 logging_info( "Converting to direct link: " << ld ); 813 813 ld->up = true; 814 814 ld->relay = false; … … 836 836 LinkDescriptor* ld = getDescriptor(id, true); 837 837 if ( ld == NULL ) return; // not found? ->ignore! 838 logging_ force( "onLinkDown descriptor: " << ld );838 logging_info( "onLinkDown descriptor: " << ld ); 839 839 840 840 // inform listeners about link down … … 1426 1426 logging_debug( "received keep-alive on link" ); 1427 1427 if ( ld != NULL ) { 1428 logging_ force("Keep-Alive for "<< ld->overlayId);1428 logging_info("Keep-Alive for "<< ld->overlayId); 1429 1429 ld->markAlive(); 1430 1430 } … … 1445 1445 break; 1446 1446 } 1447 logging_ force( "Received direct link convert notification for " << rld );1447 logging_info( "Received direct link convert notification for " << rld ); 1448 1448 1449 1449 // set communcation link id and set it up … … 1560 1560 // missed more than four keep-alive messages (10 sec)? -> drop link 1561 1561 if (ld->keepAliveMissed > 4) { 1562 logging_ force( "Link connection request is stale, closing: " << ld );1562 logging_info( "Link connection request is stale, closing: " << ld ); 1563 1563 oldlinks.push_back( ld ); 1564 1564 continue; … … 1588 1588 // missed more than four keep-alive messages (4 sec)? -> drop link 1589 1589 if (ld->keepAliveMissed >= 8) { 1590 logging_ force( "Link is stale, closing: " << ld );1590 logging_info( "Link is stale, closing: " << ld ); 1591 1591 oldlinks.push_back( ld ); 1592 1592 continue; … … 1602 1602 1603 1603 if (!ld->communicationId.isUnspecified() && it != bootstrapLinks.end() ){ 1604 logging_ force( "Not dropping initiator link: " << ld );1604 logging_info( "Not dropping initiator link: " << ld ); 1605 1605 continue; 1606 1606 } 1607 1607 */ 1608 logging_ force( "Link timed out. Dropping " << ld );1608 logging_info( "Link timed out. Dropping " << ld ); 1609 1609 dropLink( ld->overlayId ); 1610 1610 } … … 1618 1618 void BaseOverlay::showLinkState() { 1619 1619 int i=0; 1620 logging_ force("--- link state -------------------------------");1620 logging_info("--- link state -------------------------------"); 1621 1621 BOOST_FOREACH( LinkDescriptor* ld, links ) { 1622 logging_ force("link " << i << ": " << ld);1622 logging_info("link " << i << ": " << ld); 1623 1623 i++; 1624 1624 } 1625 logging_ force("----------------------------------------------");1625 logging_info("----------------------------------------------"); 1626 1626 } 1627 1627 -
source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.cpp
r5633 r5638 41 41 #ifdef HAVE_BLUETOOTH_BLUETOOTH_H 42 42 43 44 45 46 47 48 49 50 51 52 43 // Attribute descriptors for SDP 44 // base was chosen randomly 45 #define SDP_SPOVNET_BASE 0x4000 46 #define SDP_ATTR_SPOVNET_NAME 0x0000 + SDP_SPOVNET_BASE 47 #define SDP_ATTR_SPOVNET_INFO1 0x0001 + SDP_SPOVNET_BASE 48 #define SDP_ATTR_SPOVNET_INFO2 0x0002 + SDP_SPOVNET_BASE 49 #define SDP_ATTR_SPOVNET_INFO3 0x0003 + SDP_SPOVNET_BASE 50 51 // The SpoVNet unique identifier, this should be the same for all SpoVNet implementations 52 const uint8_t svc_uuid_int[] = {0x59, 0x29, 0x24, 0x34, 0x69, 0x42, 0x11, 0xde, 0x94, 53 53 0x3e, 0x00, 0x21, 0x5d, 0xb4, 0xd8, 0x54}; 54 54 55 56 57 55 const char *service_name = "SpoVNet"; 56 const char *svc_dsc = "www.ariba-underlay.org"; 57 const char *service_prov = "ITM Uni Karlsruhe"; 58 58 59 59 #endif // HAVE_BLUETOOTH_BLUETOOTH_H … … 67 67 BootstrapModule(_callback), scan_timer_(io_service_) { 68 68 srand( time(NULL) ); 69 found = false;70 69 #ifdef HAVE_BLUETOOTH_BLUETOOTH_H 71 70 … … 141 140 uuid_t root_uuid, l2cap_uuid, rfcomm_uuid, svc_uuid, svc_class_uuid; 142 141 sdp_list_t *l2cap_list = 0, *rfcomm_list = 0, *root_list = 0, *proto_list = 143 0, *access_proto_list = 0, *svc_class_list = 0, *profile_list = 0;142 0, *access_proto_list = 0, *svc_class_list = 0, *profile_list = 0; 144 143 sdp_data_t *channel = 0; 145 144 sdp_profile_desc_t profile; … … 253 252 254 253 void BluetoothSdp::bt_scan() { 255 /* 256 * Scans for other bluetooth devices and starts a SDP search on them. 257 */ 258 259 logging_debug("scanning for peers"); 260 261 inquiry_info *ii = NULL; 262 int max_rsp, num_rsp; 263 int dev_id, sock, len, flags; 264 int i; 265 266 bdaddr_t address; 267 uint8_t channel; 268 269 dev_id = hci_get_route(NULL); 270 sock = hci_open_dev(dev_id); 271 if (dev_id < 0 || sock < 0) { 272 logging_error("opening socket for device " 273 << dev_id << " failed. can not scan for peers: " << strerror(errno)); 274 return; 275 } 276 277 len = 8; 278 max_rsp = 255; 279 flags = IREQ_CACHE_FLUSH; 280 ii = (inquiry_info*) malloc(max_rsp * sizeof(inquiry_info)); 281 282 num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags); 283 if (num_rsp < 0) 284 logging_error("hci_inquiry failed with " << num_rsp << ": " << strerror(errno)); 285 286 for (i = 0; i < num_rsp; i++) { 287 address = (ii + i)->bdaddr; 288 289 string saddress = ba2string(&address); 290 string sname = ba2name(&address, sock); 291 292 logging_debug("found peer [" << saddress << "] [" << sname << "]"); 293 sdp_search( address, sname ); 294 } 295 296 free(ii); 297 close(sock); 298 299 if(!found){ 300 int nextscan = (rand() % 30) + 5; 301 logging_debug("next sdp scan in " << nextscan << " seconds"); 302 303 304 scan_timer_.expires_from_now( boost::posix_time::seconds(nextscan) ); 305 scan_timer_.async_wait( boost::bind(&BluetoothSdp::bt_scan, this) ); 306 } 254 255 // 256 // scan for devices if we have no active rfcomm connections running. 257 // otherwise we would break existing connections due to chipping seq 258 // 259 260 if(!haveConnections()){ 261 262 /* 263 * Scans for other bluetooth devices and starts a SDP search on them. 264 */ 265 266 logging_debug("scanning for peers"); 267 268 inquiry_info *ii = NULL; 269 int max_rsp, num_rsp; 270 int dev_id, sock, len, flags; 271 int i; 272 273 bdaddr_t address; 274 uint8_t channel; 275 276 dev_id = hci_get_route(NULL); 277 sock = hci_open_dev(dev_id); 278 if (dev_id < 0 || sock < 0) { 279 logging_error("opening socket for device " 280 << dev_id << " failed. can not scan for peers: " << strerror(errno)); 281 return; 282 } 283 284 len = 8; 285 max_rsp = 255; 286 flags = IREQ_CACHE_FLUSH; 287 ii = (inquiry_info*) malloc(max_rsp * sizeof(inquiry_info)); 288 289 num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags); 290 if (num_rsp < 0) 291 logging_error("hci_inquiry failed with " << num_rsp << ": " << strerror(errno)); 292 293 for (i = 0; i < num_rsp; i++) { 294 address = (ii + i)->bdaddr; 295 296 string saddress = ba2string(&address); 297 string sname = ba2name(&address, sock); 298 299 logging_debug("found peer [" << saddress << "] [" << sname << "]"); 300 sdp_search( address, sname ); 301 } 302 303 free(ii); 304 close(sock); 305 306 } else { 307 logging_debug("have active rfcomm connectinos, not searching"); 308 } 309 310 int nextscan = (rand() % 30) + 5; 311 logging_debug("next sdp scan try in " << nextscan << " seconds"); 312 313 scan_timer_.expires_from_now( boost::posix_time::seconds(nextscan) ); 314 scan_timer_.async_wait( boost::bind(&BluetoothSdp::bt_scan, this) ); 307 315 } 308 316 … … 372 380 373 381 // Callback 374 found = true;375 382 callback->onBootstrapServiceFound(name, info1, info2, info3); 376 383 } … … 410 417 } 411 418 419 bool BluetoothSdp::haveConnections(){ 420 421 struct hci_conn_list_req* cl = NULL; 422 struct hci_conn_info* ci = NULL; 423 424 int btsock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); 425 if(btsock < 0){ 426 logging_error("failed getting bluetooth raw socket"); 427 return true; // return true to be safe here and not perform sdp scan 428 } 429 430 cl = (struct hci_conn_list_req*)malloc(10 * sizeof(struct hci_conn_info) + sizeof(struct hci_conn_list_req)); 431 432 cl->dev_id = hci_get_route(NULL);; 433 cl->conn_num = 10; 434 ci = cl->conn_info; 435 436 if(ioctl(btsock, HCIGETCONNLIST, (void*)cl)){ 437 logging_warn("could not get active rfcomm connections"); 438 return true; // return true to be safe here and not perform sdp scan 439 } 440 441 bool haveconn = (cl->conn_num > 0); 442 logging_error("we have " << cl->conn_num << " active connections"); 443 free(cl); 444 close(btsock); 445 446 return haveconn; 447 } 448 412 449 #endif // HAVE_BLUETOOTH_BLUETOOTH_H 413 450 -
source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h
r5632 r5638 92 92 sdp_session_t *sdp_session_; 93 93 uint8_t channel_; 94 95 bool haveConnections(); 94 96 #endif // HAVE_BLUETOOTH_BLUETOOTH_H 95 97 … … 97 99 boost::asio::deadline_timer scan_timer_; 98 100 boost::thread t_; 99 100 bool found;101 102 101 }; 103 102 -
source/ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.h
r5531 r5638 352 352 if( it != services->end() ){ 353 353 354 /* 354 355 it->second.setInfo1( msg.getInfo1() ); 355 356 it->second.setInfo2( msg.getInfo2() ); 356 357 it->second.setInfo3( msg.getInfo3() ); 358 */ 357 359 it->second.setLastseen( time(NULL) ); 358 360 -
source/ariba/utility/logging/Logging.h
r5634 r5638 44 44 #include <log4cxx/logger.h> 45 45 #include <log4cxx/basicconfigurator.h> 46 #include "ariba/config.h"47 46 48 47 … … 71 70 log4cxx::LoggerPtr x::logger(log4cxx::Logger::getLogger(#x)); 72 71 73 #ifdef HAVE_MAEMO 74 75 #define logging_trace(x) { } 76 #define logging_debug(x) { } 77 #define logging_info(x) { } 78 #define logging_warn(x) {colorWarn; LOG4CXX_WARN(logger,x); colorDefault; } 79 #define logging_error(x) {colorError; LOG4CXX_ERROR(logger,x); colorDefault; } 80 #define logging_force(x) { } 81 #define logging_fatal(x) {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); } 82 83 #else 84 85 #define logging_trace(x) { LOG4CXX_TRACE(logger,x); } 86 #define logging_debug(x) {colorDebug; LOG4CXX_DEBUG(logger,x); colorDefault; } 87 #define logging_info(x) {colorInfo; LOG4CXX_INFO(logger,x); colorDefault; } 88 #define logging_warn(x) {colorWarn; LOG4CXX_WARN(logger,x); colorDefault; } 89 #define logging_error(x) {colorError; LOG4CXX_ERROR(logger,x); colorDefault; } 90 #define logging_force(x) {colorInfo; LOG4CXX_INFO(logger,x); colorDefault; } 91 #define logging_fatal(x) {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); } 92 93 #endif // HAVE_MAEMO 72 #define logging_trace(x) { LOG4CXX_TRACE(logger,x); } 73 #define logging_debug(x) {colorDebug; LOG4CXX_DEBUG(logger,x); colorDefault; } 74 #define logging_info(x) {colorInfo; LOG4CXX_INFO(logger,x); colorDefault; } 75 #define logging_warn(x) {colorWarn; LOG4CXX_WARN(logger,x); colorDefault; } 76 #define logging_error(x) {colorError; LOG4CXX_ERROR(logger,x); colorDefault; } 77 #define logging_fatal(x) {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); } 94 78 95 79 #endif //LOGGING_H__ -
source/ariba/utility/serialization/DataStream.hpp
r5284 r5638 509 509 i++; 510 510 } 511 if (isCharP) *text = strdup(s.c_str()); else *string = s; 511 if (isCharP) *text = strdup(s.c_str()); 512 else string->assign(s); 512 513 } 513 514 sznMethodEnd() -
source/ariba/utility/system/StartupWrapper.cpp
r5614 r5638 38 38 39 39 #include "StartupWrapper.h" 40 #include "ariba/config.h" 40 41 41 42 namespace ariba { … … 131 132 // DON'T SVN COMMIT YOUR CHANGED LOGGING! THE ABOVE CODE MUST REMAIN AS IS! 132 133 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 134 135 #ifdef HAVE_MAEMO 136 log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger()); 137 logger->setLevel(log4cxx::Level::getWarn()); 138 #endif 133 139 } 134 140
Note:
See TracChangeset
for help on using the changeset viewer.