Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-http.h
1/* packet-http.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <[email protected]>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#ifndef __PACKET_HTTP_H__
11#define __PACKET_HTTP_H__
12
13#include <epan/packet.h>
14#include "ws_symbol_export.h"
15
16extern const value_string vals_http_status_code[];
17
18WS_DLL_PUBLIC
19void http_tcp_dissector_add(uint32_t port, dissector_handle_t handle);
20WS_DLL_PUBLIC
21void http_tcp_dissector_delete(uint32_t port);
22WS_DLL_PUBLIC
23void http_tcp_port_add(uint32_t port);
24
25WS_DLL_PUBLIC
26void http_add_path_components_to_tree(tvbuff_t* tvb, packet_info* pinfo _U_, proto_item* item, int offset, int length);
27
28WS_DLL_PUBLIC
29dissector_handle_t http_upgrade_dissector(const char *protocol);
30
31/* Used for HTTP statistics */
32typedef struct _http_info_value_t {
33 uint32_t framenum;
34 char *request_method;
35 unsigned response_code;
36 char *http_host;
37 const char *request_uri;
38 const char *referer_uri;
39 const char *full_uri;
40 const char *location_base_uri;
41 const char *location_target;
43
44#define HTTP_PROTO_DATA_REQRES 0
45#define HTTP_PROTO_DATA_INFO 1
46
48typedef struct _http_req_res_t {
50 uint32_t number;
52 uint32_t req_framenum;
54 uint32_t res_framenum;
57 unsigned response_code;
58 char *request_method;
59 char *http_host;
60 char *request_uri;
61 char *full_uri;
62 bool req_has_range;
63 bool resp_has_range;
64
68
70typedef struct _http_upgrade_info_t {
72 uint16_t server_port;
74 uint8_t http_version;
76 const char *(*get_header_value)(packet_info *, const char *, bool);
80
82typedef struct _http_conv_t {
83
84 /* Used to speed up desegmenting of chunked Transfer-Encoding. */
85 wmem_map_t *chunk_offsets_fwd;
86 wmem_map_t *chunk_offsets_rev;
87
88 /* Fields related to proxied/tunneled/Upgraded connections. */
89 uint32_t startframe; /* First frame of proxied connection */
90 int startoffset; /* Offset within the frame where the new protocol begins. */
91 dissector_handle_t next_handle; /* New protocol */
92 http_upgrade_info_t *upgrade_info; /* Data for new protocol */
93
94 /* Server address and port, known after first server response */
95 uint16_t server_port;
96 address server_addr;
105 /* true means current message is chunked streaming, and not ended yet.
106 * This is only meaningful during the first scan.
107 */
109
110 /* Used for req/res matching */
111 GSList *req_list;
112 wmem_map_t *matches_table;
113
115
116/* Used for HTTP Export Object feature */
117typedef struct _http_eo_t {
118 char *hostname;
119 char *filename;
120 char *content_type;
121 tvbuff_t *payload;
122} http_eo_t;
123
124/* Resolves a URI reference that might be relative to a given base URI and
125 * returns a string. Roughly similar to the algorithm in RFC 3986 5.2 but
126 * not entirely accurate to it (sacrificing some accuracy for simplicity.)
127 *
128 * @param scope wmem allocator scope for the returned string
129 * @param base_url base URI
130 * @param location_url a URI reference that might be relative to base_url
131 * (or might be an absolute URI)
132 * @return A string allocated in scope that represents a target URI after
133 * resolving location_url, using base_url as the possible base URI
134 */
135extern char *
136determine_http_location_target(wmem_allocator_t *scope, const char *base_url, const char * location_url);
137
138#endif /* __PACKET_HTTP_H__ */
Definition address.h:58
Definition packet-http.h:82
http_req_res_t * req_res_tail
Definition packet-http.h:98
bool message_ended
Definition packet-http.h:108
Definition packet-http.h:117
Definition packet-http.h:32
Definition packet-http.h:48
nstime_t req_ts
Definition packet-http.h:56
uint32_t number
Definition packet-http.h:50
void * private_data
Definition packet-http.h:66
uint32_t req_framenum
Definition packet-http.h:52
uint32_t res_framenum
Definition packet-http.h:54
Definition packet-http.h:70
uint16_t server_port
Definition packet-http.h:72
bool from_server
Definition packet-http.h:78
uint8_t http_version
Definition packet-http.h:74
Definition packet_info.h:43
Definition proto.h:907
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
Definition wmem_allocator.h:27
Definition wmem_map.c:60
Definition packet.c:846
Definition nstime.h:26
Definition tvbuff-int.h:35