[Winpcap-users] Retireving MAC Address

ss ak ssak22 at gmail.com
Thu Dec 18 19:16:27 GMT 2008


I am working on example to get the mac address of the adapter.

Is this the way to get the mac address of the adapter...

char curAddr[14];
std::string macAddrFormat("%02x:%02x:%02x:%02x:%02x:%02x");
    /* Jump to the selected adapter */
    for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);

    printf("\n adrress %02x:%02x:%02x:%02x:%02x:%02x",
        d->addresses->addr->sa_data[0],
            d->addresses->addr->sa_data[1],
            d->addresses->addr->sa_data[2],
            d->addresses->addr->sa_data[3],
            d->addresses->addr->sa_data[4],
            d->addresses->addr->sa_data[5]);


snprintf(&curAddr[0],18,macAddrFormat.c_str(),
                d->addresses->addr->sa_data[0],
            d->addresses->addr->sa_data[1],
            d->addresses->addr->sa_data[2],
            d->addresses->addr->sa_data[3],
            d->addresses->addr->sa_data[4],
            d->addresses->addr->sa_data[5]);

I have to compare the mac address from my config file and only allow that
adapter to  capture packets...
Please tell me how to do...its URGENT...

Thanks in advance,,,,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20081218/dc005541/attachment.htm


More information about the Winpcap-users mailing list