Index: trunk/src/VBox/NetworkServices/DHCP/Config.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/Config.cpp	(revision 49062)
+++ trunk/src/VBox/NetworkServices/DHCP/Config.cpp	(revision 49063)
@@ -34,4 +34,43 @@
 #include "Config.h"
 
+/* types */
+class Lease::Data
+{
+public:
+    Data()
+    {
+        m_address.u = 0;
+        m_client = NULL;
+        fBinding = true;
+        u64TimestampBindingStarted = 0;
+        u64TimestampLeasingStarted = 0;
+        u32LeaseExpirationPeriod = 0;
+        u32BindExpirationPeriod = 0;
+        pCfg = NULL;
+
+    }
+    ~Data(){}
+    
+    RTNETADDRIPV4 m_address;
+
+    /** lease isn't commited */
+    bool fBinding;
+
+    /** Timestamp when lease commited. */
+    uint64_t u64TimestampLeasingStarted;
+    /** Period when lease is expired in secs. */
+    uint32_t u32LeaseExpirationPeriod;
+
+    /** timestamp when lease was bound */
+    uint64_t u64TimestampBindingStarted;
+    /* Period when binding is expired in secs. */
+    uint32_t u32BindExpirationPeriod;
+
+    NetworkConfigEntity *pCfg;
+    Client *m_client;
+};
+
+
+/* consts */
 
 const NullConfigEntity *g_NullConfig = new NullConfigEntity();
@@ -241,5 +280,5 @@
         else
         {
-            AssertReturn(client->m_lease->m_address.u != 0,NULL);
+            AssertReturn(client->m_lease->getAddress().u != 0,NULL);
             return client->m_lease;
         }
