Wireshark  4.3.0
The Wireshark network protocol analyzer
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 
41 WS_DLL_PUBLIC gboolean
42 req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
43  const gboolean desegment_headers, const gboolean desegment_body,
44  gboolean desegment_until_fin, int *last_chunk_offset,
45  dissector_table_t streaming_subdissector_table, dissector_handle_t *streaming_chunk_handle);
46 
48 static inline gboolean
49 starts_with_chunk_size(tvbuff_t* tvb, const int offset, packet_info* pinfo)
50 {
51  guint chunk_size = 0;
52  gint linelen = tvb_find_line_end(tvb, offset, tvb_reported_length_remaining(tvb, offset), NULL, TRUE);
53 
54  if (linelen < 0)
55  return FALSE;
56 
57  gchar* chunk_string = tvb_get_string_enc(pinfo->pool, tvb, offset, linelen, ENC_ASCII);
58  gchar* c = chunk_string;
59 
60  /* ignore extensions */
61  if ((c = strchr(c, ';'))) {
62  *c = '\0';
63  }
64 
65  if (sscanf(chunk_string, "%x", &chunk_size) < 1) {
66  return FALSE; /* can not get chunk size*/
67  } else if (chunk_size > (1U << 31)) {
68  return FALSE; /* chunk size is unreasonable */
69  }
70  return TRUE;
71 }
72 
73 #endif
guint8 * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint length, const guint encoding)
Definition: tvbuff.c:3191
gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment)
Definition: tvbuff.c:4087
gint tvb_reported_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:757
WS_DLL_PUBLIC gboolean req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, const gboolean desegment_headers, const gboolean desegment_body, gboolean 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:44
wmem_allocator_t * pool
Definition: packet_info.h:156
Definition: packet.c:762
Definition: packet.c:86
Definition: tvbuff-int.h:35