| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
req_resp_hdrs.h
Go to the documentation of this file.
1
11#pragma once
12#include "ws_symbol_export.h"
13#include <epan/packet.h>
14#include <wsutil/strtoi.h>
15
40WS_DLL_PUBLIC bool
41 req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
42 const bool desegment_headers, const bool desegment_body,
43 bool desegment_until_fin, int *last_chunk_offset,
44 dissector_table_t streaming_subdissector_table, dissector_handle_t *streaming_chunk_handle);
45
54 static inline bool
55starts_with_chunk_size(tvbuff_t* tvb, const int offset, packet_info* pinfo)
56{
57 unsigned chunk_size = 0;
58 unsigned linelen;
59
60 if (!tvb_find_line_end_remaining(tvb, offset, &linelen, NULL))
61 return false;
62
63 char* chunk_string = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, linelen, ENC_ASCII);
64 char* c = chunk_string;
65
66 /* ignore extensions, including optional BWS ("bad whitespace")
67 * in the grammar for historical reasons, see RFC 9112 7.1.1.
68 */
69 if ((c = strpbrk(c, "; \t"))) {
70 *c = '\0';
71 }
72
73 if (!ws_hexstrtou32(chunk_string, NULL, &chunk_size)) {
74 return false; /* can not get chunk size*/
75 } else if (chunk_size > (1U << 31)) {
76 return false; /* chunk size is unreasonable */
77 }
78 return true;
79}
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
tvb_get_string_enc
uint8_t * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding)
Extract and convert a string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:3876
tvb_find_line_end_remaining
bool tvb_find_line_end_remaining(tvbuff_t *tvb, const unsigned offset, unsigned *linelen, unsigned *next_offset)
Locate the end of a line in a tvbuff.
Definition tvbuff.c:4839
packet.h
req_resp_hdrs_do_reassembly
WS_DLL_PUBLIC bool req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, const bool desegment_headers, const bool desegment_body, bool desegment_until_fin, int *last_chunk_offset, dissector_table_t streaming_subdissector_table, dissector_handle_t *streaming_chunk_handle)
Optionally do reassembly of the request/response line, headers, and body.
Definition req_resp_hdrs.c:28
strtoi.h