@@ -269,8 +308,9 @@
     {
         please = new Lease();
-        please->pCfg = pNetCfg;
-        please->m_client = client;
+        please->init();
+        please->setConfig(pNetCfg);
+        please->setClient(client);
         client->m_lease = please;
-        client->m_lease->m_address = hintAddress;
+        client->m_lease->setAddress(hintAddress);
         m_allocations[please] = hintAddress;
         return please;
@@ -287,9 +327,12 @@
         {
             please = new Lease();
-            please->pCfg = pNetCfg;
-            please->m_client = client;
+            please->init();
+            please->setConfig(pNetCfg);
+            please->setClient(client);
+            please->setAddress(address);
+
             client->m_lease = please;
-            client->m_lease->m_address = address;
-            m_allocations[please] = client->m_lease->m_address;
+
+            m_allocations[please] = address;
             return please;
         }
@@ -302,8 +345,9 @@
 int ConfigurationManager::commitLease4Client(Client *client)
 {
-    client->m_lease->u64TimestampBindingStarted = 0;
-    client->m_lease->u32LeaseExpirationPeriod = client->m_lease->pCfg->expirationPeriod();
-    client->m_lease->u64TimestampLeasingStarted = RTTimeMilliTS();
-    client->m_lease->fBinding = false;
+    client->m_lease->bindingPhase(false);
+
+    client->m_lease->setExpiration(client->m_lease->getConfig()->expirationPeriod());
+    client->m_lease->phaseStart(RTTimeMilliTS());
+
     return VINF_SUCCESS;
 }
@@ -486,5 +530,5 @@
 
 
-    RTNETADDRIPV4 address = client->m_lease->m_address;
+    RTNETADDRIPV4 address = client->m_lease->getAddress();
     BootPReplyMsg.BootPHeader.bp_yiaddr =  address;
 
@@ -509,5 +553,5 @@
 
     opt.u8OptId = RTNET_DHCP_OPT_LEASE_TIME;
-    *(uint32_t *)opt.au8RawOpt = RT_H2N_U32(client->m_lease->pCfg->expirationPeriod());
+    *(uint32_t *)opt.au8RawOpt = RT_H2N_U32(client->m_lease->getConfig()->expirationPeriod());
     opt.cbRawOpt = sizeof(RTNETADDRIPV4);
     client->rawOptions.push_back(opt);
@@ -532,5 +576,5 @@
     prepareReplyPacket4Client(client, u32Xid);
 
-    address = client->m_lease->m_address;
+    address = client->m_lease->getAddress();
     BootPReplyMsg.BootPHeader.bp_ciaddr =  address;
 
@@ -540,6 +584,6 @@
      * XXX: Using addressHint is not correct way to initialize [cy]iaddress...
      */
-    BootPReplyMsg.BootPHeader.bp_ciaddr = client->m_lease->m_address;
-    BootPReplyMsg.BootPHeader.bp_yiaddr = client->m_lease->m_address;
+    BootPReplyMsg.BootPHeader.bp_ciaddr = address;
+    BootPReplyMsg.BootPHeader.bp_yiaddr = address;
 
     Assert(BootPReplyMsg.BootPHeader.bp_yiaddr.u);
@@ -563,5 +607,5 @@
      */
     opt.u8OptId = RTNET_DHCP_OPT_LEASE_TIME;
-    *(uint32_t *)opt.au8RawOpt = RT_H2N_U32(client->m_lease->u32LeaseExpirationPeriod);
+    *(uint32_t *)opt.au8RawOpt = RT_H2N_U32(client->m_lease->getExpiration());
     opt.cbRawOpt = sizeof(RTNETADDRIPV4);
     client->rawOptions.push_back(opt);
@@ -629,5 +673,5 @@
     BootPReplyMsg.BootPHeader.bp_chaddr.Mac = client->m_mac;
 
-    BootPReplyMsg.BootPHeader.bp_yiaddr = client->m_lease->m_address;
+    BootPReplyMsg.BootPHeader.bp_yiaddr = client->m_lease->getAddress();
     BootPReplyMsg.BootPHeader.bp_siaddr.u = 0;
 
@@ -722,5 +766,5 @@
     uint8_t *pReqList = pu8ReqList;
 
-    const NetworkConfigEntity *pNetCfg = client->m_lease->pCfg;
+    const NetworkConfigEntity *pNetCfg = client->m_lease->getConfig();
 
     for (idxParam = 0; idxParam < cReqList; ++idxParam)
@@ -778,2 +822,103 @@
     return VINF_SUCCESS;
 }
