Changeset 97077 in vbox for trunk/src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp
- Timestamp:
- Oct 10, 2022 6:37:12 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp
r97074 r97077 135 135 const RTCString &strTrunk = RTCString(), 136 136 INTNETTRUNKTYPE enmTrunkType = kIntNetTrunkType_WhateverNone); 137 int ifOpen(const RTCString &strNetwork,138 const RTCString &strTrunk,139 INTNETTRUNKTYPE enmTrunkType);140 int ifGetBuf();141 int ifActivate();142 137 143 138 int ifProcessInput(); 144 int ifFlush();145 146 int ifClose();147 139 148 140 void ifPump(); … … 182 174 VBoxNetDhcpd::~VBoxNetDhcpd() 183 175 { 184 ifClose(); 176 if (m_hIf != NULL) 177 { 178 int rc = IntNetR3IfCtxDestroy(m_hIf); 179 AssertRC(rc); 180 m_hIf = NULL; 181 } 185 182 } 186 183 … … 227 224 INTNETTRUNKTYPE enmTrunkType) 228 225 { 229 int rc;230 231 rc = ifOpen(strNetwork, strTrunk, enmTrunkType);232 if (RT_FAILURE(rc))233 return rc;234 235 rc = ifGetBuf();236 if (RT_FAILURE(rc))237 return rc;238 239 rc = ifActivate();240 if (RT_FAILURE(rc))241 return rc;242 243 return VINF_SUCCESS;244 }245 246 247 int VBoxNetDhcpd::ifOpen(const RTCString &strNetwork,248 const RTCString &strTrunk,249 INTNETTRUNKTYPE enmTrunkType)250 {251 AssertReturn(m_hIf == NULL, VERR_GENERAL_FAILURE);252 253 226 if (enmTrunkType == kIntNetTrunkType_Invalid) 254 227 enmTrunkType = kIntNetTrunkType_WhateverNone; 255 228 256 return IntNetR3IfCtxCreate(&m_hIf, strNetwork.c_str(), enmTrunkType, 257 strTrunk.c_str(), _128K /*cbSend*/, _256K /*cbRecv*/, 258 0 /*fFlags*/); 259 } 260 261 262 int VBoxNetDhcpd::ifGetBuf() 263 { 264 AssertReturn(m_hIf != NULL, VERR_GENERAL_FAILURE); 265 AssertReturn(m_pIfBuf == NULL, VERR_GENERAL_FAILURE); 266 267 return IntNetR3IfCtxQueryBufferPtr(m_hIf, &m_pIfBuf); 268 } 269 270 271 int VBoxNetDhcpd::ifActivate() 272 { 273 AssertReturn(m_hIf != NULL, VERR_GENERAL_FAILURE); 274 AssertReturn(m_pIfBuf != NULL, VERR_GENERAL_FAILURE); 275 276 return IntNetR3IfCtxSetActive(m_hIf, true /*fActive*/); 229 int rc = IntNetR3IfCtxCreate(&m_hIf, strNetwork.c_str(), enmTrunkType, 230 strTrunk.c_str(), _128K /*cbSend*/, _256K /*cbRecv*/, 231 0 /*fFlags*/); 232 if (RT_SUCCESS(rc)) 233 { 234 rc = IntNetR3IfCtxQueryBufferPtr(m_hIf, &m_pIfBuf); 235 if (RT_SUCCESS(rc)) 236 rc = IntNetR3IfCtxSetActive(m_hIf, true /*fActive*/); 237 } 238 239 return rc; 277 240 } 278 241 … … 422 385 IntNetRingCommitFrameEx(&m_pIfBuf->Send, pHdr, cbFrame); 423 386 424 ifFlush();387 IntNetR3IfSend(m_hIf); 425 388 return ERR_OK; 426 }427 428 429 int VBoxNetDhcpd::ifFlush()430 {431 return IntNetR3IfSend(m_hIf);432 }433 434 435 int VBoxNetDhcpd::ifClose()436 {437 if (m_hIf == NULL)438 return VINF_SUCCESS;439 440 int rc = IntNetR3IfCtxDestroy(m_hIf);441 m_hIf = NULL;442 return rc;443 389 } 444 390
Note:
See TracChangeset
for help on using the changeset viewer.