Wireshark
4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ui
text_import.h
Go to the documentation of this file.
1
18
#ifndef __TEXT_IMPORT_H__
19
#define __TEXT_IMPORT_H__
20
21
#include <stdio.h>
22
#include <wireshark.h>
23
24
#include <
wiretap/wtap.h
>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
/* __cplusplus */
29
30
/* The parameter interface */
31
32
enum
offset_type
33
{
34
OFFSET_NONE = 0,
35
OFFSET_HEX,
36
OFFSET_OCT,
37
OFFSET_DEC
38
};
39
40
enum
data_encoding {
41
ENCODING_PLAIN_HEX,
42
ENCODING_PLAIN_OCT,
43
ENCODING_PLAIN_BIN,
44
ENCODING_BASE64
45
};
46
47
enum
dummy_header_type
48
{
49
HEADER_NONE,
50
HEADER_ETH,
51
HEADER_IPV4,
52
HEADER_UDP,
53
HEADER_TCP,
54
HEADER_SCTP,
55
HEADER_SCTP_DATA,
56
HEADER_EXPORT_PDU
57
};
58
59
enum
text_import_mode {
60
TEXT_IMPORT_HEXDUMP,
61
TEXT_IMPORT_REGEX
62
};
63
64
typedef
struct
65
{
66
/* Input info */
67
// TODO: add const, as this way string constants can't be used
68
// BUT: the other way clang-check complains when you free them
69
/* const */
char
*import_text_filename;
70
char
*output_filename;
71
enum
text_import_mode mode;
72
73
struct
{
74
FILE *import_text_FILE;
75
enum
offset_type offset_type;
76
bool
has_direction;
77
bool
identify_ascii;
78
bool
little_endian;
79
} hexdump;
80
struct
{
81
GMappedFile* import_text_GMappedFile;
82
/* const */
GRegex* format;
83
enum
data_encoding encoding;
84
/* const */
char
* in_indication;
85
/* const */
char
* out_indication;
86
} regex;
87
const
char
* timestamp_format;
88
89
/* Import info */
90
/* Wiretap encapsulation type; see wiretap/wtap.h for details */
91
unsigned
encapsulation;
92
wtap_dumper
* wdh;
93
94
/* Dummy header info (if encapsulation == 1) */
95
enum
dummy_header_type dummy_header_type;
96
unsigned
pid;
97
bool
ipv6;
98
union
{
99
ws_in4_addr
ipv4;
100
ws_in6_addr
ipv6;
101
} ip_src_addr;
102
union
{
103
ws_in4_addr
ipv4;
104
ws_in6_addr
ipv6;
105
} ip_dest_addr;
106
unsigned
protocol;
107
unsigned
src_port;
108
unsigned
dst_port;
109
unsigned
tag;
110
unsigned
ppi;
111
/* const */
char
* payload;
112
113
unsigned
max_frame_length;
114
115
/* Output info */
116
unsigned
num_packets_read;
117
unsigned
num_packets_written;
118
}
text_import_info_t
;
119
120
int
text_import(
text_import_info_t
*
const
info
);
121
122
/* Write the SHB and IDB to the wtap_dump_params before opening the wtap dump
123
* file. While dummy headers can be written automatically, this writes out
124
* some extra information including an optional interface name.
125
*
126
* NOTE: The caller will be responsible for freeing params->idb_inf after
127
* finished with the wtap_dumper to avoid a memory leak. wtap_dump_close
128
* does not free it.
129
*/
130
int
131
text_import_pre_open(
wtap_dump_params
*
const
params,
int
file_type_subtype,
const
char
*
const
input_filename,
const
char
*
const
interface_name);
132
133
#ifdef __cplusplus
134
}
135
#endif
/* __cplusplus */
136
137
#endif
/* __TEXT_IMPORT_H__ */
ws_in4_addr
uint32_t ws_in4_addr
Definition
inet_addr.h:22
e_in6_addr
Definition
inet_addr.h:27
info
Definition
file-pcapng.h:57
text_import_info_t
Definition
text_import.h:65
wtap_dump_params
Definition
wtap.h:1544
wtap_dumper
Definition
wtap-int.h:97
wtap.h
Generated by
1.9.8