| 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
12#ifndef __REQ_RESP_HDRS_H__
13#define __REQ_RESP_HDRS_H__
14
15#include "ws_symbol_export.h"
16#include "wsutil/strtoi.h"
17
42WS_DLL_PUBLIC bool
43 req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
44 const bool desegment_headers, const bool desegment_body,
45 bool desegment_until_fin, int *last_chunk_offset,
46 dissector_table_t streaming_subdissector_table, dissector_handle_t *streaming_chunk_handle);
47
49 static inline bool
50starts_with_chunk_size(tvbuff_t* tvb, const int offset, packet_info* pinfo)
51{
52 unsigned chunk_size = 0;
53 int linelen = tvb_find_line_end(tvb, offset, tvb_reported_length_remaining(tvb, offset), NULL, true);
54
55 if (linelen < 0)
56 return false;
57
58 char* chunk_string = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, linelen, ENC_ASCII);
59 char* c = chunk_string;
60
61 /* ignore extensions, including optional BWS ("bad whitespace")
62 * in the grammar for historical reasons, see RFC 9112 7.1.1.
63 */
64 if ((c = strpbrk(c, "; \t"))) {
65 *c = '\0';
66 }
67
68 if (!ws_hexstrtou32(chunk_string, NULL, &chunk_size)) {
69 return false; /* can not get chunk size*/
70 } else if (chunk_size > (1U << 31)) {
71 return false; /* chunk size is unreasonable */
72 }
73 return true;
74}
75
76#endif
tvb_get_string_enc
uint8_t * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int length, const unsigned encoding)
Extract and convert a string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:3263
tvb_reported_length_remaining
int tvb_reported_length_remaining(const tvbuff_t *tvb, const int offset)
Computes bytes of reported packet data from the given offset to the end of buffer.
Definition tvbuff.c:730
tvb_find_line_end
int tvb_find_line_end(tvbuff_t *tvb, const int offset, int len, int *next_offset, const bool desegment)
Locate the end of a line in a tvbuff, optionally desegmenting.
Definition tvbuff.c:4158
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)
Definition req_resp_hdrs.c:28
strtoi.h
_packet_info
Definition packet_info.h:43
dissector_handle
Definition packet.c:857
dissector_table
Definition packet.c:97
tvbuff
Definition tvbuff-int.h:35