|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <wsutil/file_compressed.h>Go to the source code of this file.
Functions | |
| bool | libpcap_write_file_header (ws_cwstream *pfile, int linktype, int snaplen, bool ts_nsecs, uint64_t *bytes_written, int *err) |
| Writes a pcap file header to the specified output stream. | |
| bool | libpcap_write_packet (ws_cwstream *pfile, time_t sec, uint32_t usec, uint32_t caplen, uint32_t len, const uint8_t *pd, uint64_t *bytes_written, int *err) |
| Writes a packet to a pcap file. | |
| bool | pcapng_write_block (ws_cwstream *pfile, const uint8_t *data, uint32_t block_total_length, uint64_t *bytes_written, int *err) |
| Write a pre-formatted pcapng block to the output stream. | |
| bool | pcapng_write_section_header_block (ws_cwstream *pfile, GPtrArray *comments, const char *hw, const char *os, const char *appname, uint64_t section_length, uint64_t *bytes_written, int *err) |
| Write a section header block (SHB) | |
| bool | pcapng_write_interface_description_block (ws_cwstream *pfile, const char *comment, const char *name, const char *descr, const char *filter, const char *os, const char *hardware, int link_type, int snap_len, uint64_t *bytes_written, uint64_t if_speed, uint8_t tsresol, int *err) |
| Writes an Interface Description Block (IDB) to a pcapng file. | |
| bool | pcapng_write_interface_statistics_block (ws_cwstream *pfile, uint32_t interface_id, uint64_t *bytes_written, const char *comment, uint64_t isb_starttime, uint64_t isb_endtime, uint64_t isb_ifrecv, uint64_t isb_ifdrop, int *err) |
| Writes an Interface Statistics Block to a pcapng file. | |
| bool | pcapng_write_enhanced_packet_block (ws_cwstream *pfile, const char *comment, time_t sec, uint32_t usec, uint32_t caplen, uint32_t len, uint32_t interface_id, unsigned ts_mul, const uint8_t *pd, uint32_t flags, uint64_t *bytes_written, int *err) |
| Writes an Enhanced Packet Block (EPB) to a pcapng file. | |
Declarations of our own routines for writing pcap and pcapng files.
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
Derived from code in the Wiretap Library Copyright (c) 1998 by Gilbert Ramirez gram@.nosp@m.alum.nosp@m.ni.ri.nosp@m.ce.e.nosp@m.du
SPDX-License-Identifier: GPL-2.0-or-later
|
extern |
Writes a pcap file header to the specified output stream.
Write the file header to a dump file. Returns true on success, false on failure. Sets "*err" to an error code, or 0 for a short write, on failure
| pfile | The output stream to which the header will be written. |
| linktype | The data link type of the packets that will be captured. |
| snaplen | The snapshot length for each packet. |
| ts_nsecs | Indicates whether the timestamp should have nanosecond resolution. |
| bytes_written | Pointer to a variable where the number of bytes written will be stored. |
| err | Pointer to an integer where any error code will be stored. |
|
extern |
Writes a packet to a pcap file.
Write a record for a packet to a dump file. Returns true on success, false on failure
| pfile | The output stream for the pcap file. |
| sec | The timestamp seconds of the packet. |
| usec | The timestamp microseconds of the packet. |
| caplen | The captured length of the packet. |
| len | The original length of the packet. |
| pd | The data of the packet. |
| bytes_written | Pointer to store the number of bytes written. |
| err | Pointer to store any error code. |
|
extern |
Write a pre-formatted pcapng block to the output stream.
Checks if the data and length are aligned to 4 bytes, and if the block_total_length field is consistent at both ends of the block.
| pfile | The output stream to write the block to. |
| data | The data to be written as a pcapng block. |
| block_total_length | The length of the data. |
| bytes_written | Pointer to store the number of bytes written. |
| err | Pointer to store any error encountered during writing. |
|
extern |
Writes an Enhanced Packet Block (EPB) to a pcapng file.
| pfile | Pointer to the write context. |
| comment | Optional comment for the packet. |
| sec | Seconds part of the timestamp. |
| usec | Microseconds part of the timestamp. |
| caplen | Length of the captured data. |
| len | Total length of the packet. |
| interface_id | ID of the network interface on which the packet was received. |
| ts_mul | Timestamp multiplier. |
| pd | Pointer to the captured data. |
| flags | Flags for the packet. |
| bytes_written | Pointer to store the number of bytes written. |
|
extern |
Writes an Interface Description Block (IDB) to a pcapng file.
This function writes an IDB to the specified pcapng file stream, containing information about the network interface.
| pfile | The pcapng file stream to write to. |
| comment | A comment string for the IDB (optional). |
| name | The name of the network interface. |
| descr | A description of the network interface. |
| filter | A display filter for the interface. |
| os | The operating system on which the interface is running. |
| hardware | The hardware description of the interface. |
| link_type | The link type of the interface (e.g., Ethernet, Wi-Fi). |
| snap_len | The snapshot length for packet capture. |
|
extern |
Writes an Interface Statistics Block to a pcapng file.
| pfile | The write context for the pcapng file. |
| interface_id | The ID of the network interface. |
| bytes_written | Pointer to store the number of bytes written. |
| comment | Optional comment string (OPT_COMMENT). |
| isb_starttime | Start time of the statistics block in 100-nanosecond intervals since January 1, 1601 (ISB_STARTTIME). |
| isb_endtime | End time of the statistics block in 100-nanosecond intervals since January 1, 1601 (ISB_ENDTIME). |
| isb_ifrecv | Number of packets received by the interface (ISB_IFRECV). |
| isb_ifdrop | Number of packets dropped by the interface (ISB_IFDROP). |
| err | Pointer to store any error code. |
|
extern |
Write a section header block (SHB)
| pfile | Write information |
| comments | Comments on the section, Option 1 opt_comment UTF-8 strings containing comments that areassociated to the current block. |
| hw | HW, Option 2 shb_hardware An UTF-8 string containing the description of the hardware used to create this section. |
| os | Operating system name, Option 3 shb_os An UTF-8 string containing the name of the operating system used to create this section. |
| appname | Application name, Option 4 shb_userappl An UTF-8 string containing the name of the application used to create this section. |
| section_length | Length of section |
| bytes_written | Number of written bytes |
| err | Error type |