ossp-pkg/as/as-gui/as_uuid.cpp 1.7 -> 1.8
--- as_uuid.cpp 2003/01/22 18:59:46 1.7
+++ as_uuid.cpp 2003/01/22 20:44:40 1.8
@@ -30,10 +30,26 @@
//
#include <string>
+#include <sys/socket.h>
#include "as_uuid.h"
#include "as_rand.h"
+// All of these are for detecting
+// the MAC address in setMac()
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif // HAVE_UNISTD_H
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif // HAVE_SYS_SOCKIO_H
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif // HAVE_NET_IF_H
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif // HAVE_NETINET_IN_H
+
namespace AS {
@@ -48,11 +64,15 @@
// Generate random data and fill in our UUID member fields with it
Temprand.genData(szChardata, sizeof(szChardata));
setId(szChardata);
- setString(); // Uses field from internal data
// Since we don't just want random data, lets take some clock sequences also
this->clock_seq = (this->clock_seq & 0x3FFF) | 0x8000;
this->time_hi_and_version = (this->time_hi_and_version & 0x0FFF) | 0x4000;
+
+ // In every case that we can, set the node ID to the real MAC address
+ setMac(this->node);
+
+ setString(); // Set the human readable string
}
//
@@ -88,12 +108,18 @@
}
//
+// Helper method to set up the MAC address node ID member data
+//
+int Uuid::setMac(unsigned char *pucNode)
+{
+ return 0;
+}
+
+//
// Returns a formatted representation of a DCE standard UUID
//
std::string Uuid::getString(void)
{
-// // Copy to outbound string and benefit from auto dealloc
-// auto_ptr<char> szOut(new char[48]);
return m_Fmtstr;
}
|
|