Ignore:
Timestamp:
Aug 4, 2009, 10:17:33 AM (15 years ago)
Author:
Christoph Mayer
Message:

adress detection aufgeräumt, network info für bleutooth, data stream (hopeful crash fix), logging auf maemo nur warn, ...

Location:
source/ariba/communication
Files:
3 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/BaseCommunication.cpp

    r5636 r5638  
    3838
    3939#include "BaseCommunication.h"
     40#include "networkinfo/AddressDiscovery.h"
    4041
    4142#ifdef UNDERLAY_OMNET
     
    5152namespace ariba {
    5253namespace communication {
    53 
    54 #include "networkinfo/AddressDiscovery.hpp"
    5554
    5655use_logging_cpp(BaseCommunication);
     
    115114
    116115        logging_info( "Searching for local locators ..." );
    117         discover_endpoints(localDescriptor.getEndpoints());
     116        AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() );
    118117        logging_info( "Done. Local endpoints = " << localDescriptor.toString() );
    119118
  • source/ariba/communication/networkinfo/NetworkInformation.cpp

    r4843 r5638  
    3838
    3939#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
    4047
    4148namespace ariba {
     
    192199        } // for( ; i != iend; i++ )*/
    193200
     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
    194254        return retlist;
    195255}
  • source/ariba/communication/networkinfo/NetworkInterface.h

    r3690 r5638  
    6363        bool    isBroadcast;
    6464        bool    isMulticast;
    65         int     mtu;
    66         int     txQueueLen;
     65        int             mtu;
     66        int             txQueueLen;
    6767
    6868        static NetworkInterface UNDEFINED;
    6969
    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 ){
    7184                // equality means same name
    7285                return ( name.compare(rh.name) == 0 );
Note: See TracChangeset for help on using the changeset viewer.