Wireshark 4.7.0
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
41req_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
47static inline bool
48starts_with_chunk_size(tvbuff_t* tvb, const int offset, packet_info* pinfo)
49{
50 unsigned chunk_size = 0;
51 unsigned linelen;
52
53 if (!tvb_find_line_end_remaining(tvb, offset, &linelen, NULL))
54 return false;
55
56 char* chunk_string = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, linelen, ENC_ASCII);
57 char* c = chunk_string;
58
59 /* ignore extensions, including optional BWS ("bad whitespace")
60 * in the grammar for historical reasons, see RFC 9112 7.1.1.
61 */
62 if ((c = strpbrk(c, "; \t"))) {
63 *c = '\0';
64 }
65
66 if (!ws_hexstrtou32(chunk_string, NULL, &chunk_size)) {
67 return false; /* can not get chunk size*/
68 } else if (chunk_size > (1U << 31)) {
69 return false; /* chunk size is unreasonable */
70 }
71 return true;
72}
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:3890
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:4866
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)
Definition req_resp_hdrs.c:28
Definition packet_info.h:40
wmem_allocator_t * pool
Definition packet_info.h:161
Definition packet.c:852
Definition packet.c:97
Definition tvbuff-int.h:33