VirtualBox

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


Ignore:
Timestamp:
Jan 24, 2014 8:23:12 AM (11 years ago)
Author:
vboxsync
Message:

spaces

Location:
trunk/src/VBox/NetworkServices
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/DHCP/ClientDataInt.h

    r49563 r50213  
    3737    }
    3838    ~ClientData(){}
    39    
     39
    4040    /* client information */
    4141    RTNETADDRIPV4 m_address;
    4242    RTNETADDRIPV4 m_network;
    4343    RTMAC m_mac;
    44    
     44
    4545    bool fHasClient;
    4646
    4747    /* Lease part */
    48     bool fHasLease; 
     48    bool fHasLease;
    4949    /** lease isn't commited */
    5050    bool fBinding;
     
    6464    NetworkConfigEntity *pCfg;
    6565};
     66
    6667#endif
  • trunk/src/VBox/NetworkServices/DHCP/Config.cpp

    r49920 r50213  
    11/* $Id$ */
     2/** @file
     3 * Configuration for DHCP.
     4 */
     5
     6/*
     7 * Copyright (C) 2013-2014 Oracle Corporation
     8 *
     9 * This file is part of VirtualBox Open Source Edition (OSE), as
     10 * available from http://www.virtualbox.org. This file is free software;
     11 * you can redistribute it and/or modify it under the terms of the GNU
     12 * General Public License (GPL) as published by the Free Software
     13 * Foundation, in version 2 as it comes in the "COPYING" file of the
     14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
     15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
     16 */
     17
    218
    319/**
     
    131147    bool                 fFileExists;
    132148};
    133    
     149
    134150ConfigurationManager *ConfigurationManager::getConfigurationManager()
    135151{
     
    174190{
    175191    m->m_leaseStorageFilename = leaseStorageFileName;
    176    
     192
    177193    xml::XmlFileParser parser;
    178194    xml::Document doc;
     
    208224        if (!lease->nameEquals(tagXMLLease.c_str()))
    209225            continue;
    210        
     226
    211227        ClientData *data = new ClientData();
    212228        Lease l(data);
    213         if (l.fromXML(lease)) 
     229        if (l.fromXML(lease))
    214230        {
    215231
     
    242258    if (!root)
    243259        return VERR_INTERNAL_ERROR;
    244    
     260
    245261    root->setAttribute(tagXMLLeasesAttributeVersion.c_str(), tagXMLLeasesVersion_1_0.c_str());
    246262
     
    388404        if (l != Lease::NullLease)
    389405        {
    390             /* Here we should take lease from the m_allocation which was feed with leases 
     406            /* Here we should take lease from the m_allocation which was feed with leases
    391407             *  on start
    392408             */
     
    476492    Lease l = client.lease();
    477493    AssertReturn(l != Lease::NullLease, VERR_INTERNAL_ERROR);
    478    
     494
    479495    if (l.isInBindingPhase())
    480496    {
     
    491507        return VINF_SUCCESS;
    492508    }
    493    
     509
    494510    l = Lease(client); /* re-new */
    495511    return VINF_SUCCESS;
     
    668684        RT_ZERO(BootPReplyMsg);
    669685        cbBooPReplyMsg = 0;
    670        
     686
    671687        m_OurAddress.u = 0;
    672688        m_OurNetmask.u = 0;
     
    803819
    804820    prepareReplyPacket4Client(client, u32Xid);
    805    
     821
    806822    Lease l = client.lease();
    807823    address = l.getAddress();
     
    926942    Cursor.optIPv4Addr(RTNET_DHCP_OPT_SERVER_ID, m->m_OurAddress);
    927943
    928     const Lease l = client.lease(); 
     944    const Lease l = client.lease();
    929945    const std::map<uint8_t, RawOption>& options = l.options();
    930946
    931     for(std::vector<RawOption>::const_iterator it = extra.begin(); 
     947    for(std::vector<RawOption>::const_iterator it = extra.begin();
    932948        it != extra.end(); ++it)
    933949    {
     
    938954    }
    939955
    940     for(std::map<uint8_t, RawOption>::const_iterator it = options.begin(); 
     956    for(std::map<uint8_t, RawOption>::const_iterator it = options.begin();
    941957        it != options.end(); ++it)
    942958    {
     
    953969#if 0
    954970    /** @todo need to see someone set this flag to check that it's correct. */
    955     if (!(pDhcpMsg->bp_flags & RTNET_DHCP_FLAGS_NO_BROADCAST)) 
     971    if (!(pDhcpMsg->bp_flags & RTNET_DHCP_FLAGS_NO_BROADCAST))
    956972    {
    957973        rc = VBoxNetUDPUnicast(m_pSession,
     
    970986        rc = m->m_service->hlpUDPBroadcast(RTNETIPV4_PORT_BOOTPS,               /* sender */
    971987                                           RTNETIPV4_PORT_BOOTPC,
    972                                            &m->BootPReplyMsg, 
     988                                           &m->BootPReplyMsg,
    973989                                           RTNET_DHCP_NORMAL_SIZE);
    974990
     
    979995
    980996
    981 int NetworkManager::processParameterReqList(const Client& client, const uint8_t *pu8ReqList, 
     997int NetworkManager::processParameterReqList(const Client& client, const uint8_t *pu8ReqList,
    982998                                            int cReqList, std::vector<RawOption>& extra)
    983999{
    9841000    const Lease l = client.lease();
    985    
     1001
    9861002    const NetworkConfigEntity *pNetCfg = l.getConfig();
    9871003
     
    12241240    if (!valueAddition) return false;
    12251241
    1226     xml::ElementNode *address = node->createChild(tagXMLLeaseAddress.c_str()); 
     1242    xml::ElementNode *address = node->createChild(tagXMLLeaseAddress.c_str());
    12271243    if (!address) return false;
    12281244
     
    12301246    if (!valueAddition) return false;
    12311247
    1232     xml::ElementNode *time = node->createChild(tagXMLLeaseTime.c_str()); 
     1248    xml::ElementNode *time = node->createChild(tagXMLLeaseTime.c_str());
    12331249    if (!time) return false;
    12341250
    1235     valueAddition = time->setAttribute(tagXMLTimeAttributeIssued.c_str(), 
     1251    valueAddition = time->setAttribute(tagXMLTimeAttributeIssued.c_str(),
    12361252                                       m->u64TimestampLeasingStarted);
    12371253    if (!valueAddition) return false;
    12381254
    1239     valueAddition = time->setAttribute(tagXMLTimeAttributeExpiration.c_str(), 
     1255    valueAddition = time->setAttribute(tagXMLTimeAttributeExpiration.c_str(),
    12401256                                       m->u32LeaseExpirationPeriod);
    12411257    if (!valueAddition) return false;
     
    12661282    if (!valueExists) return false;
    12671283    rc = RTNetStrToIPv4Addr(addressValue.c_str(), &m->m_address);
    1268    
     1284
    12691285    /* Time */
    12701286    const xml::ElementNode *time = node->findChildElement(tagXMLLeaseTime.c_str());
    12711287    if (!time) return false;
    12721288
    1273     valueExists = time->getAttributeValue(tagXMLTimeAttributeIssued.c_str(), 
     1289    valueExists = time->getAttributeValue(tagXMLTimeAttributeIssued.c_str(),
    12741290                                          &m->u64TimestampLeasingStarted);
    12751291    if (!valueExists) return false;
    12761292    m->fBinding = false;
    1277    
    1278     valueExists = time->getAttributeValue(tagXMLTimeAttributeExpiration.c_str(), 
     1293
     1294    valueExists = time->getAttributeValue(tagXMLTimeAttributeExpiration.c_str(),
    12791295                                          &m->u32LeaseExpirationPeriod);
    12801296    if (!valueExists) return false;
     
    12871303const Lease Lease::NullLease;
    12881304
    1289 
    12901305const Client Client::NullClient;
  • trunk/src/VBox/NetworkServices/DHCP/Config.h

    r49926 r50213  
    1717
    1818#ifndef _CONFIG_H_
    19 # define _CONFIG_H_
     19#define _CONFIG_H_
    2020
    2121#include <iprt/asm-math.h>
     
    121121    bool isInBindingPhase() const;
    122122    /* returns 0 if in binding state */
    123     uint64_t issued() const; 
     123    uint64_t issued() const;
    124124
    125125    void setExpiration(uint32_t);
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r49859 r50213  
    254254        case 'l':
    255255        case 'u':
    256         case 'g': 
     256        case 'g':
    257257        {
    258258            char buf[17];
     
    287287    netManager->setOurMac(getMacAddress());
    288288    netManager->setService(this);
    289    
     289
    290290    if (isMainNeeded())
    291291        rc = initWithMain();
     
    465465            case 'b':
    466466                break;
    467                    
     467
    468468        }
    469469    }
    470        
     470
    471471    ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
    472472    AssertPtrReturn(confManager, VERR_INTERNAL_ERROR);
     
    569569
    570570        {
    571             VBoxNetALock(this);   
     571            VBoxNetALock(this);
    572572            ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
    573573            confManager->flushAddressList(RTNET_DHCP_OPT_DNS);
     
    575575            for (AddressList::iterator it = nameservers.begin(); it != nameservers.end(); ++it)
    576576                confManager->addToAddressList(RTNET_DHCP_OPT_DNS, *it);
    577            
     577
    578578            confManager->setString(RTNET_DHCP_OPT_DOMAIN_NAME, domain);
    579579        }
    580580    }
    581    
     581
    582582    return VINF_SUCCESS;
    583583}
  • trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp

    r50082 r50213  
    224224            break;
    225225        }
    226        
     226
    227227        case VBoxEventType_OnNATNetworkPortForward:
    228228        {
     
    540540
    541541    size_t idx = 0;
    542     for (struct pbuf *q = pPBuf; q != NULL; q = q->next, ++idx) 
     542    for (struct pbuf *q = pPBuf; q != NULL; q = q->next, ++idx)
    543543    {
    544544        AssertReturn(idx < RT_ELEMENTS(VBoxNetLwipNAT::aXmitSeg), ERR_MEM);
     
    605605    address.u     = RT_MAKE_U32_FROM_U8( 10,  0,  2,  2); // NB: big-endian
    606606    setIpv4Address(address);
    607    
     607
    608608    address.u     = RT_H2N_U32_C(0xffffff00);
    609609    setIpv4Netmask(address);
     
    701701
    702702/** This method executed on main thread, only at the end threr're one threads started explcitly (LWIP and later in ::run()
    703  * RECV) 
     703 * RECV)
    704704 */
    705705int VBoxNetLwipNAT::init()
     
    777777        unsigned long i = 0;
    778778        for (AddressToOffsetMapping::iterator it = tmp.begin();
    779              it != tmp.end() && i < RT_ELEMENTS(m_lo2off); 
     779             it != tmp.end() && i < RT_ELEMENTS(m_lo2off);
    780780             ++it, ++i)
    781781        {
     
    942942                          cbFrame - sizeof(PDMNETWORKGSO)))
    943943        return VERR_INVALID_PARAMETER;
    944    
     944
    945945    cbFrame -= sizeof(PDMNETWORKGSO);
    946946    uint8_t         abHdrScratch[256];
     
    11271127        Log(("%d-%s rule: %ls\n", idxRules, (fIsIPv6 ? "IPv6" : "IPv4"), rules[idxRules]));
    11281128        RT_ZERO(Rule);
    1129        
     1129
    11301130        int rc = netPfStrToPf(com::Utf8Str(rules[idxRules]).c_str(), 0, &Rule.Pfr);
    11311131        if (RT_FAILURE(rc))
    11321132            continue;
    1133        
     1133
    11341134        vec.push_back(Rule);
    11351135    }
  • trunk/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp

    r49830 r50213  
    122122 * variant but it's C++11.
    123123 */
    124 int hostDnsServers(const ComHostPtr& host, const RTNETADDRIPV4& networkid, 
     124int hostDnsServers(const ComHostPtr& host, const RTNETADDRIPV4& networkid,
    125125                   /*const*/ AddressToOffsetMapping& mapping, AddressList& servers)
    126126{
     
    166166
    167167    ComBstrArray strs;
    168     if (SUCCEEDED(host->COMGETTER(SearchStrings)(ComSafeArrayAsOutParam(strs)))) 
     168    if (SUCCEEDED(host->COMGETTER(SearchStrings)(ComSafeArrayAsOutParam(strs))))
    169169    {
    170170        for (unsigned int i = 0; i < strs.size(); ++i)
     
    193193
    194194
    195 int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr, 
     195int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr,
    196196                      NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events)
    197197{
  • trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp

    r49842 r50213  
    726726{
    727727    AssertMsgReturn(isMainNeeded(), ("It's expected that we need Main"), VERR_INTERNAL_ERROR);
    728        
     728
    729729    /* start receiving thread */
    730730    int rc = RTThreadCreate(&m->m_hThrRecv, /* thread handle*/
     
    743743    {
    744744        m->m_EventQ->processEventQueue(0);
    745            
     745
    746746        if (m->fShutdown)
    747747            break;
  • trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h

    r49842 r50213  
    5757};
    5858
    59 # ifndef BASE_SERVICES_ONLY 
     59# ifndef BASE_SERVICES_ONLY
    6060class VBoxNetBaseService: public VBoxNetHlpUDPService, public VBoxNetLockee
    6161{
  • trunk/src/VBox/NetworkServices/NetLib/shared_ptr.h

    r49339 r50213  
    33
    44#ifdef __cplusplus
    5 template<typename T> 
     5template<typename T>
    66class SharedPtr
    77{
    8     struct imp 
     8    struct imp
    99    {
    1010        imp(T *pTrg = NULL, int cnt = 1): ptr(pTrg),refcnt(cnt){}
     
    1515    };
    1616
    17    
     17
    1818    public:
    1919    SharedPtr(T *t = NULL):p(NULL)
     
    2121        p = new imp(t);
    2222    }
    23    
     23
    2424    ~SharedPtr()
    2525    {
     
    4040    {
    4141        if (p == rhs.p) return *this;
    42        
     42
    4343        p->refcnt--;
    44         if (p->refcnt == 0) 
     44        if (p->refcnt == 0)
    4545            delete p;
    4646
     
    5757    }
    5858
    59    
     59
    6060    T *operator->()
    6161    {
     
    6363    }
    6464
    65    
     65
    6666    const T*operator->() const
    6767    {
     
    7979};
    8080#endif
     81
    8182#endif
  • trunk/src/VBox/NetworkServices/NetLib/utils.h

    r49825 r50213  
    3333typedef std::map<RTNETADDRIPV4, int> AddressToOffsetMapping;
    3434
    35  
     35
    3636inline bool isDhcpRequired(const ComNatPtr& nat)
    3737{
     
    3939    if (FAILED(nat->COMGETTER(NeedDhcpServer)(&fNeedDhcpServer)))
    4040        return false;
    41    
     41
    4242    return fNeedDhcpServer;
    4343}
     
    4949                                                          dhcp.asOutParam());
    5050    AssertComRCReturn(hrc, VERR_NOT_FOUND);
    51    
     51
    5252    return VINF_SUCCESS;
    5353}
     
    6060
    6161    AssertComRCReturn(hrc, VERR_NOT_FOUND);
    62    
     62
    6363    return VINF_SUCCESS;
    6464}
     
    120120typedef ListenerImpl<NATNetworkListener, NATNetworkEventAdapter*> NATNetworkListenerImpl;
    121121
    122 # if VBOX_WITH_XPCOM 
     122# if VBOX_WITH_XPCOM
    123123class NS_CLASSINFO_NAME(NATNetworkListenerImpl);
    124124# endif
     
    127127typedef com::SafeArray<VBoxEventType_T> ComEventTypeArray;
    128128
    129 /* XXX: const is commented out because of compilation erro on Windows host, but it's intended that this function 
     129/* XXX: const is commented out because of compilation erro on Windows host, but it's intended that this function
    130130 isn't modify event type array */
    131 int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr, 
     131int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr,
    132132                      NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events);
    133133#endif
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