Ignore:
Timestamp:
Jul 29, 2009, 10:25:32 AM (15 years ago)
Author:
mies
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/networkinfo/AddressDiscovery.hpp

    r5284 r5406  
    66#include <sys/types.h>
    77#include <sys/socket.h>
     8#include <sys/ioctl.h>
     9#include <sys/socket.h>
     10
    811#include <arpa/inet.h>
     12
    913#include <netinet/in.h>
     14
    1015#include <net/if.h>
     16
    1117#include <ifaddrs.h>
     18
     19#include <bluetooth/bluetooth.h>
     20#include <bluetooth/hci.h>
     21#include <bluetooth/hci_lib.h>
    1222
    1323using namespace ariba::addressing;
     
    2636}
    2737
    28 void discoverEndpoints( endpoint_set& endpoints ) {
     38
     39int dev_info(int s, int dev_id, long arg) {
     40        endpoint_set* set = (endpoint_set*)arg;
     41        struct hci_dev_info di;
     42        di.dev_id = dev_id;
     43        if (ioctl(s, HCIGETDEVINFO, (void *) &di)) return 0;
     44        mac_address mac;
     45        mac.bluetooth( di.bdaddr );
     46        address_vf vf = mac;
     47        set->add(vf);
     48        return 0;
     49}
     50
     51void discover_bluetooth( endpoint_set& endpoints ) {
     52        hci_for_each_dev(HCI_UP, &dev_info, (long)&endpoints );
     53}
     54
     55void discover_ip_addresses( endpoint_set& endpoints ) {
    2956        struct ifaddrs* ifaceBuffer = NULL;
    3057        struct ifaddrs* tmpAddr     = NULL;
     
    6390                        mac_address mac = getMacFromIF(i->ifa_name);
    6491                        address_vf vf = mac;
    65                         endpoints.add( vf );
     92//                      endpoints.add( vf );
    6693                }
    6794        }
    6895}
    6996
     97void discover_endpoints( endpoint_set& endpoints ) {
     98        discover_ip_addresses( endpoints );
     99        discover_bluetooth( endpoints );
     100}
     101
    70102#endif /* ADDRESSDISCOVERY_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.