+
+
+Lease::~Lease()
+{
+    if (m)
+        delete m;
+}
+
+
+void Lease::init()
+{
+    if (!m)
+        m = new Lease::Data();
+}
+
+
+bool Lease::isExpired() const
+{
+    AssertPtrReturn(m, false);
+
+    if (!m->fBinding)
+        return (ASMDivU64ByU32RetU32(RTTimeMilliTS() - m->u64TimestampLeasingStarted, 1000)
+                > m->u32LeaseExpirationPeriod);
+    else
+        return (ASMDivU64ByU32RetU32(RTTimeMilliTS() - m->u64TimestampBindingStarted, 1000)
+                > m->u32BindExpirationPeriod);
+}
+
+
+void Lease::phaseStart(uint64_t u64Start)
+{
+    if (m->fBinding)
+        m->u64TimestampBindingStarted = u64Start;
+    else
+        m->u64TimestampLeasingStarted = u64Start;
+}
+
+
+void Lease::bindingPhase(bool fOnOff)
+{
+    m->fBinding = fOnOff;
+}
+
+
+bool Lease::isInBindingPhase() const
+{
+    return m->fBinding;
+}
+
+
+void Lease::setExpiration(uint32_t exp)
+{
+    if (m->fBinding)
+        m->u32BindExpirationPeriod = exp;
+    else
+        m->u32LeaseExpirationPeriod = exp;
+}
+
+
+uint32_t Lease::getExpiration() const
+{
+    if (m->fBinding)
+        return m->u32BindExpirationPeriod;
+    else
+        return m->u32LeaseExpirationPeriod;
+}
+
+
+RTNETADDRIPV4 Lease::getAddress() const
+{
+    return m->m_address;
+}
+
+
+void Lease::setAddress(RTNETADDRIPV4 address)
+{
+    m->m_address = address;
+}
+
+
+const NetworkConfigEntity *Lease::getConfig() const
+{
+    return m->pCfg;
+}
+
+
+void Lease::setConfig(NetworkConfigEntity *pCfg)
+{
+    m->pCfg = pCfg;
+}
+
+
+Client *Lease::getClient() const
+{
+    return m->m_client;
+}
+
+void Lease::setClient(Client *client)
+{
+    m->m_client = client;
+}
Index: trunk/src/VBox/NetworkServices/DHCP/Config.h
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/Config.h	(revision 49062)
+++ trunk/src/VBox/NetworkServices/DHCP/Config.h	(revision 49063)
@@ -475,46 +475,31 @@
 {
 public:
-    Lease()
-    {
-        m_address.u = 0;
-        m_client = NULL;
-        fBinding = false;
-        u64TimestampBindingStarted = 0;
-        u64TimestampLeasingStarted = 0;
-        u32LeaseExpirationPeriod = 0;
-        u32BindExpirationPeriod = 0;
-        pCfg = NULL;
-    }
-    virtual ~Lease(){}
-
-    bool isExpired()
-    {
-        if (!fBinding)
-            return (ASMDivU64ByU32RetU32(RTTimeMilliTS() - u64TimestampLeasingStarted, 1000)
-                    > u32LeaseExpirationPeriod);
-        else
-            return (ASMDivU64ByU32RetU32(RTTimeMilliTS() - u64TimestampBindingStarted, 1000)
-                    > u32BindExpirationPeriod);
-
-    }
-
-    /* XXX private: */
-    RTNETADDRIPV4 m_address;
-
-    /** lease isn't commited */
-    bool fBinding;
-
-    /** Timestamp when lease commited. */
-    uint64_t u64TimestampLeasingStarted;
-    /** Period when lease is expired in secs. */
-    uint32_t u32LeaseExpirationPeriod;
-
-    /** timestamp when lease was bound */
-    uint64_t u64TimestampBindingStarted;
-    /* Period when binding is expired in secs. */
-    uint32_t u32BindExpirationPeriod;
-
-    NetworkConfigEntity *pCfg;
-    Client *m_client;
+    Lease():m(NULL){};
+    ~Lease();
+    void init();
+
+    bool isExpired() const;
+
+    /* Depending on phase *Expiration and phaseStart initialize different values. */
+    void bindingPhase(bool);
+    void phaseStart(uint64_t u64Start);
+    bool isInBindingPhase() const;
+
+    void setExpiration(uint32_t);
+    uint32_t getExpiration() const;
+
+    RTNETADDRIPV4 getAddress() const;
+    void setAddress(RTNETADDRIPV4);
+
+    const NetworkConfigEntity *getConfig() const;
+    void setConfig(NetworkConfigEntity *);
+   
+    Client *getClient() const;
+    void setClient(Client *);
+
+    private:
+    class Data;
+    
+    Data *m;
 };
 
Index: trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
===================================================================
--- trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 49062)
+++ trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp	(revision 49063)
@@ -736,7 +736,7 @@
         NetworkManager *networkManager = NetworkManager::getNetworkManager();
 
-        lease->fBinding = true;
-        lease->u64TimestampBindingStarted = RTTimeMilliTS();
-        lease->u32BindExpirationPeriod = 300; /* 3 min. */
+        lease->bindingPhase(true);
+        lease->phaseStart(RTTimeMilliTS());
+        lease->setExpiration(300); /* 3 min. */
         networkManager->offer4Client(client, pDhcpMsg->bp_xid, opt.au8RawOpt, opt.cbRawOpt);
     } /* end of if(!m_DhcpServer.isNull()) */
