VirtualBox

Changeset 48461 in vbox for trunk/src/VBox/NetworkServices


Ignore:
Timestamp:
Sep 12, 2013 6:14:50 PM (11 years ago)
Author:
vboxsync
Message:

DHCP + lwip_nat: Domain Name passing on demand.

Location:
trunk/src/VBox/NetworkServices/DHCP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/DHCP/Config.cpp

    r48420 r48461  
    432432}
    433433
     434int ConfigurationManager::setString(uint8_t u8OptId, const std::string& str)
     435{
     436    switch (u8OptId)
     437    {
     438        case RTNET_DHCP_OPT_DOMAIN_NAME:
     439            m_domainName = str;
     440            break;
     441        default:
     442            break;
     443    }
     444
     445    return VINF_SUCCESS;
     446}
     447
     448const std::string& ConfigurationManager::getString(uint8_t u8OptId)
     449{
     450    switch (u8OptId)
     451    {
     452        case RTNET_DHCP_OPT_DOMAIN_NAME:
     453            if (m_domainName.length())
     454                return m_domainName;
     455            else
     456                return m_noString;
     457        default:
     458            break;
     459    }
     460
     461    return m_noString;
     462}
     463
    434464/**
    435465 * Network manager
     
    726756                break;
    727757            case RTNET_DHCP_OPT_DOMAIN_NAME:
     758                {
     759                    std::string domainName = g_ConfigurationManager->getString(pReqList[idxParam]);
     760                    if (domainName == g_ConfigurationManager->m_noString)
     761                        break;
     762
     763                    char *pszDomainName = (char *)&opt.au8RawOpt[0];
     764
     765                    strcpy(pszDomainName, domainName.c_str());
     766                    opt.cbRawOpt = domainName.length();
     767                    client->rawOptions.push_back(opt);
     768                }
    728769                break;
    729770            default:
  • trunk/src/VBox/NetworkServices/DHCP/Config.h

    r48432 r48461  
    398398    int addToAddressList(uint8_t u8OptId, RTNETADDRIPV4& address);
    399399    int flushAddressList(uint8_t u8OptId);
     400    int setString(uint8_t u8OptId, const std::string& str);
     401    const std::string& getString(uint8_t u8OptId);
    400402    const Ipv4AddressContainer& getAddressList(uint8_t u8OptId);
    401403
    402     private:
     404private:
    403405    ConfigurationManager(){}
    404406    virtual ~ConfigurationManager(){}
    405 
    406407    bool isAddressTaken(const RTNETADDRIPV4& addr, Lease** ppLease = NULL);
     408
     409public:
     410    /* nulls */
     411    const Ipv4AddressContainer m_empty;
     412    const std::string    m_noString;
     413
     414private:
    407415    MapLease2Ip4Address m_allocations;
    408416    /**
    409417     * Here we can store expired Leases to do not re-allocate them latter.
    410418     */
     419
    411420    /* XXX: MapLease2Ip4Address m_freed; */
    412     /*
    413      *
    414      */
     421    /* XXX: more universal storages are required. */
    415422    Ipv4AddressContainer m_nameservers;
    416423    Ipv4AddressContainer m_routers;
    417     Ipv4AddressContainer m_empty;
     424
     425
     426    std::string          m_domainName;
    418427    VecClient m_clients;
    419428
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r48430 r48461  
    463463            }
    464464            strs.setNull();
    465 
    466             Bstr domain;
    467             if (SUCCEEDED(host->COMGETTER(DomainName)(domain.asOutPutParam())))
    468             {
    469                 /* XXX: todo. */
    470             }
    471465#endif
     466            com::Bstr domain;
     467            if (SUCCEEDED(host->COMGETTER(DomainName)(domain.asOutParam())))
     468                confManager->setString(RTNET_DHCP_OPT_DOMAIN_NAME, std::string(com::Utf8Str(domain).c_str()));
     469           
     470
    472471        }
    473472    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette