VirtualBox

Changeset 28072 in vbox


Ignore:
Timestamp:
Apr 7, 2010 11:22:31 PM (15 years ago)
Author:
vboxsync
Message:

pcap.cpp: let all the GSO segment frame use the same timestamp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/Pcap.cpp

    r28025 r28072  
    9494
    9595/**
     96 * Internal helper.
     97 */
     98static 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/**
    96106 * Writes the stream header.
    97107 *
     
    146156                       const void *pvFrame, size_t cbFrame, size_t cbSegMax)
    147157{
     158    struct pcaprec_hdr Hdr;
     159    pcapCalcHeader(&Hdr, StartNanoTS, 0, 0);
     160
    148161    uint8_t const  *pbFrame = (uint8_t const *)pvFrame;
    149162    uint8_t         abHdrs[256];
     
    154167        uint32_t offSegPayload = PDMNetGsoCarveSegment(pGso, pbFrame, cbFrame, iSeg, cSegs, abHdrs, &cbSegPayload);
    155168
    156         struct pcaprec_hdr Hdr;
    157         pcapCalcHeader(&Hdr, StartNanoTS, pGso->cbHdrs + cbSegPayload, cbSegMax);
     169        pcapUpdateHeader(&Hdr, pGso->cbHdrs + cbSegPayload, cbSegMax);
    158170        int rc = RTStrmWrite(pStream, &Hdr, sizeof(Hdr));
    159171        if (RT_FAILURE(rc))
     
    224236                     const void *pvFrame, size_t cbFrame, size_t cbSegMax)
    225237{
     238    struct pcaprec_hdr Hdr;
     239    pcapCalcHeader(&Hdr, StartNanoTS, 0, 0);
     240
    226241    uint8_t const  *pbFrame = (uint8_t const *)pvFrame;
    227242    uint8_t         abHdrs[256];
     
    232247        uint32_t offSegPayload = PDMNetGsoCarveSegment(pGso, pbFrame, cbFrame, iSeg, cSegs, abHdrs, &cbSegPayload);
    233248
    234         struct pcaprec_hdr Hdr;
    235         pcapCalcHeader(&Hdr, StartNanoTS, pGso->cbHdrs + cbSegPayload, cbSegMax);
     249        pcapUpdateHeader(&Hdr, pGso->cbHdrs + cbSegPayload, cbSegMax);
    236250        int rc = RTFileWrite(File, &Hdr, sizeof(Hdr), NULL);
    237251        if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette