|
Boost : |
Subject: Re: [boost] [Review] UUID library (mini-)review starts today, November 23rd
From: Manuel Fiorelli (manuel.fiorelli_at_[hidden])
Date: 2008-11-27 21:31:13
>
> Why not leaving the burden of retrieving the MAC address to the user,
> then?
>
In my opinion one can provide a "generic" generator, which requires a MAC
address; but there should be a set of platform specific generators, which
use system calls to get the hardware address.
I am not a network expert, but it seems that on Linux you can obtain the MAC
address through IOCTL
http://www.geekpage.jp/en/programming/linux-network/get-macaddr.php
even if this approach couldn't be very reliable
http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2007-06/msg00854.html
In any case one could look at the ifconfig source
http://www.koders.com/c/fidF4E339CD5847BBECCA5405DD6592D79452A56D3E.aspx?s=link
(I am not sure it is the original code :-)
For Windows user I found the article
http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c5451
with a warning
http://www.codeguru.com/cpp/i-n/network/networkinformation/comments.php/c5451/?thread=5453
In any cases, one should add the error checking :-)
Manuel Fiorelli
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk