~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Network/Pcap.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-07-04 13:02:31 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110704130231-l843es6wqhx614n7
Tags: 4.0.10-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Add the Modaliases control field manually for maximum backportability.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 */
5
5
 
6
6
/*
7
 
 * Copyright (C) 2006-2008 Oracle Corporation
 
7
 * Copyright (C) 2006-2011 Oracle Corporation
8
8
 *
9
9
 * This file is part of VirtualBox Open Source Edition (OSE), as
10
10
 * available from http://www.virtualbox.org. This file is free software;
58
58
{
59
59
    uint32_t            u32Magic;
60
60
    struct pcap_hdr     pcap;
61
 
    struct pcaprec_hdr  rec0;
62
61
};
63
62
 
64
63
 
69
68
{
70
69
    PCAP_MAGIC,
71
70
    { 2, 4, 0, 0, 0xffff, 1 },
72
 
    /* force ethereal to start at 0.000000. */
73
 
    { 0, 1, 0, 60 }
74
 
 
75
71
};
76
72
 
 
73
static const char s_szDummyData[] = { 0, 0, 0, 0 };
77
74
 
78
75
/**
79
76
 * Internal helper.
108
105
 */
109
106
int PcapStreamHdr(PRTSTREAM pStream, uint64_t StartNanoTS)
110
107
{
111
 
    pcaprec_hdr_init Hdr = s_Hdr;
112
 
    pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0);
113
 
    return RTStrmWrite(pStream, &Hdr, sizeof(Hdr));
 
108
    int rc1 = RTStrmWrite(pStream, &s_Hdr, sizeof(s_Hdr));
 
109
    int rc2 = PcapStreamFrame(pStream, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData));
 
110
    return RT_SUCCESS(rc1) ? rc2 : rc1;
114
111
}
115
112
 
116
113
 
188
185
 */
189
186
int PcapFileHdr(RTFILE File, uint64_t StartNanoTS)
190
187
{
191
 
    pcaprec_hdr_init Hdr = s_Hdr;
192
 
    pcapCalcHeader(&Hdr.rec0, StartNanoTS, 60, 0);
193
 
    return RTFileWrite(File, &Hdr, sizeof(Hdr), NULL);
 
188
    int rc1 = RTFileWrite(File, &s_Hdr, sizeof(s_Hdr), NULL);
 
189
    int rc2 = PcapFileFrame(File, StartNanoTS, s_szDummyData, 60, sizeof(s_szDummyData));
 
190
    return RT_SUCCESS(rc1) ? rc2 : rc1;
194
191
}
195
192
 
196
193