OSSP CVS Repository

ossp - Check-in [3932]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3932
Date: 2003-Jan-22 21:44:40 (local)
2003-Jan-22 20:44:40 (UTC)
User:ms
Branch:
Comment: Prepare for the battle of retreiving a MAC address from the OS.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_uuid.cpp      1.7 -> 1.8     29 inserted, 3 deleted
ossp-pkg/as/as-gui/as_uuid.h      1.3 -> 1.4     1 inserted, 0 deleted

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;
 }
 


ossp-pkg/as/as-gui/as_uuid.h 1.3 -> 1.4

--- as_uuid.h    2003/01/22 18:59:46     1.3
+++ as_uuid.h    2003/01/22 20:44:40     1.4
@@ -132,6 +132,7 @@
 
 private:
     void setId(const unsigned char *);  // Helper method to set data members
+    int setMac(unsigned char *);        // Helper method to set MAC node ID
 };
 }
 

CVSTrac 2.0.1