Changeset 75617 in vbox for trunk/src/VBox/NetworkServices/Dhcpd
- Timestamp:
- Nov 20, 2018 11:59:31 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 126792
- Location:
- trunk/src/VBox/NetworkServices/Dhcpd
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/Dhcpd/ClientId.h
r75614 r75617 35 35 ClientId() 36 36 : m_mac(), m_id() {} 37 ClientId(const RTMAC &mac Param, const OptClientId &idParam)38 : m_mac(mac Param), m_id(idParam) {}37 ClientId(const RTMAC &mac, const OptClientId &id) 38 : m_mac(mac), m_id(id) {} 39 39 40 40 const RTMAC &mac() const { return m_mac; } -
trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp
r75614 r75617 589 589 /** @todo r=bird: Visual C++ 2010 does not grok this use of 'auto'. */ 590 590 // XXX: debug 591 for ( optmap_t::const_iterator it = m_GlobalOptions.begin(); it != m_GlobalOptions.end(); ++it) {592 std::shared_ptr<DhcpOption> opt(it ->second);591 for (auto it: m_GlobalOptions) { 592 std::shared_ptr<DhcpOption> opt(it.second); 593 593 594 594 octets_t data; … … 596 596 597 597 bool space = false; 598 for (octets_t::const_iterator itData = data.begin(); itData != data.end(); ++itData) { 599 uint8_t c = *itData; 598 for (auto c: data) { 600 599 if (space) 601 600 std::cout << " "; … … 855 854 optmap << new OptSubnetMask(m_IPv4Netmask); 856 855 857 const OptParameterRequest::value_t& reqValue = reqOpts.value(); 858 for (octets_t::const_iterator itOptReq = reqValue.begin(); itOptReq != reqValue.end(); ++itOptReq) 859 { 860 uint8_t optreq = *itOptReq; 856 for (auto optreq: reqOpts.value()) 857 { 861 858 std::cout << ">>> requested option " << (int)optreq << std::endl; 862 859 … … 893 890 if (vmopts != NULL) 894 891 { 895 for ( optmap_t::const_iterator it = vmopts->begin(); it != vmopts->end(); ++it) {896 std::shared_ptr<DhcpOption> opt(it ->second);892 for (auto it: *vmopts) { 893 std::shared_ptr<DhcpOption> opt(it.second); 897 894 if (optmap.count(opt->optcode()) == 0 && opt->optcode() > 127) 898 895 { … … 903 900 } 904 901 905 for ( optmap_t::const_iterator it = m_GlobalOptions.begin(); it != m_GlobalOptions.end(); ++it) {906 std::shared_ptr<DhcpOption> opt(it ->second);902 for (auto it: m_GlobalOptions) { 903 std::shared_ptr<DhcpOption> opt(it.second); 907 904 if (optmap.count(opt->optcode()) == 0 && opt->optcode() > 127) 908 905 { -
trunk/src/VBox/NetworkServices/Dhcpd/Db.h
r75614 r75617 51 51 Binding(const Binding &); 52 52 53 explicit Binding(RTNETADDRIPV4 addr Param)54 : m_addr(addr Param), m_state(FREE),53 explicit Binding(RTNETADDRIPV4 addr) 54 : m_addr(addr), m_state(FREE), 55 55 m_issued(), m_secLease() {} 56 56 57 Binding(RTNETADDRIPV4 addr Param, const ClientId &idParam)58 : m_addr(addr Param), m_state(FREE), m_id(idParam),57 Binding(RTNETADDRIPV4 addr, const ClientId &id) 58 : m_addr(addr), m_state(FREE), m_id(id), 59 59 m_issued(), m_secLease() {} 60 60 … … 70 70 TimeStamp issued() const { return m_issued; } 71 71 72 Binding &setState(State state Param)72 Binding &setState(State state) 73 73 { 74 m_state = state Param;74 m_state = state; 75 75 return *this; 76 76 } … … 85 85 } 86 86 87 Binding &giveTo(const ClientId &id Param)87 Binding &giveTo(const ClientId &id) 88 88 { 89 m_id = id Param;89 m_id = id; 90 90 m_state = FREE; 91 91 return *this; -
trunk/src/VBox/NetworkServices/Dhcpd/Defs.h
r75614 r75617 24 24 25 25 #include <map> 26 #include <memory> 26 27 #include <vector> 27 28 #if __cplusplus >= 19971129 #include <memory>30 using std::shared_ptr;31 #else32 #include <tr1/memory>33 using std::tr1::shared_ptr;34 #endif35 36 #ifdef _MSC_VER37 # define __func__ __FUNCTION__38 #endif39 28 40 29 typedef std::vector<uint8_t> octets_t; … … 43 32 44 33 class DhcpOption; 45 typedef std::map<uint8_t, std::shared_ptr<DhcpOption> 34 typedef std::map<uint8_t, std::shared_ptr<DhcpOption>> optmap_t; 46 35 47 36 inline bool operator==(const RTMAC &l, const RTMAC &r) -
trunk/src/VBox/NetworkServices/Dhcpd/DhcpMessage.cpp
r75614 r75617 323 323 324 324 DhcpServerMessage::DhcpServerMessage(const DhcpClientMessage &req, 325 uint8_t messageType Param, RTNETADDRIPV4 serverAddr)325 uint8_t messageType, RTNETADDRIPV4 serverAddr) 326 326 : DhcpMessage(), 327 327 m_optServerId(serverAddr) … … 329 329 m_dst.u = 0xffffffff; /* broadcast */ 330 330 331 m_optMessageType = OptMessageType(messageType Param);331 m_optMessageType = OptMessageType(messageType); 332 332 333 333 /* copy values from the request (cf. RFC2131 Table 3) */ -
trunk/src/VBox/NetworkServices/Dhcpd/DhcpOptions.cpp
r75614 r75617 36 36 optmap_t &operator<<(optmap_t &optmap, const std::shared_ptr<DhcpOption> &option) 37 37 { 38 if ( !option)38 if (option == NULL) 39 39 return optmap; 40 40 -
trunk/src/VBox/NetworkServices/Dhcpd/DhcpOptions.h
r75614 r75617 342 342 static OptValue *parse(const char *pcszValue) 343 343 { 344 typename OptValueBase<T>::value_t v;344 value_t v; 345 345 int rc = DhcpOption::parse1(v, pcszValue); 346 346 if (RT_FAILURE(rc)) … … 544 544 static OptList *parse(const char *pcszValue) 545 545 { 546 typename OptListBase<T>::value_t v;546 value_t v; 547 547 int rc = DhcpOption::parseList(v, pcszValue); 548 548 if (RT_FAILURE(rc) || v.empty()) -
trunk/src/VBox/NetworkServices/Dhcpd/Makefile.kmk
r75614 r75617 29 29 ifdef VBOX_WITH_HARDENING 30 30 PROGRAMS += VBoxNetDhcpdHardened 31 DLLS += VBoxNetDhcpd 31 VBoxNetDhcpdHardened_TEMPLATE = VBOXR3HARDENEDEXE 32 VBoxNetDhcpdHardened_NAME = VBoxNetDhcpd 33 VBoxNetDhcpdHardened_DEFS = SERVICE_NAME=\"VBoxNetDhcpd\" 34 VBoxNetDhcpdHardened_SOURCES = VBoxNetDhcpdHardened.cpp 35 VBoxNetDhcpdHardened_SOURCES.win = $(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetDhcpd-icon.rc 36 VBoxNetDhcpdHardened_LDFLAGS.win = /SUBSYSTEM:windows 32 37 else 33 38 PROGRAMS += VBoxNetDhcpd 34 39 endif 35 40 36 VBoxNetDhcpdHardened_TEMPLATE = VBOXR3HARDENEDEXE 37 VBoxNetDhcpdHardened_NAME = VBoxNetDHCP 38 VBoxNetDhcpdHardened_DEFS = SERVICE_NAME=\"VBoxNetDhcpd\" 39 VBoxNetDhcpdHardened_SOURCES = VBoxNetDhcpdHardened.cpp 40 VBoxNetDhcpdHardened_SOURCES.win = $(VBoxNetDhcpd_0_OUTDIR)/VBoxNetDhcpd-icon.rc 41 VBoxNetDhcpdHardened_LDFLAGS.win = /SUBSYSTEM:windows 42 43 VBoxNetDhcpd_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBoxR3Dll,VBOXR3EXE) 44 VBoxNetDhcpd_NAME = VBoxNetDHCP 41 VBoxNetDhcpd_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBOXMAINDLL,VBOXMAINCLIENTEXE) 42 VBoxNetDhcpd_NAME := VBoxNetDhcpd 45 43 # VBoxNetDhcpd_DEFS = IPv6 46 # VBoxNet Dhcpd_DEFS.linux = WITH_VALGRIND47 #VBoxNetDhcpd_DEFS.win = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP44 # VBoxNetLwipNAT_DEFS.linux = WITH_VALGRIND 45 VBoxNetDhcpd_DEFS.win = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP 48 46 49 47 # (current dir is for for lwipopts.h) 50 48 VBoxNetDhcpd_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS)) 51 49 52 VBoxNetDhcpd_DEFS = KBUILD_TYPE=\"$(KBUILD_TYPE)\" 53 ifneq ($(KBUILD_TARGET),win) 54 VBoxNetDhcpd_DEFS += VBOX_WITH_XPCOM 55 VBoxNetDhcpd_INCS += $(VBOX_XPCOM_INCS) 56 # We want -std=c++11 for 4.7 and newer compilers, and -std=c++0x for older ones. 57 VBoxNetDhcpd_CXXFLAGS += -std=$(if $(VBOX_GCC_VERSION_CXX),$(if $(VBOX_GCC_VERSION_CXX) < 40700,c++0x,c++11),c++0x) 58 endif 59 VBoxNetDhcpd_SOURCES = ../../Main/glue/VBoxLogRelCreate.cpp \ 60 ../../Main/glue/GetVBoxUserHomeDirectory.cpp \ 61 ClientId.cpp \ 62 Config.cpp \ 63 DHCPD.cpp \ 64 Db.cpp \ 65 DhcpMessage.cpp \ 66 DhcpOptions.cpp \ 67 IPv4Pool.cpp \ 68 TimeStamp.cpp \ 69 VBoxNetDhcpd.cpp \ 70 $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) 50 VBoxNetDhcpd_SOURCES = 51 VBoxNetDhcpd_SOURCES += ClientId.cpp 52 VBoxNetDhcpd_SOURCES += Config.cpp 53 VBoxNetDhcpd_SOURCES += DHCPD.cpp 54 VBoxNetDhcpd_SOURCES += Db.cpp 55 VBoxNetDhcpd_SOURCES += DhcpMessage.cpp 56 VBoxNetDhcpd_SOURCES += DhcpOptions.cpp 57 VBoxNetDhcpd_SOURCES += IPv4Pool.cpp 58 VBoxNetDhcpd_SOURCES += TimeStamp.cpp 59 VBoxNetDhcpd_SOURCES += VBoxNetDhcpd.cpp 60 VBoxNetDhcpd_SOURCES += $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) 71 61 72 VBoxNet Dhcpd_LIBS = $(LIB_RUNTIME)62 VBoxNetLwipNAT_LIBS = $(LIB_RUNTIME) 73 63 74 VBoxNet Dhcpd_LIBS.solaris += socket nsl75 VBoxNet Dhcpd_LDFLAGS.win = /SUBSYSTEM:windows64 VBoxNetLwipNAT_LIBS.solaris += socket nsl 65 VBoxNetLwipNAT_LDFLAGS.win = /SUBSYSTEM:windows 76 66 77 67 ifeq ($(KBUILD_TARGET),win) -
trunk/src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp
r75614 r75617 448 448 i, cSegs, 449 449 &cbSegFrame); 450 ifInput(pvSegFrame, (uint32_t)cbFrame);450 ifInput(pvSegFrame, cbFrame); 451 451 } 452 452 } … … 738 738 739 739 unique_ptr_pbuf q ( pbuf_alloc(PBUF_RAW, (u16_t)data.size(), PBUF_RAM) ); 740 if ( !q)741 return; 742 743 error = pbuf_take(q.get(), &data.front(), (u16_t)data.size());740 if (q == NULL) 741 return; 742 743 error = pbuf_take(q.get(), &data.front(), data.size()); 744 744 if (error != ERR_OK) 745 745 return;
Note:
See TracChangeset
for help on using the changeset viewer.