Changeset 28072 in vbox
- Timestamp:
- Apr 7, 2010 11:22:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/Pcap.cpp
r28025 r28072 94 94 95 95 /** 96 * Internal helper. 97 */ 98 static void pcapUpdateHeader(struct pcaprec_hdr *pHdr, size_t cbFrame, size_t cbMax) 99 { 100 pHdr->incl_len = (uint32_t)RT_MIN(cbFrame, cbMax); 101 pHdr->orig_len = (uint32_t)cbFrame; 102 } 103 104 105 /** 96 106 * Writes the stream header. 97 107 * … … 146 156 const void *pvFrame, size_t cbFrame, size_t cbSegMax) 147 157 { 158 struct pcaprec_hdr Hdr; 159 pcapCalcHeader(&Hdr, StartNanoTS, 0, 0); 160 148 161 uint8_t const *pbFrame = (uint8_t const *)pvFrame; 149 162 uint8_t abHdrs[256]; … … 154 167 uint32_t offSegPayload = PDMNetGsoCarveSegment(pGso, pbFrame, cbFrame, iSeg, cSegs, abHdrs, &cbSegPayload); 155 168 156 struct pcaprec_hdr Hdr; 157 pcapCalcHeader(&Hdr, StartNanoTS, pGso->cbHdrs + cbSegPayload, cbSegMax); 169 pcapUpdateHeader(&Hdr, pGso->cbHdrs + cbSegPayload, cbSegMax); 158 170 int rc = RTStrmWrite(pStream, &Hdr, sizeof(Hdr)); 159 171 if (RT_FAILURE(rc)) … … 224 236 const void *pvFrame, size_t cbFrame, size_t cbSegMax) 225 237 { 238 struct pcaprec_hdr Hdr; 239 pcapCalcHeader(&Hdr, StartNanoTS, 0, 0); 240 226 241 uint8_t const *pbFrame = (uint8_t const *)pvFrame; 227 242 uint8_t abHdrs[256]; … … 232 247 uint32_t offSegPayload = PDMNetGsoCarveSegment(pGso, pbFrame, cbFrame, iSeg, cSegs, abHdrs, &cbSegPayload); 233 248 234 struct pcaprec_hdr Hdr; 235 pcapCalcHeader(&Hdr, StartNanoTS, pGso->cbHdrs + cbSegPayload, cbSegMax); 249 pcapUpdateHeader(&Hdr, pGso->cbHdrs + cbSegPayload, cbSegMax); 236 250 int rc = RTFileWrite(File, &Hdr, sizeof(Hdr), NULL); 237 251 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.