Changeset 54351 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 21, 2015 1:27:45 AM (10 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DHCPServerImpl.h
r54347 r54351 91 91 92 92 private: 93 HRESULT encodeOption(com::Utf8Str &aEncoded, 94 uint32_t aOptCode, const DhcpOptValue &aOptValue); 93 95 94 96 // wrapped IDHCPServer properties -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r54347 r54351 269 269 270 270 271 HRESULT DHCPServer::encodeOption(com::Utf8Str &aEncoded, 272 uint32_t aOptCode, const DhcpOptValue &aOptValue) 273 { 274 switch (aOptValue.encoding) 275 { 276 case DhcpOptValue::LEGACY: 277 { 278 /* 279 * This is original encoding which assumed that for each 280 * option we know its format and so we know how option 281 * "value" text is to be interpreted. 282 * 283 * "2:10800" # integer 32 284 * "6:1.2.3.4 8.8.8.8" # array of ip-address 285 */ 286 aEncoded = Utf8StrFmt("%d:%s", aOptCode, aOptValue.text.c_str()); 287 break; 288 } 289 290 case DhcpOptValue::HEX: 291 { 292 /* 293 * This is a bypass for any option - preformatted value as 294 * hex string with no semantic involved in formatting the 295 * value for the DHCP reply. 296 * 297 * 234=68:65:6c:6c:6f:2c:20:77:6f:72:6c:64 298 */ 299 aEncoded = Utf8StrFmt("%d=%s", aOptCode, aOptValue.text.c_str()); 300 break; 301 } 302 303 default: 304 { 305 /* 306 * Try to be forward compatible. 307 * 308 * "254@42=i hope you know what this means" 309 */ 310 aEncoded = Utf8StrFmt("%d@%d=%s", aOptCode, (int)aOptValue.encoding, 311 aOptValue.text.c_str()); 312 break; 313 } 314 } 315 316 return S_OK; 317 } 318 319 271 320 HRESULT DHCPServer::addGlobalOption(DhcpOpt_T aOption, const com::Utf8Str &aValue) 272 321 { … … 297 346 const DhcpOptValue &OptValue = (*it).second; 298 347 299 // XXX: TODO: factor out and share with getVmSlotOptions() 300 if (OptValue.encoding == DhcpOptValue::LEGACY) 301 aValues[i] = Utf8StrFmt("%d:%s", OptCode, OptValue.text.c_str()); 348 encodeOption(aValues[i], OptCode, OptValue); 302 349 } 303 350 … … 364 411 const DhcpOptValue &OptValue = (*it).second; 365 412 366 // XXX: TODO: factor out and share with getGlobalOptions() 367 if (OptValue.encoding == DhcpOptValue::LEGACY) 368 aValues[i] = com::Utf8StrFmt("%d:%s", OptCode, OptValue.text.c_str()); 413 encodeOption(aValues[i], OptCode, OptValue); 369 414 } 370 415
Note:
See TracChangeset
for help on using the changeset viewer.