Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
text_import.h File Reference
#include <stdio.h>
#include <wireshark.h>
#include <wiretap/wtap.h>

Go to the source code of this file.

Classes

struct  text_import_info_t
 

Enumerations

enum  offset_type { OFFSET_NONE = 0 , OFFSET_HEX , OFFSET_OCT , OFFSET_DEC }
 
enum  data_encoding { ENCODING_PLAIN_HEX , ENCODING_PLAIN_OCT , ENCODING_PLAIN_BIN , ENCODING_BASE64 }
 
enum  dummy_header_type {
  HEADER_NONE , HEADER_ETH , HEADER_IPV4 , HEADER_UDP ,
  HEADER_TCP , HEADER_SCTP , HEADER_SCTP_DATA , HEADER_EXPORT_PDU
}
 
enum  text_import_mode { TEXT_IMPORT_HEXDUMP , TEXT_IMPORT_REGEX }
 

Functions

int text_import (text_import_info_t *const info)
 Import a text file.
 
int text_import_pre_open (wtap_dump_params *const params, int file_type_subtype, const char *const input_filename, const char *const interface_name)
 Prepares the wtap_dump_params with necessary headers before opening the wtap dump file.
 

Detailed Description

text_import.h State machine for text import November 2010, Jaap Keuter jaap..nosp@m.keut.nosp@m.er@xs.nosp@m.4all.nosp@m..nl Modified February 2021, Paul Weiß

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

Based on text2pcap.h by Ashok Narayanan ashok.nosp@m.n@ci.nosp@m.sco.c.nosp@m.om

SPDX-License-Identifier: GPL-2.0-or-later*

Function Documentation

◆ text_import()

int text_import ( text_import_info_t *const  info)

Import a text file.

This function imports a text file and writes the SHB and IDB to the wtap_dump_params before opening the wtap dump file. It initializes various parameters for packet processing, including timestamps and direction.

Parameters
infoPointer to the text import information structure.
Returns
Return status of the import operation.

◆ text_import_pre_open()

int text_import_pre_open ( wtap_dump_params *const  params,
int  file_type_subtype,
const char *const  input_filename,
const char *const  interface_name 
)

Prepares the wtap_dump_params with necessary headers before opening the wtap dump file.

Write the SHB and IDB to the wtap_dump_params before opening the wtap dump file. While dummy headers can be written automatically, this writes out some extra information including an optional interface name.

NOTE: The caller will be responsible for freeing params->idb_inf after finished with the wtap_dumper to avoid a memory leak. wtap_dump_close does not free it.

Parameters
paramsPointer to the wtap_dump_params structure.
file_type_subtypeThe type of the file to be opened.
input_filenameThe name of the input file.
interface_nameThe name of the interface.
Returns
Return status of the preparation operation.