Changeset 28153 in vbox for trunk/include/VBox
- Timestamp:
- Apr 9, 2010 5:58:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmnetinline.h
r28096 r28153 4 4 * 5 5 * This is all inlined because it's too tedious to create 2-3 libraries to 6 * contain it all (same bad excuse as for intnetinline.h). C++ only because of 7 * mixed code and variables. 6 * contain it all (same bad excuse as for intnetinline.h). 8 7 */ 9 8 … … 48 47 DECLINLINE(bool) PDMNetGsoIsValid(PCPDMNETWORKGSO pGso, size_t cbGsoMax, size_t cbFrame) 49 48 { 49 PDMNETWORKGSOTYPE enmType; 50 50 51 if (RT_UNLIKELY(cbGsoMax < sizeof(*pGso))) 51 52 return false; 52 53 53 PDMNETWORKGSOTYPE constenmType = (PDMNETWORKGSOTYPE)pGso->u8Type;54 enmType = (PDMNETWORKGSOTYPE)pGso->u8Type; 54 55 if (RT_UNLIKELY( enmType <= PDMNETWORKGSOTYPE_INVALID || enmType >= PDMNETWORKGSOTYPE_END )) 55 56 return false; … … 127 128 DECLINLINE(uint32_t) PDMNetGsoCalcSegmentCount(PCPDMNETWORKGSO pGso, size_t cbFrame) 128 129 { 130 size_t cbPayload; 129 131 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame)); 130 size_tcbPayload = cbFrame - pGso->cbHdrs;132 cbPayload = cbFrame - pGso->cbHdrs; 131 133 return (uint32_t)((cbPayload + pGso->cbMaxSeg - 1) / pGso->cbMaxSeg); 132 134 } … … 266 268 { 267 269 /* 268 * Check assumptions.269 */270 Assert(iSeg < cSegs);271 Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));272 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));273 274 /*275 270 * Figure out where the payload is and where the header starts before we 276 271 * do the protocol specific carving. … … 284 279 285 280 /* 281 * Check assumptions (doing it after declaring the variables because of C). 282 */ 283 Assert(iSeg < cSegs); 284 Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame)); 285 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame)); 286 287 /* 286 288 * Copy the header and do the protocol specific massaging of it. 287 289 */ … … 332 334 } 333 335 334 *pcbSegFrame = cbSeg Payload + pGso->cbHdrs;336 *pcbSegFrame = cbSegFrame; 335 337 return pbSegHdrs; 336 338 } … … 364 366 { 365 367 /* 366 * Check assumptions.367 */368 Assert(iSeg < cSegs);369 Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));370 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));371 372 /*373 368 * Figure out where the payload is and where the header starts before we 374 369 * do the protocol specific carving. … … 378 373 ? pGso->cbMaxSeg 379 374 : (uint32_t)(cbFrame - iSeg * pGso->cbMaxSeg - pGso->cbHdrs); 375 376 /* 377 * Check assumptions (doing it after declaring the variables because of C). 378 */ 379 Assert(iSeg < cSegs); 380 Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame)); 381 Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame)); 380 382 381 383 /*
Note:
See TracChangeset
for help on using the changeset viewer.