qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] move pcap structs to header file
Date: Thu, 27 Nov 2025 06:44:11 +0100	[thread overview]
Message-ID: <9317b74f-ecf5-4e81-9f5d-a75c926fc144@linaro.org> (raw)
In-Reply-To: <20251126142559.4081483-2-kraxel@redhat.com>

On 26/11/25 15:25, Gerd Hoffmann wrote:
> Allow reusing them elsewhere in qemu.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   include/qemu/pcap.h | 27 +++++++++++++++++++++++++++
>   hw/usb/pcap.c       | 24 +-----------------------
>   2 files changed, 28 insertions(+), 23 deletions(-)
>   create mode 100644 include/qemu/pcap.h
> 
> diff --git a/include/qemu/pcap.h b/include/qemu/pcap.h
> new file mode 100644
> index 000000000000..48e6070ffe04
> --- /dev/null
> +++ b/include/qemu/pcap.h
> @@ -0,0 +1,27 @@
> +#ifndef QEMU_PCAP_H
> +#define QEMU_PCAP_H

Missing SPDX license identifier.

> +
> +#define PCAP_MAGIC                   0xa1b2c3d4
> +#define PCAP_MAJOR                   2
> +#define PCAP_MINOR                   4
> +
> +/* https://wiki.wireshark.org/Development/LibpcapFileFormat */
> +
> +struct pcap_hdr {
> +    uint32_t magic_number;   /* magic number */
> +    uint16_t version_major;  /* major version number */
> +    uint16_t version_minor;  /* minor version number */
> +    int32_t  thiszone;       /* GMT to local correction */
> +    uint32_t sigfigs;        /* accuracy of timestamps */
> +    uint32_t snaplen;        /* max length of captured packets, in octets */
> +    uint32_t network;        /* data link type */
> +};
> +
> +struct pcaprec_hdr {
> +    uint32_t ts_sec;         /* timestamp seconds */
> +    uint32_t ts_usec;        /* timestamp microseconds */
> +    uint32_t incl_len;       /* number of octets of packet saved in file */
> +    uint32_t orig_len;       /* actual length of packet */
> +};

Maybe good opportunity to add QEMU_PACKED?

Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2025-11-27  5:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 14:25 [PATCH 0/2] hw/uefi: add pcap support Gerd Hoffmann
2025-11-26 14:25 ` [PATCH 1/2] move pcap structs to header file Gerd Hoffmann
2025-11-27  5:44   ` Philippe Mathieu-Daudé [this message]
2025-11-26 14:25 ` [PATCH 2/2] hw/uefi: add pcap support Gerd Hoffmann
2025-11-27  5:48   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9317b74f-ecf5-4e81-9f5d-a75c926fc144@linaro.org \
    --to=philmd@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).