aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2010-04-03 18:18:50 +0000
committerBill Meier <wmeier@newsguy.com>2010-04-03 18:18:50 +0000
commit6812b68eb1973d4a439cc1342890353982a42a57 (patch)
treeb191b600b7710d04062effdc3f43d243d1150b55
parent68ad976a55954f7c4859c9402e4c219cf1fb5d45 (diff)
From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422 From me: Fix a number of instances where the function prototype or the function definition wasn't changed so there was a mismatch thus causing Windows (but not gcc) compilation errors. svn path=/trunk/; revision=32365
-rw-r--r--epan/addr_resolv.c48
-rw-r--r--epan/addr_resolv.h12
-rw-r--r--epan/address_to_str.c4
-rw-r--r--epan/column-utils.c74
-rw-r--r--epan/column-utils.h42
-rw-r--r--epan/column.c24
-rw-r--r--epan/column.h22
-rw-r--r--epan/conversation.c30
-rw-r--r--epan/conversation.h24
-rw-r--r--epan/dissectors/packet-dcerpc.c2
-rw-r--r--epan/dissectors/packet-x11.c4
-rw-r--r--epan/epan.c10
-rw-r--r--epan/epan.h10
-rw-r--r--epan/ipproto.c2
-rw-r--r--epan/ipproto.h2
-rw-r--r--epan/ipv4.c6
-rw-r--r--epan/ipv4.h6
-rw-r--r--epan/packet.c48
-rw-r--r--epan/packet.h34
-rw-r--r--epan/proto.c166
-rw-r--r--epan/proto.h102
-rw-r--r--epan/reassemble.c116
-rw-r--r--epan/reassemble.h70
-rw-r--r--epan/to_str.c42
-rw-r--r--epan/to_str.h42
-rw-r--r--epan/tvbparse.c66
-rw-r--r--epan/tvbparse.h46
-rw-r--r--epan/tvbuff.c200
-rw-r--r--epan/tvbuff.h172
-rw-r--r--epan/value_string.c18
-rw-r--r--epan/value_string.h22
31 files changed, 733 insertions, 733 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index ed833010a1..fb308a1597 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -265,7 +265,7 @@ static int service_resolution_initialized = 0;
static gboolean new_resolved_objects = FALSE;
static hashether_t *add_eth_name(const guint8 *addr, const gchar *name);
-static void add_serv_port_cb(guint32 port);
+static void add_serv_port_cb(const guint32 port);
/*
* Flag controlling what names to resolve.
@@ -422,10 +422,10 @@ static int fgetline(char **buf, int *size, FILE *fp)
* Local function definitions
*/
static subnet_entry_t subnet_lookup(const guint32 addr);
-static void subnet_entry_set(guint32 subnet_addr, guint32 mask_length, const gchar* name);
+static void subnet_entry_set(guint32 subnet_addr, const guint32 mask_length, const gchar* name);
-static void add_service_name(hashport_t **proto_table, guint port, const char *service_name)
+static void add_service_name(hashport_t **proto_table, const guint port, const char *service_name)
{
int hash_idx;
hashport_t *tp;
@@ -525,7 +525,7 @@ static void parse_service_line (char *line)
static void
-add_serv_port_cb(guint32 port)
+add_serv_port_cb(const guint32 port)
{
if ( port ) {
add_service_name(cb_port_table, port, cb_service);
@@ -574,7 +574,7 @@ static void initialize_services(void)
-static gchar *serv_name_lookup(guint port, port_type proto)
+static gchar *serv_name_lookup(const guint port, const port_type proto)
{
int hash_idx;
hashport_t *tp;
@@ -650,7 +650,7 @@ static gchar *serv_name_lookup(guint port, port_type proto)
/* Fill in an IP4 structure with info from subnets file or just with the
* string form of the address.
*/
-static void fill_dummy_ip4(guint addr, hashipv4_t* volatile tp)
+static void fill_dummy_ip4(const guint addr, hashipv4_t* volatile tp)
{
subnet_entry_t subnet_entry;
@@ -728,7 +728,7 @@ c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) {
#endif /* HAVE_C_ARES */
/* --------------- */
-static hashipv4_t *new_ipv4(guint addr)
+static hashipv4_t *new_ipv4(const guint addr)
{
hashipv4_t *tp = g_malloc(sizeof(hashipv4_t));
tp->addr = addr;
@@ -739,7 +739,7 @@ static hashipv4_t *new_ipv4(guint addr)
return tp;
}
-static hashipv4_t *host_lookup(guint addr, gboolean resolve, gboolean *found)
+static hashipv4_t *host_lookup(const guint addr, const gboolean resolve, gboolean *found)
{
int hash_idx;
hashipv4_t * volatile tp;
@@ -817,7 +817,7 @@ static hashipv4_t *host_lookup(guint addr, gboolean resolve, gboolean *found)
} /* host_name_lookup */
-static gchar *host_name_lookup(guint addr, gboolean *found)
+static gchar *host_name_lookup(const guint addr, gboolean *found)
{
hashipv4_t *tp;
tp = host_lookup(addr, TRUE, found);
@@ -838,7 +838,7 @@ static hashipv6_t *new_ipv6(const struct e_in6_addr *addr)
}
/* ------------------------------------ */
-static hashipv6_t *host_lookup6(const struct e_in6_addr *addr, gboolean resolve, gboolean *found)
+static hashipv6_t *host_lookup6(const struct e_in6_addr *addr, const gboolean resolve, gboolean *found)
{
int hash_idx;
hashipv6_t * volatile tp;
@@ -1016,7 +1016,7 @@ static const gchar *se_solve_address_to_name(const address *addr)
*/
static gboolean
parse_ether_address(const char *cp, ether_t *eth, unsigned int *mask,
- gboolean manuf_file)
+ const gboolean manuf_file)
{
int i;
unsigned long num;
@@ -1112,7 +1112,7 @@ parse_ether_address(const char *cp, ether_t *eth, unsigned int *mask,
}
static int parse_ether_line(char *line, ether_t *eth, unsigned int *mask,
- gboolean manuf_file)
+ const gboolean manuf_file)
{
/*
* See the ethers(4) or ethers(5) man page for ethers file format
@@ -1159,7 +1159,7 @@ static void end_ethent(void)
}
}
-static ether_t *get_ethent(unsigned int *mask, gboolean manuf_file)
+static ether_t *get_ethent(unsigned int *mask, const gboolean manuf_file)
{
static ether_t eth;
@@ -1267,7 +1267,7 @@ static int hash_eth_wka(const guint8 *addr, unsigned int mask)
(HASHETHSIZE - 1);
}
-static void add_manuf_name(guint8 *addr, unsigned int mask, gchar *name)
+static void add_manuf_name(const guint8 *addr, unsigned int mask, gchar *name)
{
int hash_idx;
hashmanuf_t *tp;
@@ -1377,7 +1377,7 @@ static hashmanuf_t *manuf_name_lookup(const guint8 *addr)
} /* manuf_name_lookup */
-static hashether_t *wka_name_lookup(const guint8 *addr, unsigned int mask)
+static hashether_t *wka_name_lookup(const guint8 *addr, const unsigned int mask)
{
int hash_idx;
hashether_t *(*wka_tp)[HASHETHSIZE];
@@ -1501,7 +1501,7 @@ static hashether_t *add_eth_name(const guint8 *addr, const gchar *name)
} /* add_eth_name */
/* XXXX */
-static hashether_t *eth_name_lookup(const guint8 *addr, gboolean resolve)
+static hashether_t *eth_name_lookup(const guint8 *addr, const gboolean resolve)
{
int hash_idx;
hashmanuf_t *manufp;
@@ -2130,7 +2130,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
* The definition is taken by masking the address passed in with the mask of the
* given length.
*/
-static void subnet_entry_set(guint32 subnet_addr, guint32 mask_length, const gchar* name)
+static void subnet_entry_set(guint32 subnet_addr, const guint32 mask_length, const gchar* name)
{
subnet_length_entry_t* entry;
hashipv4_t * tp;
@@ -2167,7 +2167,7 @@ static void subnet_entry_set(guint32 subnet_addr, guint32 mask_length, const gch
have_subnet_entry = TRUE;
}
-static guint32 get_subnet_mask(guint32 mask_length) {
+static guint32 get_subnet_mask(const guint32 mask_length) {
static guint32 masks[SUBNETLENGTHSIZE];
static gboolean initialised = FALSE;
@@ -2509,7 +2509,7 @@ host_name_lookup_cleanup(void) {
#endif /* HAVE_C_ARES */
-extern const gchar *get_hostname(guint addr)
+extern const gchar *get_hostname(const guint addr)
{
gboolean found;
gboolean resolve = g_resolv_flags & RESOLV_NETWORK;
@@ -2523,7 +2523,7 @@ extern const gchar *get_hostname(guint addr)
/* -------------------------- */
-extern const gchar *get_hostname6(struct e_in6_addr *addr)
+extern const gchar *get_hostname6(const struct e_in6_addr *addr)
{
gboolean found;
gboolean resolve = g_resolv_flags & RESOLV_NETWORK;
@@ -2535,7 +2535,7 @@ extern const gchar *get_hostname6(struct e_in6_addr *addr)
}
/* -------------------------- */
-extern void add_ipv4_name(guint addr, const gchar *name)
+extern void add_ipv4_name(const guint addr, const gchar *name)
{
int hash_idx;
hashipv4_t *tp;
@@ -2571,7 +2571,7 @@ extern void add_ipv4_name(guint addr, const gchar *name)
} /* add_ipv4_name */
/* -------------------------- */
-extern void add_ipv6_name(struct e_in6_addr *addrp, const gchar *name)
+extern void add_ipv6_name(const struct e_in6_addr *addrp, const gchar *name)
{
int hash_idx;
hashipv6_t *tp;
@@ -2706,7 +2706,7 @@ const gchar *se_get_addr_name(const address *addr)
return se_address_to_str(addr);
}
-void get_addr_name_buf(address *addr, gchar *buf, gsize size)
+void get_addr_name_buf(const address *addr, gchar *buf, gsize size)
{
const gchar *result = get_addr_name(addr);
@@ -2805,7 +2805,7 @@ extern guint8 *get_ether_addr(const gchar *name)
} /* get_ether_addr */
-extern void add_ether_byip(guint ip, const guint8 *eth)
+extern void add_ether_byip(const guint ip, const guint8 *eth)
{
gchar *host;
diff --git a/epan/addr_resolv.h b/epan/addr_resolv.h
index 67871614ef..1031ee8bc1 100644
--- a/epan/addr_resolv.h
+++ b/epan/addr_resolv.h
@@ -114,7 +114,7 @@ const gchar *se_get_addr_name(const address *addr);
/* the result which is always NUL ('\0') terminated. The buffer should be large enough to */
/* contain size characters including the terminator */
-void get_addr_name_buf(address *addr, gchar *buf, gsize size);
+void get_addr_name_buf(const address *addr, gchar *buf, gsize size);
/*
@@ -138,11 +138,11 @@ extern gboolean host_name_lookup_process(gpointer data);
extern void host_name_lookup_cleanup(void);
/* get_hostname returns the host name or "%d.%d.%d.%d" if not found */
-extern const gchar *get_hostname(guint addr);
+extern const gchar *get_hostname(const guint addr);
/* get_hostname6 returns the host name, or numeric addr if not found */
struct e_in6_addr;
-extern const gchar* get_hostname6(struct e_in6_addr *ad);
+extern const gchar* get_hostname6(const struct e_in6_addr *ad);
/* get_ether_name returns the logical name if found in ethers files else
"<vendor>_%02x:%02x:%02x" if the vendor code is known else
@@ -171,13 +171,13 @@ extern guint8 *get_ether_addr(const gchar *name);
guint32 get_ipxnet_addr(const gchar *name, gboolean *known);
/* adds a hostname/IPv4 in the hash table */
-extern void add_ipv4_name(guint addr, const gchar *name);
+extern void add_ipv4_name(const guint addr, const gchar *name);
/* adds a hostname/IPv6 in the hash table */
-extern void add_ipv6_name(struct e_in6_addr *addr, const gchar *name);
+extern void add_ipv6_name(const struct e_in6_addr *addr, const gchar *name);
/* add ethernet address / name corresponding to IP address */
-extern void add_ether_byip(guint ip, const guint8 *eth);
+extern void add_ether_byip(const guint ip, const guint8 *eth);
/** Translates a string representing a hostname or dotted-decimal IPv4 address
* into a numeric IPv4 address value in network byte order. If compiled with
diff --git a/epan/address_to_str.c b/epan/address_to_str.c
index 0df45c7b8d..a09a4ae11c 100644
--- a/epan/address_to_str.c
+++ b/epan/address_to_str.c
@@ -127,7 +127,7 @@ ip6_to_str_buf(const struct e_in6_addr *ad, gchar *buf)
}
gchar*
-ipx_addr_to_str(guint32 net, const guint8 *ad)
+ipx_addr_to_str(const guint32 net, const guint8 *ad)
{
gchar *buf;
char *name;
@@ -152,7 +152,7 @@ ipxnet_to_string(const guint8 *ad)
}
gchar *
-ipxnet_to_str_punct(const guint32 ad, char punct)
+ipxnet_to_str_punct(const guint32 ad, const char punct)
{
gchar *buf = ep_alloc(12);
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 6bc3f107f1..cbefe2c4d2 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -48,7 +48,7 @@
/* Allocate all the data structures for constructing column data, given
the number of columns. */
void
-col_setup(column_info *cinfo, gint num_cols)
+col_setup(column_info *cinfo, const gint num_cols)
{
int i;
@@ -101,7 +101,7 @@ col_get_writable(column_info *cinfo)
}
void
-col_set_writable(column_info *cinfo, gboolean writable)
+col_set_writable(column_info *cinfo, const gboolean writable)
{
if (cinfo)
cinfo->writable = writable;
@@ -115,14 +115,14 @@ col_set_writable(column_info *cinfo, gboolean writable)
((cinfo)->col_first[el] >= 0))
gint
-check_col(column_info *cinfo, gint el)
+check_col(column_info *cinfo, const gint el)
{
return CHECK_COL(cinfo, el);
}
/* Sets the fence for a column to be at the end of the column. */
void
-col_set_fence(column_info *cinfo, gint el)
+col_set_fence(column_info *cinfo, const gint el)
{
int i;
@@ -143,7 +143,7 @@ col_set_fence(column_info *cinfo, gint el)
later append to it, as the later append will cause a string
copy to be done. */
void
-col_clear(column_info *cinfo, gint el)
+col_clear(column_info *cinfo, const gint el)
{
int i;
int fence;
@@ -254,7 +254,7 @@ col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
}
static void
-col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator,
+col_do_append_sep_va_fstr(column_info *cinfo, const gint el, const gchar *separator,
const gchar *format, va_list ap)
{
int i;
@@ -294,7 +294,7 @@ col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator,
/* Appends a vararg list to a packet info string. */
void
-col_append_fstr(column_info *cinfo, gint el, const gchar *format, ...)
+col_append_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
{
va_list ap;
@@ -309,7 +309,7 @@ col_append_fstr(column_info *cinfo, gint el, const gchar *format, ...)
/* Appends a vararg list to a packet info string.
* Prefixes it with the given separator if the column is not empty. */
void
-col_append_sep_fstr(column_info *cinfo, gint el, const gchar *separator,
+col_append_sep_fstr(column_info *cinfo, const gint el, const gchar *separator,
const gchar *format, ...)
{
va_list ap;
@@ -330,7 +330,7 @@ col_append_sep_fstr(column_info *cinfo, gint el, const gchar *separator,
#define COL_BUF_MAX_LEN (((COL_MAX_INFO_LEN) > (COL_MAX_LEN)) ? \
(COL_MAX_INFO_LEN) : (COL_MAX_LEN))
void
-col_prepend_fstr(column_info *cinfo, gint el, const gchar *format, ...)
+col_prepend_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
{
va_list ap;
int i;
@@ -371,7 +371,7 @@ col_prepend_fstr(column_info *cinfo, gint el, const gchar *format, ...)
va_end(ap);
}
void
-col_prepend_fence_fstr(column_info *cinfo, gint el, const gchar *format, ...)
+col_prepend_fence_fstr(column_info *cinfo, const gint el, const gchar *format, ...)
{
va_list ap;
int i;
@@ -418,7 +418,7 @@ col_prepend_fence_fstr(column_info *cinfo, gint el, const gchar *format, ...)
/* Use this if "str" points to something that won't stay around (and
must thus be copied). */
void
-col_add_str(column_info *cinfo, gint el, const gchar* str)
+col_add_str(column_info *cinfo, const gint el, const gchar* str)
{
int i;
int fence;
@@ -455,7 +455,7 @@ col_add_str(column_info *cinfo, gint el, const gchar* str)
/* Use this if "str" points to something that will stay around (and thus
needn't be copied). */
void
-col_set_str(column_info *cinfo, gint el, const gchar* str)
+col_set_str(column_info *cinfo, const gint el, const gchar* str)
{
int i;
int fence;
@@ -499,7 +499,7 @@ col_set_str(column_info *cinfo, gint el, const gchar* str)
/* Adds a vararg list to a packet info string. */
void
-col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) {
+col_add_fstr(column_info *cinfo, const gint el, const gchar *format, ...) {
va_list ap;
int i;
int fence;
@@ -536,7 +536,7 @@ col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) {
}
static void
-col_do_append_str(column_info *cinfo, gint el, const gchar* separator,
+col_do_append_str(column_info *cinfo, const gint el, const gchar* separator,
const gchar* str)
{
int i;
@@ -570,7 +570,7 @@ col_do_append_str(column_info *cinfo, gint el, const gchar* separator,
}
void
-col_append_str(column_info *cinfo, gint el, const gchar* str)
+col_append_str(column_info *cinfo, const gint el, const gchar* str)
{
if (!CHECK_COL(cinfo, el))
return;
@@ -579,7 +579,7 @@ col_append_str(column_info *cinfo, gint el, const gchar* str)
}
void
-col_append_sep_str(column_info *cinfo, gint el, const gchar* separator,
+col_append_sep_str(column_info *cinfo, const gint el, const gchar* separator,
const gchar* str)
{
if (!CHECK_COL(cinfo, el))
@@ -593,7 +593,7 @@ col_append_sep_str(column_info *cinfo, gint el, const gchar* separator,
/* --------------------------------- */
gboolean
-col_has_time_fmt(column_info *cinfo, gint col)
+col_has_time_fmt(column_info *cinfo, const gint col)
{
return ((cinfo->fmt_matx[col][COL_CLS_TIME]) ||
(cinfo->fmt_matx[col][COL_ABS_TIME]) ||
@@ -604,7 +604,7 @@ col_has_time_fmt(column_info *cinfo, gint col)
}
static gint
-set_abs_date_time(frame_data *fd, gchar *buf)
+set_abs_date_time(const frame_data *fd, gchar *buf)
{
struct tm *tmp;
time_t then;
@@ -688,7 +688,7 @@ set_abs_date_time(frame_data *fd, gchar *buf)
}
static void
-col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
+col_set_abs_date_time(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_abs_date_time(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time";
@@ -698,7 +698,7 @@ col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
}
static gint
-set_rel_time(frame_data *fd, gchar *buf)
+set_rel_time(const frame_data *fd, gchar *buf)
{
switch(timestamp_get_precision()) {
case(TS_PREC_FIXED_SEC):
@@ -738,7 +738,7 @@ set_rel_time(frame_data *fd, gchar *buf)
}
static void
-col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
+col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_rel_time(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time_relative";
@@ -748,7 +748,7 @@ col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
}
static gint
-set_delta_time(frame_data *fd, gchar *buf)
+set_delta_time(const frame_data *fd, gchar *buf)
{
switch(timestamp_get_precision()) {
case(TS_PREC_FIXED_SEC):
@@ -788,7 +788,7 @@ set_delta_time(frame_data *fd, gchar *buf)
}
static void
-col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
+col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_delta_time(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time_delta";
@@ -798,7 +798,7 @@ col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
}
static gint
-set_delta_time_dis(frame_data *fd, gchar *buf)
+set_delta_time_dis(const frame_data *fd, gchar *buf)
{
switch(timestamp_get_precision()) {
case(TS_PREC_FIXED_SEC):
@@ -838,7 +838,7 @@ set_delta_time_dis(frame_data *fd, gchar *buf)
}
static void
-col_set_delta_time_dis(frame_data *fd, column_info *cinfo, int col)
+col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_delta_time_dis(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time_delta_displayed";
@@ -848,7 +848,7 @@ col_set_delta_time_dis(frame_data *fd, column_info *cinfo, int col)
}
static gint
-set_abs_time(frame_data *fd, gchar *buf)
+set_abs_time(const frame_data *fd, gchar *buf)
{
struct tm *tmp;
time_t then;
@@ -915,7 +915,7 @@ set_abs_time(frame_data *fd, gchar *buf)
}
static void
-col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
+col_set_abs_time(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_abs_time(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time";
@@ -925,7 +925,7 @@ col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
}
static gint
-set_epoch_time(frame_data *fd, gchar *buf)
+set_epoch_time(const frame_data *fd, gchar *buf)
{
switch(timestamp_get_precision()) {
case(TS_PREC_FIXED_SEC):
@@ -965,7 +965,7 @@ set_epoch_time(frame_data *fd, gchar *buf)
}
static void
-col_set_epoch_time(frame_data *fd, column_info *cinfo, int col)
+col_set_epoch_time(const frame_data *fd, column_info *cinfo, const int col)
{
if (set_epoch_time(fd, cinfo->col_buf[col])) {
cinfo->col_expr.col_expr[col] = "frame.time_delta";
@@ -1021,7 +1021,7 @@ set_cls_time(frame_data *fd, gchar *buf)
#endif
static void
-col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
+col_set_cls_time(const frame_data *fd, column_info *cinfo, const gint col)
{
switch (timestamp_get_type()) {
case TS_ABSOLUTE:
@@ -1063,7 +1063,7 @@ col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
requiring us to stuff the text into the widget from outside, we
might be able to clean this up. */
void
-col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col)
+col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const gint col)
{
COL_CHECK_REF_TIME(fd, cinfo->col_buf[col]);
@@ -1100,7 +1100,7 @@ col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col)
/* --------------------------- */
void
-col_set_time(column_info *cinfo, gint el, nstime_t *ts, char *fieldname)
+col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, char *fieldname)
{
int col;
@@ -1155,7 +1155,7 @@ col_set_time(column_info *cinfo, gint el, nstime_t *ts, char *fieldname)
}
static void
-col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_src, gboolean fill_col_exprs)
+col_set_addr(packet_info *pinfo, const int col, const address *addr, const gboolean is_src, const gboolean fill_col_exprs)
{
if (addr->type == AT_NONE) {
pinfo->cinfo->col_data[col] = "";
@@ -1230,7 +1230,7 @@ col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_src, gboole
/* ------------------------ */
static void
-col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src, gboolean fill_col_exprs _U_)
+col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gboolean is_src, const gboolean fill_col_exprs _U_)
{
guint32 port;
@@ -1319,7 +1319,7 @@ col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src, gboo
}
gboolean
-col_based_on_frame_data(column_info *cinfo, gint col)
+col_based_on_frame_data(column_info *cinfo, const gint col)
{
g_assert(cinfo);
g_assert(col < cinfo->num_cols);
@@ -1343,7 +1343,7 @@ col_based_on_frame_data(column_info *cinfo, gint col)
}
void
-col_fill_in_frame_data(frame_data *fd, column_info *cinfo, gint col, gboolean fill_col_exprs)
+col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, const gboolean fill_col_exprs)
{
switch (cinfo->col_fmt[col]) {
@@ -1409,7 +1409,7 @@ col_fill_in_frame_data(frame_data *fd, column_info *cinfo, gint col, gboolean fi
}
void
-col_fill_in(packet_info *pinfo, gboolean fill_col_exprs, gboolean fill_fd_colums)
+col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
{
int i;
diff --git a/epan/column-utils.h b/epan/column-utils.h
index 438374b6b8..a9f76ece35 100644
--- a/epan/column-utils.h
+++ b/epan/column-utils.h
@@ -51,7 +51,7 @@ extern "C" {
*
* Internal, don't use this in dissectors!
*/
-extern void col_setup(column_info *cinfo, gint num_cols);
+extern void col_setup(column_info *cinfo, const gint num_cols);
/** Initialize the data structures for constructing column data.
*
@@ -63,19 +63,19 @@ extern void col_init(column_info *cinfo);
*
* Internal, don't use this in dissectors!
*/
-extern void col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col);
+extern void col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const gint col);
/** Fill in all columns of the given packet which are based on values from frame_data.
*
* Internal, don't use this in dissectors!
*/
-extern void col_fill_in_frame_data(frame_data *fd, column_info *cinfo, gint col, gboolean fill_col_exprs);
+extern void col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, gboolean const fill_col_exprs);
/** Fill in all columns of the given packet.
*
* Internal, don't use this in dissectors!
*/
-extern void col_fill_in(packet_info *pinfo, gboolean fill_col_exprs, gboolean fill_fd_colums);
+extern void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
/* Utility routines used by packet*.c */
@@ -91,14 +91,14 @@ extern gboolean col_get_writable(column_info *cinfo);
* @param cinfo the current packet row
* @param writable TRUE if it's writable, FALSE if not
*/
-extern void col_set_writable(column_info *cinfo, gboolean writable);
+extern void col_set_writable(column_info *cinfo, const gboolean writable);
/** Check if the given column be filled with data.
*
* @param cinfo the current packet row
* @param col the column to use, e.g. COL_INFO
*/
-extern gint check_col(column_info *cinfo, gint col);
+extern gint check_col(column_info *cinfo, const gint col);
/** Sets a fence for the current column content,
* so this content won't be affected by further col_... function calls.
@@ -109,14 +109,14 @@ extern gint check_col(column_info *cinfo, gint col);
* @param cinfo the current packet row
* @param col the column to use, e.g. COL_INFO
*/
-extern void col_set_fence(column_info *cinfo, gint col);
+extern void col_set_fence(column_info *cinfo, const gint col);
/** Clears the text of a column element.
*
* @param cinfo the current packet row
* @param col the column to use, e.g. COL_INFO
*/
-extern void col_clear(column_info *cinfo, gint col);
+extern void col_clear(column_info *cinfo, const gint col);
/** Set (replace) the text of a column element, the text won't be copied.
*
@@ -126,7 +126,7 @@ extern void col_clear(column_info *cinfo, gint col);
* @param col the column to use, e.g. COL_INFO
* @param str the string to set
*/
-extern void col_set_str(column_info *cinfo, gint col, const gchar * str);
+extern void col_set_str(column_info *cinfo, const gint col, const gchar * str);
/** Add (replace) the text of a column element, the text will be copied.
*
@@ -134,7 +134,7 @@ extern void col_set_str(column_info *cinfo, gint col, const gchar * str);
* @param col the column to use, e.g. COL_INFO
* @param str the string to add
*/
-extern void col_add_str(column_info *cinfo, gint col, const gchar *str);
+extern void col_add_str(column_info *cinfo, const gint col, const gchar *str);
/** Add (replace) the text of a column element, the text will be formatted and copied.
*
@@ -145,7 +145,7 @@ extern void col_add_str(column_info *cinfo, gint col, const gchar *str);
* @param format the format string
* @param ... the variable number of parameters
*/
-extern void col_add_fstr(column_info *cinfo, gint col, const gchar *format, ...)
+extern void col_add_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
G_GNUC_PRINTF(3, 4);
/* For internal Wireshark use only. Not to be called from dissectors. */
@@ -156,8 +156,8 @@ void col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo);
/* For internal Wireshark use only. Not to be called from dissectors. */
gboolean have_custom_cols(column_info *cinfo);
-gboolean col_has_time_fmt(column_info *cinfo, gint col);
-gboolean col_based_on_frame_data(column_info *cinfo, gint col);
+gboolean col_has_time_fmt(column_info *cinfo, const gint col);
+gboolean col_based_on_frame_data(column_info *cinfo, const gint col);
/** Append the given text to a column element, the text will be copied.
*
@@ -165,7 +165,7 @@ gboolean col_based_on_frame_data(column_info *cinfo, gint col);
* @param col the column to use, e.g. COL_INFO
* @param str the string to append
*/
-extern void col_append_str(column_info *cinfo, gint col, const gchar *str);
+extern void col_append_str(column_info *cinfo, const gint col, const gchar *str);
/** Append the given text to a column element, the text will be formatted and copied.
*
@@ -176,7 +176,7 @@ extern void col_append_str(column_info *cinfo, gint col, const gchar *str);
* @param format the format string
* @param ... the variable number of parameters
*/
-extern void col_append_fstr(column_info *cinfo, gint col, const gchar *format, ...)
+extern void col_append_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
G_GNUC_PRINTF(3, 4);
/** Prepend the given text to a column element, the text will be formatted and copied.
@@ -186,7 +186,7 @@ extern void col_append_fstr(column_info *cinfo, gint col, const gchar *format, .
* @param format the format string
* @param ... the variable number of parameters
*/
-extern void col_prepend_fstr(column_info *cinfo, gint col, const gchar *format, ...)
+extern void col_prepend_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
G_GNUC_PRINTF(3, 4);
/**Prepend the given text to a column element, the text will be formatted and copied.
@@ -197,7 +197,7 @@ extern void col_prepend_fstr(column_info *cinfo, gint col, const gchar *format,
* there is already a fence created. This function will create a fence in case
* it does not yet exist.
*/
-extern void col_prepend_fence_fstr(column_info *cinfo, gint col, const gchar *format, ...)
+extern void col_prepend_fence_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
G_GNUC_PRINTF(3, 4);
/** Append the given text (prepended by a separator) to a column element.
@@ -209,7 +209,7 @@ extern void col_prepend_fence_fstr(column_info *cinfo, gint col, const gchar *fo
* @param sep the separator string or NULL for default: ", "
* @param str the string to append
*/
-extern void col_append_sep_str(column_info *cinfo, gint col, const gchar *sep,
+extern void col_append_sep_str(column_info *cinfo, const gint col, const gchar *sep,
const gchar *str);
/** Append the given text (prepended by a separator) to a column element.
@@ -222,7 +222,7 @@ extern void col_append_sep_str(column_info *cinfo, gint col, const gchar *sep,
* @param format the format string
* @param ... the variable number of parameters
*/
-extern void col_append_sep_fstr(column_info *cinfo, gint col, const gchar *sep,
+extern void col_append_sep_fstr(column_info *cinfo, const gint col, const gchar *sep,
const gchar *format, ...)
G_GNUC_PRINTF(4, 5);
@@ -237,8 +237,8 @@ extern void col_append_sep_fstr(column_info *cinfo, gint col, const gchar *sep,
* @param fieldname the fieldname to use for creating a filter (when
* applying/preparing/copying as filter)
*/
-extern void col_set_time(column_info *cinfo, int col,
- nstime_t *ts, char *fieldname);
+extern void col_set_time(column_info *cinfo, const int col,
+ const nstime_t *ts, char *fieldname);
#ifdef __cplusplus
}
diff --git a/epan/column.c b/epan/column.c
index 17dbcb461e..03ed22d673 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -45,7 +45,7 @@
/* Given a format number (as defined in column_info.h), returns its equivalent
string */
const gchar *
-col_format_to_string(gint fmt) {
+col_format_to_string(const gint fmt) {
const gchar *slist[] = {
"%q", /* 0) COL_8021Q_VLAN_ID */
"%Yt", /* 1) COL_ABS_DATE_TIME */
@@ -179,7 +179,7 @@ static const gchar *dlist[NUM_COL_FMTS] = {
};
const gchar *
-col_format_desc(gint fmt) {
+col_format_desc(const gint fmt) {
g_assert((fmt >= 0) && (fmt < NUM_COL_FMTS));
return(dlist[fmt]);
}
@@ -187,7 +187,7 @@ col_format_desc(gint fmt) {
/* Marks each array element true if it can be substituted for the given
column format */
void
-get_column_format_matches(gboolean *fmt_list, gint format) {
+get_column_format_matches(gboolean *fmt_list, const gint format) {
/* Get the obvious: the format itself */
if ((format >= 0) && (format < NUM_COL_FMTS))
@@ -311,7 +311,7 @@ get_column_format_matches(gboolean *fmt_list, gint format) {
/* Returns a string representing the longest possible value for
a timestamp column type. */
static const char *
-get_timestamp_column_longest_string(gint type, gint precision)
+get_timestamp_column_longest_string(const gint type, const gint precision)
{
switch(type) {
@@ -452,7 +452,7 @@ get_timestamp_column_longest_string(gint type, gint precision)
/* Returns the longer string of the column title or the hard-coded width of
* its contents for building the packet list layout. */
const gchar *
-get_column_width_string(gint format, gint col)
+get_column_width_string(const gint format, const gint col)
{
if(strlen(get_column_longest_string(format)) >
strlen(get_column_title(col)))
@@ -474,7 +474,7 @@ get_column_width_string(gint format, gint col)
is somewhat arbitrary in any case. We should probably clean
that up eventually, though. */
const char *
-get_column_longest_string(gint format)
+get_column_longest_string(const gint format)
{
switch (format) {
case COL_NUMBER:
@@ -610,13 +610,13 @@ get_column_longest_string(gint format)
/* Returns the longest possible width, in characters, for a particular
column type. */
gint
-get_column_char_width(gint format)
+get_column_char_width(const gint format)
{
return (gint)strlen(get_column_longest_string(format));
}
gint
-get_column_format(gint col)
+get_column_format(const gint col)
{
GList *clp = g_list_nth(prefs.col_list, col);
fmt_data *cfmt;
@@ -630,7 +630,7 @@ get_column_format(gint col)
}
gint
-get_column_format_from_str(gchar *str)
+get_column_format_from_str(const gchar *str)
{
gint i;
@@ -642,7 +642,7 @@ get_column_format_from_str(gchar *str)
}
gchar *
-get_column_title(gint col)
+get_column_title(const gint col)
{
GList *clp = g_list_nth(prefs.col_list, col);
fmt_data *cfmt;
@@ -656,7 +656,7 @@ get_column_title(gint col)
}
const gchar *
-get_column_custom_field(gint col)
+get_column_custom_field(const gint col)
{
GList *clp = g_list_nth(prefs.col_list, col);
fmt_data *cfmt;
@@ -670,7 +670,7 @@ get_column_custom_field(gint col)
}
void
-build_column_format_array(column_info *cinfo, gint num_cols, gboolean reset_fences)
+build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
{
int i;
diff --git a/epan/column.h b/epan/column.h
index d8cf558bac..89c0bec4a9 100644
--- a/epan/column.h
+++ b/epan/column.h
@@ -35,19 +35,19 @@ typedef struct _fmt_data {
gchar *custom_field;
} fmt_data;
-const gchar *col_format_to_string(gint);
-const gchar *col_format_desc(gint);
-gint get_column_format(gint);
-void get_column_format_matches(gboolean *, gint);
-gint get_column_format_from_str(gchar *);
-gchar *get_column_title(gint);
-const gchar *get_column_custom_field(gint);
-const gchar *get_column_width_string(gint, gint);
-const char *get_column_longest_string(gint);
-gint get_column_char_width(gint format);
+const gchar *col_format_to_string(const gint);
+const gchar *col_format_desc(const gint);
+gint get_column_format(const gint);
+void get_column_format_matches(gboolean *, const gint);
+gint get_column_format_from_str(const gchar *);
+gchar *get_column_title(const gint);
+const gchar *get_column_custom_field(const gint);
+const gchar *get_column_width_string(const gint, const gint);
+const char *get_column_longest_string(const gint);
+gint get_column_char_width(const gint format);
void
-build_column_format_array(column_info *cinfo, gint num_cols, gboolean reset_fences);
+build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences);
#ifdef __cplusplus
}
diff --git a/epan/conversation.c b/epan/conversation.c
index 76dd0ef3fa..5a2e435277 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -97,7 +97,7 @@ typedef struct _conv_proto_data {
* options bits are set (NO_ADDR2 and NO_PORT2).
*/
static conversation_t *
-conversation_create_from_template(conversation_t *conversation, address *addr2, guint32 port2)
+conversation_create_from_template(conversation_t *conversation, const address *addr2, const guint32 port2)
{
/*
* Add a new conversation and keep the conversation template only if the
@@ -474,8 +474,8 @@ conversation_init(void)
* when searching for this conversation.
*/
conversation_t *
-conversation_new(guint32 setup_frame, address *addr1, address *addr2, port_type ptype,
- guint32 port1, guint32 port2, guint options)
+conversation_new(const guint32 setup_frame, const address *addr1, const address *addr2, const port_type ptype,
+ const guint32 port1, const guint32 port2, const guint options)
{
/*
DISSECTOR_ASSERT(!(options | CONVERSATION_TEMPLATE) || ((options | (NO_ADDR2 | NO_PORT2 | NO_PORT2_FORCE))) &&
@@ -555,7 +555,7 @@ conversation_new(guint32 setup_frame, address *addr1, address *addr2, port_type
* update the options and port values, insert the updated key.
*/
void
-conversation_set_port2(conversation_t *conv, guint32 port)
+conversation_set_port2(conversation_t *conv, const guint32 port)
{
DISSECTOR_ASSERT(!(conv->options & CONVERSATION_TEMPLATE) &&
"Use the conversation_create_from_template function when the CONVERSATION_TEMPLATE bit is set in the options mask");
@@ -589,7 +589,7 @@ conversation_set_port2(conversation_t *conv, guint32 port)
* table, update the options and port values, insert the updated key.
*/
void
-conversation_set_addr2(conversation_t *conv, address *addr)
+conversation_set_addr2(conversation_t *conv, const address *addr)
{
DISSECTOR_ASSERT(!(conv->options & CONVERSATION_TEMPLATE) &&
"Use the conversation_create_from_template function when the CONVERSATION_TEMPLATE bit is set in the options mask");
@@ -623,8 +623,8 @@ conversation_set_addr2(conversation_t *conv, address *addr)
* {addr1, port1, addr2, port2} and set up before frame_num.
*/
static conversation_t *
-conversation_lookup_hashtable(GHashTable *hashtable, guint32 frame_num, address *addr1, address *addr2,
- port_type ptype, guint32 port1, guint32 port2)
+conversation_lookup_hashtable(GHashTable *hashtable, const guint32 frame_num, const address *addr1, const address *addr2,
+ const port_type ptype, const guint32 port1, const guint32 port2)
{
conversation_t* conversation;
conversation_t* match;
@@ -693,8 +693,8 @@ conversation_lookup_hashtable(GHashTable *hashtable, guint32 frame_num, address
* otherwise, we found no matching conversation, and return NULL.
*/
conversation_t *
-find_conversation(guint32 frame_num, address *addr_a, address *addr_b, port_type ptype,
- guint32 port_a, guint32 port_b, guint options)
+find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b, const port_type ptype,
+ const guint32 port_a, const guint32 port_b, const guint options)
{
conversation_t *conversation;
@@ -1014,7 +1014,7 @@ p_compare(gconstpointer a, gconstpointer b)
}
void
-conversation_add_proto_data(conversation_t *conv, int proto, void *proto_data)
+conversation_add_proto_data(conversation_t *conv, const int proto, void *proto_data)
{
conv_proto_data *p1 = se_alloc(sizeof(conv_proto_data));
@@ -1028,7 +1028,7 @@ conversation_add_proto_data(conversation_t *conv, int proto, void *proto_data)
}
void *
-conversation_get_proto_data(conversation_t *conv, int proto)
+conversation_get_proto_data(const conversation_t *conv, const int proto)
{
conv_proto_data temp, *p1;
GSList *item;
@@ -1048,7 +1048,7 @@ conversation_get_proto_data(conversation_t *conv, int proto)
}
void
-conversation_delete_proto_data(conversation_t *conv, int proto)
+conversation_delete_proto_data(conversation_t *conv, const int proto)
{
conv_proto_data temp;
GSList *item;
@@ -1066,7 +1066,7 @@ conversation_delete_proto_data(conversation_t *conv, int proto)
}
void
-conversation_set_dissector(conversation_t *conversation, dissector_handle_t handle)
+conversation_set_dissector(conversation_t *conversation, const dissector_handle_t handle)
{
conversation->dissector_handle = handle;
}
@@ -1082,8 +1082,8 @@ conversation_set_dissector(conversation_t *conversation, dissector_handle_t hand
* this function returns FALSE.
*/
gboolean
-try_conversation_dissector(address *addr_a, address *addr_b, port_type ptype,
- guint32 port_a, guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
+try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype,
+ const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree)
{
conversation_t *conversation;
diff --git a/epan/conversation.h b/epan/conversation.h
index 7c4418c68c..d19065a1e2 100644
--- a/epan/conversation.h
+++ b/epan/conversation.h
@@ -80,28 +80,28 @@ typedef struct conversation {
extern void conversation_cleanup(void);
extern void conversation_init(void);
-extern conversation_t *conversation_new(guint32 setup_frame, address *addr1, address *addr2,
- port_type ptype, guint32 port1, guint32 port2, guint options);
+extern conversation_t *conversation_new(const guint32 setup_frame, const address *addr1, const address *addr2,
+ const port_type ptype, const guint32 port1, const guint32 port2, const guint options);
-extern conversation_t *find_conversation(guint32 frame_num, address *addr_a, address *addr_b,
- port_type ptype, guint32 port_a, guint32 port_b, guint options);
+extern conversation_t *find_conversation(const guint32 frame_num, const address *addr_a, const address *addr_b,
+ const port_type ptype, const guint32 port_a, const guint32 port_b, const guint options);
-extern void conversation_add_proto_data(conversation_t *conv, int proto,
+extern void conversation_add_proto_data(conversation_t *conv, const int proto,
void *proto_data);
-extern void *conversation_get_proto_data(conversation_t *conv, int proto);
-extern void conversation_delete_proto_data(conversation_t *conv, int proto);
+extern void *conversation_get_proto_data(const conversation_t *conv, const int proto);
+extern void conversation_delete_proto_data(conversation_t *conv, const int proto);
extern void conversation_set_dissector(conversation_t *conversation,
- dissector_handle_t handle);
+ const dissector_handle_t handle);
extern gboolean
-try_conversation_dissector(address *addr_a, address *addr_b, port_type ptype,
- guint32 port_a, guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
+try_conversation_dissector(const address *addr_a, const address *addr_b, const port_type ptype,
+ const guint32 port_a, const guint32 port_b, tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree);
/* These routines are used to set undefined values for a conversation */
-extern void conversation_set_port2(conversation_t *conv, guint32 port);
-extern void conversation_set_addr2(conversation_t *conv, address *addr);
+extern void conversation_set_port2(conversation_t *conv, const guint32 port);
+extern void conversation_set_addr2(conversation_t *conv, const address *addr);
#ifdef __cplusplus
}
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index 44187ddf46..a328727e23 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -3163,7 +3163,7 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo,
then exit
*/
if(pinfo->fd->flags.visited){
- fd_head=fragment_get_reassembled(pinfo, frame, dcerpc_co_reassemble_table);
+ fd_head=fragment_get_reassembled(frame, dcerpc_co_reassemble_table);
goto end_cn_stub;
}
diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c
index da3d6af80b..33f70ab443 100644
--- a/epan/dissectors/packet-x11.c
+++ b/epan/dissectors/packet-x11.c
@@ -2621,7 +2621,7 @@ static int rounded4(int n)
/* We assume the order to be consistent, until proven wrong. */
-static gboolean consistentWithOrder(int length, tvbuff_t *tvb, int offset, guint16 (*v16)(tvbuff_t *, gint))
+static gboolean consistentWithOrder(int length, tvbuff_t *tvb, int offset, guint16 (*v16)(tvbuff_t *, const gint))
{
switch(tvb_get_guint8(tvb, offset)) {
case X_CreateWindow:
@@ -2837,7 +2837,7 @@ static gboolean consistentWithOrder(int length, tvbuff_t *tvb, int offset, guint
/* -1 means doesn't match, +1 means match, 0 means don't know */
-static int x_endian_match(tvbuff_t *tvb, guint16 (*v16)(tvbuff_t *, gint))
+static int x_endian_match(tvbuff_t *tvb, guint16 (*v16)(tvbuff_t *, const gint))
{
int offset, nextoffset;
int atLeastOne = 0;
diff --git a/epan/epan.c b/epan/epan.c
index 176e83ecc5..7b045c650c 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -150,7 +150,7 @@ epan_circuit_cleanup(void)
}
epan_dissect_t*
-epan_dissect_init(epan_dissect_t *edt, gboolean create_proto_tree, gboolean proto_tree_visible)
+epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible)
{
g_assert(edt);
@@ -166,7 +166,7 @@ epan_dissect_init(epan_dissect_t *edt, gboolean create_proto_tree, gboolean prot
}
epan_dissect_t*
-epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible)
+epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible)
{
epan_dissect_t *edt;
@@ -176,7 +176,7 @@ epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible)
}
void
-epan_dissect_fake_protocols(epan_dissect_t *edt, gboolean fake_protocols)
+epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols)
{
if (edt)
proto_tree_set_fake_protocols(edt->tree, fake_protocols);
@@ -227,13 +227,13 @@ epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t* dfcode)
const gchar *
epan_custom_set(epan_dissect_t *edt, int field_id,
gchar *result,
- gchar *expr, int size )
+ gchar *expr, const int size )
{
return proto_custom_set(edt->tree, field_id, result, expr, size);
}
void
-epan_dissect_fill_in_columns(epan_dissect_t *edt, gboolean fill_col_exprs, gboolean fill_fd_colums)
+epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
{
col_custom_set_edt(edt, edt->pi.cinfo);
col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);
diff --git a/epan/epan.h b/epan/epan.h
index d7c9742ad3..bfad1c8d5c 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -89,16 +89,16 @@ epan_get_version(void);
/* initialize an existing single packet dissection */
epan_dissect_t*
-epan_dissect_init(epan_dissect_t *edt, gboolean create_proto_tree, gboolean proto_tree_visible);
+epan_dissect_init(epan_dissect_t *edt, const gboolean create_proto_tree, const gboolean proto_tree_visible);
/* get a new single packet dissection */
/* should be freed using epan_dissect_free() after packet dissection completed */
epan_dissect_t*
-epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible);
+epan_dissect_new(const gboolean create_proto_tree, const gboolean proto_tree_visible);
/* Indicate whether we should fake protocols or not */
void
-epan_dissect_fake_protocols(epan_dissect_t *edt, gboolean fake_protocols);
+epan_dissect_fake_protocols(epan_dissect_t *edt, const gboolean fake_protocols);
/* run a single packet dissection */
void
@@ -111,7 +111,7 @@ epan_dissect_prime_dfilter(epan_dissect_t *edt, const dfilter_t *dfcode);
/* fill the dissect run output into the packet list columns */
void
-epan_dissect_fill_in_columns(epan_dissect_t *edt, gboolean fill_col_exprs, gboolean fill_fd_colums);
+epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
/* releases resources attached to the packet dissection. DOES NOT free the actual pointer */
void
@@ -124,6 +124,6 @@ epan_dissect_free(epan_dissect_t* edt);
/* Sets custom column */
const gchar *
epan_custom_set(epan_dissect_t *edt, int id,
- gchar *result, gchar *expr, int size );
+ gchar *result, gchar *expr, const int size );
#endif /* EPAN_H */
diff --git a/epan/ipproto.c b/epan/ipproto.c
index 289530f088..c48b44972d 100644
--- a/epan/ipproto.c
+++ b/epan/ipproto.c
@@ -187,7 +187,7 @@ const value_string ipproto_val[] = {
{ 0, NULL },
};
-const char *ipprotostr(int proto) {
+const char *ipprotostr(const int proto) {
const char *s;
if ((s = match_strval(proto, ipproto_val)) != NULL)
diff --git a/epan/ipproto.h b/epan/ipproto.h
index f0b7b925a9..ac1eb83878 100644
--- a/epan/ipproto.h
+++ b/epan/ipproto.h
@@ -191,6 +191,6 @@
#define IP_PROTO_NCS_HEARTBEAT 224 /* Novell NCS Heartbeat - http://support.novell.com/cgi-bin/search/searchtid.cgi?/10071158.htm */
extern const value_string ipproto_val[];
-extern const char *ipprotostr(int proto);
+extern const char *ipprotostr(const int proto);
#endif /* ipproto.h */
diff --git a/epan/ipv4.c b/epan/ipv4.c
index 0472a5be3d..26ff676d30 100644
--- a/epan/ipv4.c
+++ b/epan/ipv4.c
@@ -53,19 +53,19 @@ ipv4_addr_free(ipv4_addr *ipv4)
}
void
-ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, guint32 new_addr)
+ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, const guint32 new_addr)
{
ipv4->addr = new_addr;
}
void
-ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, guint32 new_addr)
+ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, const guint32 new_addr)
{
ipv4->addr = g_ntohl(new_addr);
}
void
-ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, guint new_nmask_bits)
+ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, const guint new_nmask_bits)
{
static guint32 bitmasks[33] = {
0x00000000,
diff --git a/epan/ipv4.h b/epan/ipv4.h
index 39ff3de00d..2c05a9e048 100644
--- a/epan/ipv4.h
+++ b/epan/ipv4.h
@@ -42,9 +42,9 @@ ipv4_addr* ipv4_addr_new(void);
/* Frees an ipv4 struct */
void ipv4_addr_free(ipv4_addr *ipv4);
-void ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, guint32 new_addr);
-void ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, guint32 new_addr);
-void ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, guint new_nmask_bits);
+void ipv4_addr_set_host_order_addr(ipv4_addr *ipv4, const guint32 new_addr);
+void ipv4_addr_set_net_order_addr(ipv4_addr *ipv4, const guint32 new_addr);
+void ipv4_addr_set_netmask_bits(ipv4_addr *ipv4, const guint new_nmask_bits);
guint32 ipv4_get_net_order_addr(ipv4_addr *ipv4);
guint32 ipv4_get_host_order_addr(ipv4_addr *ipv4);
diff --git a/epan/packet.c b/epan/packet.c
index 7c43e70e96..ef7de2986d 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -81,7 +81,7 @@ packet_cleanup(void)
* of the tvbuff to reflect the specified length.
*/
void
-set_actual_length(tvbuff_t *tvb, guint specified_len)
+set_actual_length(tvbuff_t *tvb, const guint specified_len)
{
if (specified_len < tvb_reported_length(tvb)) {
/* Adjust the length of this tvbuff to include only the specified
@@ -361,7 +361,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
/*********************** code added for sub-dissector lookup *********************/
/*
- * An dissector handle.
+ * A dissector handle.
*/
struct dissector_handle {
const char *name; /* dissector name */
@@ -668,7 +668,7 @@ find_dissector_table(const char *name)
/* Find an entry in a uint dissector table. */
static dtbl_entry_t *
-find_uint_dtbl_entry(dissector_table_t sub_dissectors, guint32 pattern)
+find_uint_dtbl_entry(dissector_table_t sub_dissectors, const guint32 pattern)
{
switch (sub_dissectors->type) {
@@ -718,7 +718,7 @@ dissector_add_sanity_check(const char *name, guint32 pattern, dissector_handle_t
/* Add an entry to a uint dissector table. */
void
-dissector_add(const char *name, guint32 pattern, dissector_handle_t handle)
+dissector_add(const char *name, const guint32 pattern, dissector_handle_t handle)
{
dissector_table_t sub_dissectors;
dtbl_entry_t *dtbl_entry;
@@ -774,7 +774,7 @@ dissector_add(const char *name, guint32 pattern, dissector_handle_t handle)
/* If temporary dissectors are deleted, then the original dissector must */
/* be available. */
void
-dissector_delete(const char *name, guint32 pattern,
+dissector_delete(const char *name, const guint32 pattern,
dissector_handle_t handle _U_)
{
dissector_table_t sub_dissectors = find_dissector_table( name);
@@ -805,7 +805,7 @@ dissector_delete(const char *name, guint32 pattern,
/* Change the entry for a dissector in a uint dissector table
with a particular pattern to use a new dissector handle. */
void
-dissector_change(const char *name, guint32 pattern, dissector_handle_t handle)
+dissector_change(const char *name, const guint32 pattern, dissector_handle_t handle)
{
dissector_table_t sub_dissectors = find_dissector_table( name);
dtbl_entry_t *dtbl_entry;
@@ -841,7 +841,7 @@ dissector_change(const char *name, guint32 pattern, dissector_handle_t handle)
/* Reset an entry in a uint dissector table to its initial value. */
void
-dissector_reset(const char *name, guint32 pattern)
+dissector_reset(const char *name, const guint32 pattern)
{
dissector_table_t sub_dissectors = find_dissector_table( name);
dtbl_entry_t *dtbl_entry;
@@ -874,8 +874,8 @@ dissector_reset(const char *name, guint32 pattern)
otherwise return FALSE. */
gboolean
-dissector_try_port_new(dissector_table_t sub_dissectors, guint32 port,
- tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean add_proto_name)
+dissector_try_port_new(dissector_table_t sub_dissectors, const guint32 port,
+ tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name)
{
dtbl_entry_t *dtbl_entry;
struct dissector_handle *handle;
@@ -926,7 +926,7 @@ dissector_try_port_new(dissector_table_t sub_dissectors, guint32 port,
}
gboolean
-dissector_try_port(dissector_table_t sub_dissectors, guint32 port,
+dissector_try_port(dissector_table_t sub_dissectors, const guint32 port,
tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
@@ -935,7 +935,7 @@ dissector_try_port(dissector_table_t sub_dissectors, guint32 port,
/* Look for a given value in a given uint dissector table and, if found,
return the dissector handle for that value. */
dissector_handle_t
-dissector_get_port_handle(dissector_table_t sub_dissectors, guint32 port)
+dissector_get_port_handle(dissector_table_t const sub_dissectors, const guint32 port)
{
dtbl_entry_t *dtbl_entry;
@@ -948,7 +948,7 @@ dissector_get_port_handle(dissector_table_t sub_dissectors, guint32 port)
/* Find an entry in a string dissector table. */
static dtbl_entry_t *
-find_string_dtbl_entry(dissector_table_t sub_dissectors, const gchar *pattern)
+find_string_dtbl_entry(dissector_table_t const sub_dissectors, const gchar *pattern)
{
switch (sub_dissectors->type) {
@@ -1414,7 +1414,7 @@ typedef struct dissector_foreach_table_info {
* Called for each entry in the table of all dissector tables.
*/
static void
-dissector_all_tables_foreach_table_func (gpointer key, gpointer value, gpointer user_data)
+dissector_all_tables_foreach_table_func (gpointer key, const gpointer value, const gpointer user_data)
{
dissector_table_t table;
dissector_foreach_table_info_t *info;
@@ -1440,8 +1440,8 @@ dissector_all_tables_foreach_table (DATFunc_table func,
}
dissector_table_t
-register_dissector_table(const char *name, const char *ui_name, ftenum_t type,
- int base)
+register_dissector_table(const char *name, const char *ui_name, const ftenum_t type,
+ const int base)
{
dissector_table_t sub_dissectors;
@@ -1530,7 +1530,7 @@ find_heur_dissector_list(const char *name)
}
void
-heur_dissector_add(const char *name, heur_dissector_t dissector, int proto)
+heur_dissector_add(const char *name, heur_dissector_t dissector, const int proto)
{
heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name);
heur_dtbl_entry_t *dtbl_entry;
@@ -1555,7 +1555,7 @@ static int find_matching_heur_dissector( gconstpointer a, gconstpointer b) {
(dtbl_entry_a->protocol == dtbl_entry_b->protocol) ? 0 : 1;
}
-void heur_dissector_delete(const char *name, heur_dissector_t dissector, int proto) {
+void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto) {
heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name);
heur_dtbl_entry_t dtbl_entry;
GSList* found_entry;
@@ -1693,7 +1693,7 @@ static GHashTable *registered_dissectors = NULL;
/* Get the short name of the protocol for a dissector handle, if it has
a protocol. */
const char *
-dissector_handle_get_short_name(dissector_handle_t handle)
+dissector_handle_get_short_name(const dissector_handle_t handle)
{
if (handle->protocol == NULL) {
/*
@@ -1710,7 +1710,7 @@ dissector_handle_get_short_name(dissector_handle_t handle)
/* Get the index of the protocol for a dissector handle, if it has
a protocol. */
int
-dissector_handle_get_protocol_index(dissector_handle_t handle)
+dissector_handle_get_protocol_index(const dissector_handle_t handle)
{
if (handle->protocol == NULL) {
/*
@@ -1734,7 +1734,7 @@ find_dissector(const char *name)
/* Create an anonymous handle for a dissector. */
dissector_handle_t
-create_dissector_handle(dissector_t dissector, int proto)
+create_dissector_handle(dissector_t dissector, const int proto)
{
struct dissector_handle *handle;
@@ -1748,7 +1748,7 @@ create_dissector_handle(dissector_t dissector, int proto)
}
dissector_handle_t
-new_create_dissector_handle(new_dissector_t dissector, int proto)
+new_create_dissector_handle(new_dissector_t dissector, const int proto)
{
struct dissector_handle *handle;
@@ -1763,7 +1763,7 @@ new_create_dissector_handle(new_dissector_t dissector, int proto)
/* Register a dissector by name. */
void
-register_dissector(const char *name, dissector_t dissector, int proto)
+register_dissector(const char *name, dissector_t dissector, const int proto)
{
struct dissector_handle *handle;
@@ -1787,7 +1787,7 @@ register_dissector(const char *name, dissector_t dissector, int proto)
}
void
-new_register_dissector(const char *name, new_dissector_t dissector, int proto)
+new_register_dissector(const char *name, new_dissector_t dissector, const int proto)
{
struct dissector_handle *handle;
@@ -1861,7 +1861,7 @@ call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
static void
dissector_dump_decodes_display(const gchar *table_name,
- ftenum_t selector_type _U_, gpointer key, gpointer value,
+ ftenum_t selector_type _U_, const gpointer key, const gpointer value,
gpointer user_data _U_)
{
guint32 selector = (guint32)(unsigned long) key;
diff --git a/epan/packet.h b/epan/packet.h
index 853d114f0b..5aa87dee59 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -150,7 +150,7 @@ extern void dissector_all_tables_foreach_table (DATFunc_table func,
/* a protocol uses the function to register a sub-dissector table */
extern dissector_table_t register_dissector_table(const char *name,
- const char *ui_name, ftenum_t type, int base);
+ const char *ui_name, const ftenum_t type, const int base);
/* Find a dissector table by table name. */
extern dissector_table_t find_dissector_table(const char *name);
@@ -167,38 +167,38 @@ extern ftenum_t get_dissector_table_selector_type(const char *name);
extern int get_dissector_table_base(const char *name);
/* Add an entry to a uint dissector table. */
-extern void dissector_add(const char *abbrev, guint32 pattern,
+extern void dissector_add(const char *abbrev, const guint32 pattern,
dissector_handle_t handle);
/* Delete the entry for a dissector in a uint dissector table
with a particular pattern. */
-extern void dissector_delete(const char *name, guint32 pattern,
+extern void dissector_delete(const char *name, const guint32 pattern,
dissector_handle_t handle);
/* Change the entry for a dissector in a uint dissector table
with a particular pattern to use a new dissector handle. */
-extern void dissector_change(const char *abbrev, guint32 pattern,
+extern void dissector_change(const char *abbrev, const guint32 pattern,
dissector_handle_t handle);
/* Reset an entry in a uint dissector table to its initial value. */
-extern void dissector_reset(const char *name, guint32 pattern);
+extern void dissector_reset(const char *name, const guint32 pattern);
/* Look for a given value in a given uint dissector table and, if found,
call the dissector with the arguments supplied, and return TRUE,
otherwise return FALSE. */
extern gboolean dissector_try_port(dissector_table_t sub_dissectors,
- guint32 port, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+ const guint32 port, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Look for a given value in a given uint dissector table and, if found,
call the dissector with the arguments supplied, and return TRUE,
otherwise return FALSE. */
extern gboolean dissector_try_port_new(dissector_table_t sub_dissectors,
- guint32 port, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean add_proto_name);
+ const guint32 port, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name);
/* Look for a given value in a given uint dissector table and, if found,
return the dissector handle for that value. */
extern dissector_handle_t dissector_get_port_handle(
- dissector_table_t sub_dissectors, guint32 port);
+ dissector_table_t const sub_dissectors, const guint32 port);
/* Add an entry to a string dissector table. */
extern void dissector_add_string(const char *name, const gchar *pattern,
@@ -268,7 +268,7 @@ extern gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
* @param proto the protocol id of the sub-dissector
*/
extern void heur_dissector_add(const char *name, heur_dissector_t dissector,
- int proto);
+ const int proto);
/** Remove a sub-dissector from a heuristic dissector list.
* Call this in the prefs_reinit function of the sub-dissector.
@@ -277,28 +277,28 @@ extern void heur_dissector_add(const char *name, heur_dissector_t dissector,
* @param dissector the sub-dissector to be unregistered
* @param proto the protocol id of the sub-dissector
*/
-extern void heur_dissector_delete(const char *name, heur_dissector_t dissector, int proto);
+extern void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
/* Register a dissector. */
extern void register_dissector(const char *name, dissector_t dissector,
- int proto);
+ const int proto);
extern void new_register_dissector(const char *name, new_dissector_t dissector,
- int proto);
+ const int proto);
/* Get the short name of the protocol for a dissector handle. */
-extern const char *dissector_handle_get_short_name(dissector_handle_t handle);
+extern const char *dissector_handle_get_short_name(const dissector_handle_t handle);
/* Get the index of the protocol for a dissector handle. */
-extern int dissector_handle_get_protocol_index(dissector_handle_t handle);
+extern int dissector_handle_get_protocol_index(const dissector_handle_t handle);
/* Find a dissector by name. */
extern dissector_handle_t find_dissector(const char *name);
/* Create an anonymous handle for a dissector. */
extern dissector_handle_t create_dissector_handle(dissector_t dissector,
- int proto);
+ const int proto);
extern dissector_handle_t new_create_dissector_handle(new_dissector_t dissector,
- int proto);
+ const int proto);
/* Call a dissector through a handle and if no dissector was found
* pass if over to the "data" dissector instead.
@@ -339,7 +339,7 @@ extern void dissect_cleanup(void);
* Given a tvbuff, and a length from a packet header, adjust the length
* of the tvbuff to reflect the specified length.
*/
-extern void set_actual_length(tvbuff_t *tvb, guint specified_len);
+extern void set_actual_length(tvbuff_t *tvb, const guint specified_len);
/* Allow protocols to register "init" routines, which are called before
we make a pass through a capture file and dissect all its packets
diff --git a/epan/proto.c b/epan/proto.c
index a58b83195e..287bf73835 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -74,7 +74,7 @@ struct ptvcursor {
/* Candidates for assembler */
static int
-wrs_count_bitshift(guint32 bitmask)
+wrs_count_bitshift(const guint32 bitmask)
{
int bitshift = 0;
@@ -144,29 +144,29 @@ static void fill_label_bitfield(field_info *fi, gchar *label_str);
static void fill_label_int(field_info *fi, gchar *label_str);
static void fill_label_int64(field_info *fi, gchar *label_str);
-static const char* hfinfo_uint_vals_format(header_field_info *hfinfo);
-static const char* hfinfo_uint_format(header_field_info *hfinfo);
-static const char* hfinfo_uint_value_format(header_field_info *hfinfo);
-static const char* hfinfo_uint64_format(header_field_info *hfinfo);
-static const char* hfinfo_int_vals_format(header_field_info *hfinfo);
-static const char* hfinfo_int_format(header_field_info *hfinfo);
-static const char* hfinfo_int_value_format(header_field_info *hfinfo);
-static const char* hfinfo_int64_format(header_field_info *hfinfo);
+static const char* hfinfo_uint_vals_format(const header_field_info *hfinfo);
+static const char* hfinfo_uint_format(const header_field_info *hfinfo);
+static const char* hfinfo_uint_value_format(const header_field_info *hfinfo);
+static const char* hfinfo_uint64_format(const header_field_info *hfinfo);
+static const char* hfinfo_int_vals_format(const header_field_info *hfinfo);
+static const char* hfinfo_int_format(const header_field_info *hfinfo);
+static const char* hfinfo_int_value_format(const header_field_info *hfinfo);
+static const char* hfinfo_int64_format(const header_field_info *hfinfo);
static proto_item*
proto_tree_add_node(proto_tree *tree, field_info *fi);
static header_field_info *
-get_hfi_and_length(int hfindex, tvbuff_t *tvb, gint start, gint *length,
+get_hfi_and_length(int hfindex, tvbuff_t *tvb, const gint start, gint *length,
gint *item_length);
static field_info *
new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
- gint start, gint item_length);
+ const gint start, const gint item_length);
static field_info *
alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb,
- gint start, gint *length);
+ const gint start, gint *length);
static proto_item *
proto_tree_add_pi(proto_tree *tree, int hfindex, tvbuff_t *tvb,
@@ -226,10 +226,10 @@ proto_tree_set_uint64(field_info *fi, guint64 value);
static void
proto_tree_set_uint64_tvb(field_info *fi, tvbuff_t *tvb, gint start, guint length, gboolean little_endian);
static gboolean
-proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, int offset, int len, gint ett,
- const gint **fields, gboolean little_endian, int flags, gboolean first);
+proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset, const int len, const gint ett,
+ const gint **fields, const gboolean little_endian, const int flags, gboolean first);
-static int proto_register_field_init(header_field_info *hfinfo, int parent);
+static int proto_register_field_init(header_field_info *hfinfo, const int parent);
/* special-case header field used within proto.c */
int hf_text_only = -1;
@@ -1471,8 +1471,8 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
/* Add an item to a proto_tree, using the text label registered to that item;
the item is extracted from the tvbuff handed to it. */
proto_item *
-proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
- gint start, gint length, gboolean little_endian)
+proto_tree_add_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
+ const gint start, gint length, const gboolean little_endian)
{
field_info *new_fi;
header_field_info *hfinfo;
@@ -1490,7 +1490,7 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
/* Add a FT_NONE to a proto_tree */
proto_item *
-proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+proto_tree_add_none_format(proto_tree *tree, const int hfindex, tvbuff_t *tvb, const gint start,
gint length, const char *format, ...)
{
proto_item *pi;
@@ -3015,7 +3015,7 @@ proto_tree_add_pi(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
static header_field_info *
-get_hfi_and_length(int hfindex, tvbuff_t *tvb, gint start, gint *length,
+get_hfi_and_length(int hfindex, tvbuff_t *tvb, const gint start, gint *length,
gint *item_length)
{
header_field_info *hfinfo;
@@ -3150,7 +3150,7 @@ get_hfi_and_length(int hfindex, tvbuff_t *tvb, gint start, gint *length,
static field_info *
new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
- gint start, gint item_length)
+ const gint start, const gint item_length)
{
field_info *fi;
@@ -3177,7 +3177,7 @@ new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
}
static field_info *
-alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, const gint start,
gint *length)
{
header_field_info *hfinfo;
@@ -3282,9 +3282,9 @@ proto_tree_set_representation(proto_item *pi, const char *format, va_list ap)
/* -------------------------- */
const gchar *
-proto_custom_set(proto_tree* tree, int field_id,
+proto_custom_set(proto_tree* tree, const int field_id,
gchar *result,
- gchar *expr, int size )
+ gchar *expr, const int size )
{
guint32 u_integer;
gint32 integer;
@@ -3526,7 +3526,7 @@ proto_item_append_text(proto_item *pi, const char *format, ...)
}
void
-proto_item_set_len(proto_item *pi, gint length)
+proto_item_set_len(proto_item *pi, const gint length)
{
field_info *fi;
@@ -3569,7 +3569,7 @@ proto_item_set_end(proto_item *pi, tvbuff_t *tvb, gint end)
}
int
-proto_item_get_len(proto_item *pi)
+proto_item_get_len(const proto_item *pi)
{
field_info *fi = PITEM_FINFO(pi);
return fi ? fi->length : -1;
@@ -3583,7 +3583,7 @@ proto_item_get_len(proto_item *pi)
}
gboolean
-proto_item_set_expert_flags(proto_item *pi, int group, guint severity)
+proto_item_set_expert_flags(proto_item *pi, const int group, const guint severity)
{
if(pi == NULL || PITEM_FINFO(pi) == NULL)
return FALSE;
@@ -3632,7 +3632,7 @@ proto_tree_create_root(void)
/* "prime" a proto_tree with a single hfid that a dfilter
* is interested in. */
void
-proto_tree_prime_hfid(proto_tree *tree _U_, gint hfid)
+proto_tree_prime_hfid(proto_tree *tree _U_, const gint hfid)
{
header_field_info *hfinfo;
@@ -3658,7 +3658,7 @@ proto_tree_prime_hfid(proto_tree *tree _U_, gint hfid)
}
proto_tree*
-proto_item_add_subtree(proto_item *pi, gint idx) {
+proto_item_add_subtree(proto_item *pi, const gint idx) {
field_info *fi;
if (!pi)
@@ -3676,7 +3676,7 @@ proto_item_add_subtree(proto_item *pi, gint idx) {
}
proto_tree*
-proto_item_get_subtree(proto_item *pi) {
+proto_item_get_subtree(const proto_item *pi) {
field_info *fi;
if (!pi)
@@ -3688,7 +3688,7 @@ proto_item_get_subtree(proto_item *pi) {
}
proto_item*
-proto_item_get_parent(proto_item *ti) {
+proto_item_get_parent(const proto_item *ti) {
if (!ti)
return (NULL);
return ti->parent;
@@ -3708,7 +3708,7 @@ proto_item_get_parent_nth(proto_item *ti, int gen) {
proto_item*
-proto_tree_get_parent(proto_tree *tree) {
+proto_tree_get_parent(const proto_tree *tree) {
if (!tree)
return (NULL);
return (proto_item*) tree;
@@ -3771,7 +3771,7 @@ proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto_item *item_
}
void
-proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, gint length)
+proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, const gint length)
{
field_info *fi;
@@ -3890,7 +3890,7 @@ proto_register_protocol(const char *name, const char *short_name, const char *fi
}
void
-proto_mark_private(int proto_id)
+proto_mark_private(const int proto_id)
{
protocol_t *protocol = find_protocol_by_id(proto_id);
if (protocol)
@@ -3898,7 +3898,7 @@ proto_mark_private(int proto_id)
}
gboolean
-proto_is_private(int proto_id)
+proto_is_private(const int proto_id)
{
protocol_t *protocol = find_protocol_by_id(proto_id);
if (protocol)
@@ -3941,7 +3941,7 @@ proto_get_next_protocol(void **cookie)
}
header_field_info *
-proto_get_first_protocol_field(int proto_id, void **cookie)
+proto_get_first_protocol_field(const int proto_id, void **cookie)
{
protocol_t *protocol = find_protocol_by_id(proto_id);
hf_register_info *ptr;
@@ -3970,7 +3970,7 @@ proto_get_next_protocol_field(void **cookie)
}
protocol_t *
-find_protocol_by_id(int proto_id)
+find_protocol_by_id(const int proto_id)
{
header_field_info *hfinfo;
@@ -3992,7 +3992,7 @@ static gint compare_filter_name(gconstpointer proto_arg,
}
int
-proto_get_id(protocol_t *protocol)
+proto_get_id(const protocol_t *protocol)
{
return protocol->proto_id;
}
@@ -4012,7 +4012,7 @@ int proto_get_id_by_filter_name(const gchar* filter_name)
}
const char *
-proto_get_protocol_name(int proto_id)
+proto_get_protocol_name(const int proto_id)
{
protocol_t *protocol;
@@ -4021,7 +4021,7 @@ proto_get_protocol_name(int proto_id)
}
const char *
-proto_get_protocol_short_name(protocol_t *protocol)
+proto_get_protocol_short_name(const protocol_t *protocol)
{
if (protocol == NULL)
return "(none)";
@@ -4029,7 +4029,7 @@ proto_get_protocol_short_name(protocol_t *protocol)
}
const char *
-proto_get_protocol_long_name(protocol_t *protocol)
+proto_get_protocol_long_name(const protocol_t *protocol)
{
if (protocol == NULL)
return "(none)";
@@ -4037,7 +4037,7 @@ proto_get_protocol_long_name(protocol_t *protocol)
}
const char *
-proto_get_protocol_filter_name(int proto_id)
+proto_get_protocol_filter_name(const int proto_id)
{
protocol_t *protocol;
@@ -4048,13 +4048,13 @@ proto_get_protocol_filter_name(int proto_id)
}
gboolean
-proto_is_protocol_enabled(protocol_t *protocol)
+proto_is_protocol_enabled(const protocol_t *protocol)
{
return protocol->is_enabled;
}
gboolean
-proto_can_toggle_protocol(int proto_id)
+proto_can_toggle_protocol(const int proto_id)
{
protocol_t *protocol;
@@ -4063,7 +4063,7 @@ proto_can_toggle_protocol(int proto_id)
}
void
-proto_set_decoding(int proto_id, gboolean enabled)
+proto_set_decoding(const int proto_id, const gboolean enabled)
{
protocol_t *protocol;
@@ -4090,7 +4090,7 @@ proto_enable_all(void)
}
void
-proto_set_cant_toggle(int proto_id)
+proto_set_cant_toggle(const int proto_id)
{
protocol_t *protocol;
@@ -4101,7 +4101,7 @@ proto_set_cant_toggle(int proto_id)
/* for use with static arrays only, since we don't allocate our own copies
of the header_field_info struct contained within the hf_register_info struct */
void
-proto_register_field_array(int parent, hf_register_info *hf, int num_records)
+proto_register_field_array(const int parent, hf_register_info *hf, const int num_records)
{
int field_id, i;
hf_register_info *ptr = hf;
@@ -4244,7 +4244,7 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
}
static int
-proto_register_field_init(header_field_info *hfinfo, int parent)
+proto_register_field_init(header_field_info *hfinfo, const int parent)
{
tmp_fld_check_assert(hfinfo);
@@ -4324,7 +4324,7 @@ proto_register_field_init(header_field_info *hfinfo, int parent)
}
void
-proto_register_subtree_array(gint *const *indices, int num_indices)
+proto_register_subtree_array(gint *const *indices, const int num_indices)
{
int i;
gint *const *ptr = indices;
@@ -4786,7 +4786,7 @@ fill_label_int64(field_info *fi, gchar *label_str)
}
int
-hfinfo_bitwidth(header_field_info *hfinfo)
+hfinfo_bitwidth(const header_field_info *hfinfo)
{
int bitwidth = 0;
@@ -4822,7 +4822,7 @@ hfinfo_bitwidth(header_field_info *hfinfo)
}
static const char*
-hfinfo_uint_vals_format(header_field_info *hfinfo)
+hfinfo_uint_vals_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -4866,7 +4866,7 @@ hfinfo_uint_vals_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_uint_format(header_field_info *hfinfo)
+hfinfo_uint_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -4950,7 +4950,7 @@ hfinfo_uint_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_uint_value_format(header_field_info *hfinfo)
+hfinfo_uint_value_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5034,7 +5034,7 @@ hfinfo_uint_value_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_int_vals_format(header_field_info *hfinfo)
+hfinfo_int_vals_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5078,7 +5078,7 @@ hfinfo_int_vals_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_uint64_format(header_field_info *hfinfo)
+hfinfo_uint64_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5107,7 +5107,7 @@ hfinfo_uint64_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_int_format(header_field_info *hfinfo)
+hfinfo_int_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5184,7 +5184,7 @@ hfinfo_int_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_int_value_format(header_field_info *hfinfo)
+hfinfo_int_value_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5261,7 +5261,7 @@ hfinfo_int_value_format(header_field_info *hfinfo)
}
static const char*
-hfinfo_int64_format(header_field_info *hfinfo)
+hfinfo_int64_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -5296,7 +5296,7 @@ proto_registrar_n(void)
}
const char*
-proto_registrar_get_name(int n)
+proto_registrar_get_name(const int n)
{
header_field_info *hfinfo;
@@ -5305,7 +5305,7 @@ proto_registrar_get_name(int n)
}
const char*
-proto_registrar_get_abbrev(int n)
+proto_registrar_get_abbrev(const int n)
{
header_field_info *hfinfo;
@@ -5314,7 +5314,7 @@ proto_registrar_get_abbrev(int n)
}
int
-proto_registrar_get_ftype(int n)
+proto_registrar_get_ftype(const int n)
{
header_field_info *hfinfo;
@@ -5323,7 +5323,7 @@ proto_registrar_get_ftype(int n)
}
int
-proto_registrar_get_parent(int n)
+proto_registrar_get_parent(const int n)
{
header_field_info *hfinfo;
@@ -5332,7 +5332,7 @@ proto_registrar_get_parent(int n)
}
gboolean
-proto_registrar_is_protocol(int n)
+proto_registrar_is_protocol(const int n)
{
header_field_info *hfinfo;
@@ -5345,7 +5345,7 @@ proto_registrar_is_protocol(int n)
* 0 means undeterminable at time of registration
* -1 means the field is not registered. */
gint
-proto_registrar_get_length(int n)
+proto_registrar_get_length(const int n)
{
header_field_info *hfinfo;
@@ -5356,7 +5356,7 @@ proto_registrar_get_length(int n)
/* Looks for a protocol or a field in a proto_tree. Returns TRUE if
* it exists anywhere, or FALSE if it exists nowhere. */
gboolean
-proto_check_for_protocol_or_field(proto_tree* tree, int id)
+proto_check_for_protocol_or_field(const proto_tree* tree, const int id)
{
GPtrArray *ptrs = proto_get_finfo_ptr_array(tree, id);
@@ -5377,7 +5377,7 @@ proto_check_for_protocol_or_field(proto_tree* tree, int id)
* The caller should *not* free the GPtrArray*; proto_tree_free_node()
* handles that. */
GPtrArray*
-proto_get_finfo_ptr_array(proto_tree *tree, int id)
+proto_get_finfo_ptr_array(const proto_tree *tree, const int id)
{
if (!tree)
return NULL;
@@ -5390,7 +5390,7 @@ proto_get_finfo_ptr_array(proto_tree *tree, int id)
}
gboolean
-proto_tracking_interesting_fields(proto_tree *tree)
+proto_tracking_interesting_fields(const proto_tree *tree)
{
if (!tree)
return FALSE;
@@ -5426,7 +5426,7 @@ find_finfo(proto_node *node, gpointer data)
* g_ptr_array_free(<array>, TRUE).
*/
GPtrArray*
-proto_find_finfo(proto_tree *tree, int id)
+proto_find_finfo(proto_tree *tree, const int id)
{
ffdata_t ffdata;
@@ -5473,7 +5473,7 @@ typedef struct {
} offset_search_t;
static gboolean
-check_for_offset(proto_node *node, gpointer data)
+check_for_offset(proto_node *node, const gpointer data)
{
field_info *fi = PNODE_FINFO(node);
offset_search_t *offsearch = data;
@@ -5728,7 +5728,7 @@ proto_registrar_dump_values(void)
* Field 8 = bitmask: format: hex: 0x....
*/
void
-proto_registrar_dump_fields(int format)
+proto_registrar_dump_fields(const int format)
{
header_field_info *hfinfo, *parent_hfinfo;
int i, len;
@@ -5848,7 +5848,7 @@ proto_registrar_dump_fields(int format)
}
static const char*
-hfinfo_numeric_format(header_field_info *hfinfo)
+hfinfo_numeric_format(const header_field_info *hfinfo)
{
const char *format = NULL;
@@ -6188,8 +6188,8 @@ proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt)
* proto_tree_add_bitmask_text() functions.
*/
static gboolean
-proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, int offset, int len, gint ett,
- const int **fields, gboolean little_endian, int flags, gboolean first)
+proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset, const int len, const gint ett,
+ const int **fields, const gboolean little_endian, const int flags, gboolean first)
{
guint32 value = 0, tmpval;
proto_tree *tree = NULL;
@@ -6324,8 +6324,8 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, int offset, int len
* matched string displayed on the expansion line.
*/
proto_item *
-proto_tree_add_bitmask(proto_tree *parent_tree, tvbuff_t *tvb, guint offset, int hf_hdr,
- gint ett, const int **fields, gboolean little_endian)
+proto_tree_add_bitmask(proto_tree *parent_tree, tvbuff_t *tvb, const guint offset, const int hf_hdr,
+ const gint ett, const int **fields, const gboolean little_endian)
{
proto_item *item = NULL;
header_field_info *hf;
@@ -6346,9 +6346,9 @@ proto_tree_add_bitmask(proto_tree *parent_tree, tvbuff_t *tvb, guint offset, int
/* The same as proto_tree_add_bitmask(), but using an arbitrary text as a top-level item */
proto_item *
-proto_tree_add_bitmask_text(proto_tree *parent_tree, tvbuff_t *tvb, guint offset, guint len,
+proto_tree_add_bitmask_text(proto_tree *parent_tree, tvbuff_t *tvb, const guint offset, const guint len,
const char *name, const char *fallback,
- gint ett, const int **fields, gboolean little_endian, int flags)
+ const gint ett, const int **fields, const gboolean little_endian, const int flags)
{
proto_item *item = NULL;
@@ -6365,7 +6365,7 @@ proto_tree_add_bitmask_text(proto_tree *parent_tree, tvbuff_t *tvb, guint offset
}
proto_item *
-proto_tree_add_bits_item(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian)
+proto_tree_add_bits_item(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, const gboolean little_endian)
{
header_field_info *hfinfo;
@@ -6381,7 +6381,7 @@ proto_tree_add_bits_item(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit
*/
proto_item *
-proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits, guint64 *return_value, gboolean little_endian)
+proto_tree_add_bits_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, guint64 *return_value, const gboolean little_endian)
{
const char *format = NULL;
gint offset;
@@ -6497,7 +6497,7 @@ proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint
}
proto_item *
-proto_tree_add_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits, void *value_ptr, gchar *value_str)
+proto_tree_add_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, void *value_ptr, gchar *value_str)
{
gint offset;
guint length;
@@ -6599,7 +6599,7 @@ proto_tree_add_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb,
va_end(ap);
proto_item *
-proto_tree_add_uint_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...)
{
va_list ap;
@@ -6627,7 +6627,7 @@ proto_tree_add_uint_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *
}
proto_item *
-proto_tree_add_float_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_float_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
float value, const char *format, ...)
{
va_list ap;
@@ -6644,7 +6644,7 @@ proto_tree_add_float_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t
}
proto_item *
-proto_tree_add_int_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_int_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
gint32 value, const char *format, ...)
{
va_list ap;
@@ -6672,7 +6672,7 @@ proto_tree_add_int_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *t
}
proto_item *
-proto_tree_add_boolean_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...)
{
va_list ap;
diff --git a/epan/proto.h b/epan/proto.h
index 3677ebe492..304494bc5a 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -413,17 +413,17 @@ extern gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
@param ti the parent item of the new subtree
@param idx one of the ett_ array elements registered with proto_register_subtree_array()
@return the new subtree */
-extern proto_tree* proto_item_add_subtree(proto_item *ti, gint idx);
+extern proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx);
/** Get an existing subtree under an item.
@param ti the parent item of the subtree
@return the subtree or NULL */
-extern proto_tree* proto_item_get_subtree(proto_item *ti);
+extern proto_tree* proto_item_get_subtree(const proto_item *ti);
/** Get the parent of a subtree item.
@param ti the child item in the subtree
@return parent item or NULL */
-extern proto_item* proto_item_get_parent(proto_item *ti);
+extern proto_item* proto_item_get_parent(const proto_item *ti);
/** Get Nth generation parent item.
@param ti the child item in the subtree
@@ -448,7 +448,7 @@ extern void proto_item_append_text(proto_item *ti, const char *format, ...)
/** Set proto_item's length inside tvb, after it has already been created.
@param ti the item to set the length
@param length the new length ot the item */
-extern void proto_item_set_len(proto_item *ti, gint length);
+extern void proto_item_set_len(proto_item *ti, const gint length);
/**
* Sets the length of the item based on its start and on the specified
@@ -466,7 +466,7 @@ extern void proto_item_set_end(proto_item *ti, tvbuff_t *tvb, gint end);
* to add a variable-length field (e.g., FT_NSTRING_UINT8).
@param ti the item to get the length from
@return the current length */
-extern int proto_item_get_len(proto_item *ti);
+extern int proto_item_get_len(const proto_item *ti);
/**
* Sets an expert info to the proto_item.
@@ -475,7 +475,7 @@ extern int proto_item_get_len(proto_item *ti);
@param severity of this info (e.g. PI_ERROR)
@return TRUE if value was written
*/
-extern gboolean proto_item_set_expert_flags(proto_item *ti, int group, guint severity);
+extern gboolean proto_item_set_expert_flags(proto_item *ti, const int group, const guint severity);
@@ -509,12 +509,12 @@ proto_tree_set_fake_protocols(proto_tree *tree, gboolean fake_protocols);
@param hfid the interesting field id
@todo what *does* interesting mean? */
extern void
-proto_tree_prime_hfid(proto_tree *tree, int hfid);
+proto_tree_prime_hfid(proto_tree *tree, const int hfid);
/** Get a parent item of a subtree.
@param tree the tree to get the parent from
@return parent item */
-extern proto_item* proto_tree_get_parent(proto_tree *tree);
+extern proto_item* proto_tree_get_parent(const proto_tree *tree);
/** Get the root tree from any subtree.
@param tree the tree to get the root from
@@ -533,7 +533,7 @@ extern void proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto
@param tvb the tv buffer of the current data
@param start the start offset of the appendix
@param length the length of the appendix */
-extern void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
+extern void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, const gint length);
/** Add an item to a proto_tree, using the text label registered to that item.
@@ -546,8 +546,8 @@ extern void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start,
@param little_endian big or little endian byte representation
@return the newly created item */
extern proto_item *
-proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
- gint start, gint length, gboolean little_endian);
+proto_tree_add_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
+ const gint start, gint length, const gboolean little_endian);
/** Add a text-only node to a proto_tree.
@param tree the tree to append this item to
@@ -584,7 +584,7 @@ proto_tree_add_text_valist(proto_tree *tree, tvbuff_t *tvb, gint start,
@param ... printf like parameters
@return the newly created item */
extern proto_item *
-proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+proto_tree_add_none_format(proto_tree *tree, const int hfindex, tvbuff_t *tvb, const gint start,
gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
/** Add a FT_PROTOCOL to a proto_tree.
@@ -1360,13 +1360,13 @@ proto_register_protocol(const char *name, const char *short_name, const char *fi
/** Mark protocol as private
@param proto_id the handle of the protocol */
extern void
-proto_mark_private(int proto_id);
+proto_mark_private(const int proto_id);
/** Return if protocol is private
@param proto_id the handle of the protocol
@return TRUE if it is a private protocol, FALSE is not. */
extern gboolean
-proto_is_private(int proto_id);
+proto_is_private(const int proto_id);
/** This is the type of function can be registered to get called whenever
a given field was not found but a its prefix is matched
@@ -1388,13 +1388,13 @@ extern void proto_initialize_all_prefixes(void);
@param hf the hf_register_info array
@param num_records the number of records in hf */
extern void
-proto_register_field_array(int parent, hf_register_info *hf, int num_records);
+proto_register_field_array(const int parent, hf_register_info *hf, const int num_records);
/** Register a protocol subtree (ett) array.
@param indices array of ett indices
@param num_indices the number of records in indices */
extern void
-proto_register_subtree_array(gint *const *indices, int num_indices);
+proto_register_subtree_array(gint *const *indices, const int num_indices);
/** Returns number of items (protocols or header fields) registered.
@return the number of items */
@@ -1403,12 +1403,12 @@ extern int proto_registrar_n(void);
/** Get name of registered header_field number n.
@param n item # n (0-indexed)
@return the name of this registered item */
-extern const char* proto_registrar_get_name(int n);
+extern const char* proto_registrar_get_name(const int n);
/** Get abbreviation of registered header_field number n.
@param n item # n (0-indexed)
@return the abbreviation of this registered item */
-extern const char* proto_registrar_get_abbrev(int n);
+extern const char* proto_registrar_get_abbrev(const int n);
/** Get the header_field information based upon a field or protocol id.
@param hfindex item # n (0-indexed)
@@ -1423,22 +1423,22 @@ extern header_field_info* proto_registrar_get_byname(const char *field_name);
/** Get enum ftenum FT_ of registered header_field number n.
@param n item # n (0-indexed)
@return the registered item */
-extern int proto_registrar_get_ftype(int n);
+extern int proto_registrar_get_ftype(const int n);
/** Get parent protocol of registered header_field number n.
@param n item # n (0-indexed)
@return -1 if item _is_ a protocol */
-extern int proto_registrar_get_parent(int n);
+extern int proto_registrar_get_parent(const int n);
/** Is item # n a protocol?
@param n item # n (0-indexed)
@return TRUE if it's a protocol, FALSE if it's not */
-extern gboolean proto_registrar_is_protocol(int n);
+extern gboolean proto_registrar_is_protocol(const int n);
/** Get length of registered field according to field type.
@param n item # n (0-indexed)
@return 0 means undeterminable at registration time, -1 means unknown field */
-extern gint proto_registrar_get_length(int n);
+extern gint proto_registrar_get_length(const int n);
/** Routines to use to iterate over the protocols and their fields;
@@ -1446,7 +1446,7 @@ extern gint proto_registrar_get_length(int n);
* appropriate hfinfo pointer, and keep state in "*cookie". */
extern int proto_get_first_protocol(void **cookie);
extern int proto_get_next_protocol(void **cookie);
-extern header_field_info *proto_get_first_protocol_field(int proto_id, void **cookle);
+extern header_field_info *proto_get_first_protocol_field(const int proto_id, void **cookle);
extern header_field_info *proto_get_next_protocol_field(void **cookle);
/** Given a protocol's filter_name.
@@ -1457,70 +1457,70 @@ extern int proto_get_id_by_filter_name(const gchar* filter_name);
/** Can item # n decoding be disabled?
@param proto_id protocol id (0-indexed)
@return TRUE if it's a protocol, FALSE if it's not */
-extern gboolean proto_can_toggle_protocol(int proto_id);
+extern gboolean proto_can_toggle_protocol(const int proto_id);
/** Get the "protocol_t" structure for the given protocol's item number.
@param proto_id protocol id (0-indexed) */
-extern protocol_t *find_protocol_by_id(int proto_id);
+extern protocol_t *find_protocol_by_id(const int proto_id);
/** Get the protocol's name for the given protocol's item number.
@param proto_id protocol id (0-indexed)
@return its name */
-extern const char *proto_get_protocol_name(int proto_id);
+extern const char *proto_get_protocol_name(const int proto_id);
/** Get the protocol's item number, for the given protocol's "protocol_t".
@return its proto_id */
-extern int proto_get_id(protocol_t *protocol);
+extern int proto_get_id(const protocol_t *protocol);
/** Get the protocol's short name, for the given protocol's "protocol_t".
@return its short name. */
-extern const char *proto_get_protocol_short_name(protocol_t *protocol);
+extern const char *proto_get_protocol_short_name(const protocol_t *protocol);
/** Get the protocol's long name, for the given protocol's "protocol_t".
@return its long name. */
-extern const char *proto_get_protocol_long_name(protocol_t *protocol);
+extern const char *proto_get_protocol_long_name(const protocol_t *protocol);
/** Is protocol's decoding enabled ?
@param protocol
@return TRUE if decoding is enabled, FALSE if not */
-extern gboolean proto_is_protocol_enabled(protocol_t *protocol);
+extern gboolean proto_is_protocol_enabled(const protocol_t *protocol);
/** Get a protocol's filter name by it's item number.
@param proto_id protocol id (0-indexed)
@return its filter name. */
-extern const char *proto_get_protocol_filter_name(int proto_id);
+extern const char *proto_get_protocol_filter_name(const int proto_id);
/** Enable / Disable protocol of the given item number.
@param proto_id protocol id (0-indexed)
@param enabled enable / disable the protocol */
-extern void proto_set_decoding(int proto_id, gboolean enabled);
+extern void proto_set_decoding(const int proto_id, const gboolean enabled);
/** Enable all protocols */
extern void proto_enable_all(void);
/** Disable disabling/enabling of protocol of the given item number.
@param proto_id protocol id (0-indexed) */
-extern void proto_set_cant_toggle(int proto_id);
+extern void proto_set_cant_toggle(const int proto_id);
/** Checks for existence any protocol or field within a tree.
@param tree "Protocols" are assumed to be a child of the [empty] root node.
@param id hfindex of protocol or field
@return TRUE = found, FALSE = not found
@todo add explanation of id parameter */
-extern gboolean proto_check_for_protocol_or_field(proto_tree* tree, int id);
+extern gboolean proto_check_for_protocol_or_field(const proto_tree* tree, const int id);
/** Return GPtrArray* of field_info pointers for all hfindex that appear in
tree. Only works with primed trees, and is fast.
@param tree tree of interest
@param hfindex primed hfindex
@return GPtrArry pointer */
-extern GPtrArray* proto_get_finfo_ptr_array(proto_tree *tree, int hfindex);
+extern GPtrArray* proto_get_finfo_ptr_array(const proto_tree *tree, const int hfindex);
/** Return whether we're tracking any interesting fields.
Only works with primed trees, and is fast.
@param tree tree of interest
@return TRUE if we're tracking interesting fields */
-extern gboolean proto_tracking_interesting_fields(proto_tree *tree);
+extern gboolean proto_tracking_interesting_fields(const proto_tree *tree);
/** Return GPtrArray* of field_info pointers for all hfindex that appear in
tree. Works with any tree, primed or unprimed, and is slower than
@@ -1528,7 +1528,7 @@ extern gboolean proto_tracking_interesting_fields(proto_tree *tree);
@param tree tree of interest
@param hfidex index of field info of interest
@return GPtrArry pointer */
-extern GPtrArray* proto_find_finfo(proto_tree *tree, int hfindex);
+extern GPtrArray* proto_find_finfo(proto_tree *tree, const int hfindex);
/** Return GPtrArray* of field_info pointers containg all hfindexes that appear
in tree.
@@ -1545,7 +1545,7 @@ extern void proto_registrar_dump_values(void);
/** Dumps a glossary of the protocol and field registrations to STDOUT.
* Format 1 is the original format. Format 2 includes the base (for integers)
* and the blurb. */
-extern void proto_registrar_dump_fields(int format);
+extern void proto_registrar_dump_fields(const int format);
@@ -1568,7 +1568,7 @@ WS_VAR_IMPORT int num_tree_types;
@param hfinfo header_field
@return the bitwidth */
extern int
-hfinfo_bitwidth(header_field_info *hfinfo);
+hfinfo_bitwidth(const header_field_info *hfinfo);
@@ -1616,8 +1616,8 @@ proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
@param little_endian big or little endian byte representation
@return the newly created item */
extern proto_item *
-proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, guint offset,
- int hf_hdr, gint ett, const int **fields, gboolean little_endian);
+proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, const guint offset,
+ const int hf_hdr, const gint ett, const int **fields, const gboolean little_endian);
/** Add a text with a subtree of bitfields.
@param tree the tree to append this item to
@@ -1630,9 +1630,9 @@ proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, guint offset,
@param little_endian big or little endian byte representation
@return the newly created item */
extern proto_item *
-proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, guint offset, guint len,
+proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
const char *name, const char *fallback,
- gint ett, const int **fields, gboolean little_endian, int flags);
+ const gint ett, const int **fields, const gboolean little_endian, const int flags);
#define BMT_NO_APPEND 0x01 /**< Don't change the title at all */
#define BMT_NO_INT 0x02 /**< Don't add integral (non-boolean) fields to title */
@@ -1649,7 +1649,7 @@ proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, guint offset, guint
@param little_endian big or little endian byte representation
@return the newly created item */
extern proto_item *
-proto_tree_add_bits_item(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian);
+proto_tree_add_bits_item(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, const gboolean little_endian);
/** Add bits to a proto_tree, using the text label registered to that item.
The item is extracted from the tvbuff handed to it.
@@ -1662,7 +1662,7 @@ proto_tree_add_bits_item(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit
@param little_endian big or little endian byte representation
@return the newly created item */
extern proto_item *
-proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits, guint64 *return_value, gboolean little_endian);
+proto_tree_add_bits_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, guint64 *return_value, const gboolean little_endian);
/** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
header field to a proto_tree, with the format generating the
@@ -1677,7 +1677,7 @@ proto_tree_add_bits_ret_val(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint
@param ... printf like parameters
@return the newly created item */
extern proto_item *
-proto_tree_add_uint_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_BOOLEAN header field to a proto_tree, with
@@ -1693,7 +1693,7 @@ proto_tree_add_uint_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *
@param ... printf like parameters
@return the newly created item */
extern proto_item *
-proto_tree_add_boolean_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
@@ -1709,7 +1709,7 @@ proto_tree_add_boolean_bits_format_value(proto_tree *tree, int hf_index, tvbuff_
@param ... printf like parameters
@return the newly created item */
extern proto_item *
-proto_tree_add_int_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_int_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_FLOAT header field to a proto_tree, with
@@ -1725,7 +1725,7 @@ proto_tree_add_int_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *t
@param ... printf like parameters
@return the newly created item */
extern proto_item *
-proto_tree_add_float_bits_format_value(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint bit_offset, gint no_of_bits,
+proto_tree_add_float_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
float value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Check if given string is a valid field name
@@ -1741,9 +1741,9 @@ proto_check_field_name(const gchar *field_name);
@param expr the filter expression
@param aize the size of the string buffer */
const gchar *
-proto_custom_set(proto_tree* tree, int field_id,
+proto_custom_set(proto_tree* tree, const int field_id,
gchar *result,
- gchar *expr, int size );
+ gchar *expr, const int size );
#ifdef __cplusplus
}
diff --git a/epan/reassemble.c b/epan/reassemble.c
index 851c5c7572..d4aba9df24 100644
--- a/epan/reassemble.c
+++ b/epan/reassemble.c
@@ -246,7 +246,7 @@ free_all_fragments(gpointer key_arg, gpointer value, gpointer user_data _U_)
}
/* ------------------------- */
-static fragment_data *new_head(guint32 flags)
+static fragment_data *new_head(const guint32 flags)
{
fragment_data *fd_head;
/* If head/first structure in list only holds no other data than
@@ -413,7 +413,7 @@ reassemble_init(void)
* g_free() that buffer.
*/
unsigned char *
-fragment_delete(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
+fragment_delete(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table)
{
fragment_data *fd_head, *fd;
fragment_key key;
@@ -460,7 +460,7 @@ fragment_delete(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
* matching this packet. I.e. Is there reassembly going on or not for this packet?
*/
fragment_data *
-fragment_get(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
+fragment_get(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table)
{
fragment_data *fd_head;
fragment_key key;
@@ -477,7 +477,7 @@ fragment_get(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
/* id *must* be the frame number for this to work! */
fragment_data *
-fragment_get_reassembled(packet_info *pinfo _U_, guint32 id, GHashTable *reassembled_table)
+fragment_get_reassembled(const guint32 id, GHashTable *reassembled_table)
{
fragment_data *fd_head;
reassembled_key key;
@@ -491,7 +491,7 @@ fragment_get_reassembled(packet_info *pinfo _U_, guint32 id, GHashTable *reassem
}
fragment_data *
-fragment_get_reassembled_id(packet_info *pinfo, guint32 id, GHashTable *reassembled_table)
+fragment_get_reassembled_id(const packet_info *pinfo, const guint32 id, GHashTable *reassembled_table)
{
fragment_data *fd_head;
reassembled_key key;
@@ -519,8 +519,8 @@ fragment_get_reassembled_id(packet_info *pinfo, guint32 id, GHashTable *reassemb
* actually means we want to defragment 3 blocks, block 0, 1 and 2.
*/
void
-fragment_set_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- guint32 tot_len)
+fragment_set_tot_len(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ const guint32 tot_len)
{
fragment_data *fd_head;
fragment_key key;
@@ -541,7 +541,7 @@ fragment_set_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
}
guint32
-fragment_get_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
+fragment_get_tot_len(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table)
{
fragment_data *fd_head;
fragment_key key;
@@ -570,7 +570,7 @@ fragment_get_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
*/
void
-fragment_set_partial_reassembly(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
+fragment_set_partial_reassembly(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table)
{
fragment_data *fd_head;
fragment_key key;
@@ -634,8 +634,8 @@ fragment_unhash(GHashTable *fragment_table, fragment_key *key)
* frame number.
*/
static void
-fragment_reassembled(fragment_data *fd_head, packet_info *pinfo,
- GHashTable *reassembled_table, guint32 id)
+fragment_reassembled(fragment_data *fd_head, const packet_info *pinfo,
+ GHashTable *reassembled_table, const guint32 id)
{
reassembled_key *new_key;
fragment_data *fd;
@@ -687,9 +687,9 @@ fragment_reassembled(fragment_data *fd_head, packet_info *pinfo,
* are lowered when a new extension process is started.
*/
static gboolean
-fragment_add_work(fragment_data *fd_head, tvbuff_t *tvb, int offset,
- packet_info *pinfo, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags)
+fragment_add_work(fragment_data *fd_head, tvbuff_t *tvb, const int offset,
+ const packet_info *pinfo, const guint32 frag_offset,
+ const guint32 frag_data_len, const gboolean more_frags)
{
fragment_data *fd;
fragment_data *fd_i;
@@ -914,10 +914,10 @@ fragment_add_work(fragment_data *fd_head, tvbuff_t *tvb, int offset,
}
static fragment_data *
-fragment_add_common(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
- GHashTable *fragment_table, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags,
- gboolean check_already_added)
+fragment_add_common(tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id,
+ GHashTable *fragment_table, const guint32 frag_offset,
+ const guint32 frag_data_len, const gboolean more_frags,
+ const gboolean check_already_added)
{
fragment_key key, *new_key;
fragment_data *fd_head;
@@ -1028,9 +1028,9 @@ fragment_add_common(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
}
fragment_data *
-fragment_add(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
- GHashTable *fragment_table, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags)
+fragment_add(tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id,
+ GHashTable *fragment_table, const guint32 frag_offset,
+ const guint32 frag_data_len, const gboolean more_frags)
{
return fragment_add_common(tvb, offset, pinfo, id, fragment_table,
frag_offset, frag_data_len, more_frags, TRUE);
@@ -1041,20 +1041,20 @@ fragment_add(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
* to the same reassembled PDU, e.g. with ONC RPC-over-TCP.
*/
fragment_data *
-fragment_add_multiple_ok(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table,
- guint32 frag_offset, guint32 frag_data_len,
- gboolean more_frags)
+fragment_add_multiple_ok(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table,
+ const guint32 frag_offset, const guint32 frag_data_len,
+ const gboolean more_frags)
{
return fragment_add_common(tvb, offset, pinfo, id, fragment_table,
frag_offset, frag_data_len, more_frags, FALSE);
}
fragment_data *
-fragment_add_check(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table,
- GHashTable *reassembled_table, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags)
+fragment_add_check(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table,
+ GHashTable *reassembled_table, const guint32 frag_offset,
+ const guint32 frag_data_len, const gboolean more_frags)
{
reassembled_key reass_key;
fragment_key key, *new_key, *old_key;
@@ -1145,7 +1145,7 @@ fragment_add_check(tvbuff_t *tvb, int offset, packet_info *pinfo,
static void
fragment_defragment_and_free (fragment_data *fd_head, fragment_data *fd,
- packet_info *pinfo)
+ const packet_info *pinfo)
{
fragment_data *fd_i = NULL;
fragment_data *last_fd = NULL;
@@ -1216,10 +1216,10 @@ fragment_defragment_and_free (fragment_data *fd_head, fragment_data *fd,
* The bsn for the first block is 0.
*/
static gboolean
-fragment_add_seq_work(fragment_data *fd_head, tvbuff_t *tvb, int offset,
- packet_info *pinfo, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags,
- guint32 flags _U_)
+fragment_add_seq_work(fragment_data *fd_head, tvbuff_t *tvb, const int offset,
+ const packet_info *pinfo, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags,
+ const guint32 flags _U_)
{
fragment_data *fd;
fragment_data *fd_i;
@@ -1451,9 +1451,9 @@ fragment_add_seq_work(fragment_data *fd_head, tvbuff_t *tvb, int offset,
* The bsn for the first block is 0.
*/
fragment_data *
-fragment_add_seq(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
- GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags)
+fragment_add_seq(tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id,
+ GHashTable *fragment_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags)
{
fragment_key key;
@@ -1470,10 +1470,10 @@ fragment_add_seq(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
fragment_data *
-fragment_add_dcerpc_dg(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
+fragment_add_dcerpc_dg(tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id,
void *v_act_id,
- GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags)
+ GHashTable *fragment_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags)
{
e_uuid_t *act_id = (e_uuid_t *)v_act_id;
dcerpc_fragment_key key;
@@ -1491,11 +1491,11 @@ fragment_add_dcerpc_dg(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id
}
fragment_data *
-fragment_add_seq_key(tvbuff_t *tvb, int offset, packet_info *pinfo,
+fragment_add_seq_key(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
void *key, fragment_key_copier key_copier,
GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags,
- guint32 flags)
+ const guint32 frag_data_len, const gboolean more_frags,
+ const guint32 flags)
{
fragment_data *fd_head;
fd_head = g_hash_table_lookup(fragment_table, key);
@@ -1645,11 +1645,11 @@ fragment_add_seq_key(tvbuff_t *tvb, int offset, packet_info *pinfo,
* XXX - Should we simply return NULL for zero-length fragments?
*/
static fragment_data *
-fragment_add_seq_check_work(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table,
- GHashTable *reassembled_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags,
- guint32 flags)
+fragment_add_seq_check_work(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table,
+ GHashTable *reassembled_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags,
+ const guint32 flags)
{
reassembled_key reass_key;
fragment_key key;
@@ -1713,10 +1713,10 @@ fragment_add_seq_check_work(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
fragment_data *
-fragment_add_seq_check(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table,
- GHashTable *reassembled_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags)
+fragment_add_seq_check(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table,
+ GHashTable *reassembled_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags)
{
return fragment_add_seq_check_work(tvb, offset, pinfo, id,
fragment_table, reassembled_table, frag_number, frag_data_len,
@@ -1746,8 +1746,8 @@ fragment_add_seq_next(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
void
-fragment_start_seq_check(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- guint32 tot_len)
+fragment_start_seq_check(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ const guint32 tot_len)
{
fragment_key key, *new_key;
fragment_data *fd_head;
@@ -1790,7 +1790,7 @@ fragment_start_seq_check(packet_info *pinfo, guint32 id, GHashTable *fragment_ta
}
fragment_data *
-fragment_end_seq_next(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
+fragment_end_seq_next(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
GHashTable *reassembled_table)
{
reassembled_key reass_key;
@@ -1869,7 +1869,7 @@ fragment_end_seq_next(packet_info *pinfo, guint32 id, GHashTable *fragment_table
* just put a "reassembled in" item into the protocol tree.
*/
tvbuff_t *
-process_reassembled_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
+process_reassembled_data(tvbuff_t *tvb, const int offset, packet_info *pinfo,
const char *name, fragment_data *fd_head, const fragment_items *fit,
gboolean *update_col_infop, proto_tree *tree)
{
@@ -1953,8 +1953,8 @@ process_reassembled_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
* it in the top-level item for that subtree.
*/
static void
-show_fragment(fragment_data *fd, int offset, const fragment_items *fit,
- proto_tree *ft, proto_item *fi, gboolean first_frag, tvbuff_t *tvb)
+show_fragment(fragment_data *fd, const int offset, const fragment_items *fit,
+ proto_tree *ft, proto_item *fi, const gboolean first_frag, tvbuff_t *tvb)
{
proto_item *fei=NULL;
int hf;
diff --git a/epan/reassemble.h b/epan/reassemble.h
index 60232c4b88..b67a86b294 100644
--- a/epan/reassemble.h
+++ b/epan/reassemble.h
@@ -132,12 +132,12 @@ void reassemble_init(void);
* Returns a pointer to the head of the fragment data list if we have all the
* fragments, NULL otherwise.
*/
-extern fragment_data *fragment_add(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags);
-extern fragment_data *fragment_add_multiple_ok(tvbuff_t *tvb, int offset,
- packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- guint32 frag_offset, guint32 frag_data_len, gboolean more_frags);
+extern fragment_data *fragment_add(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table, const guint32 frag_offset,
+ guint32 const frag_data_len, const gboolean more_frags);
+extern fragment_data *fragment_add_multiple_ok(tvbuff_t *tvb, const int offset,
+ const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ const guint32 frag_offset, const guint32 frag_data_len, const gboolean more_frags);
/*
* This routine extends fragment_add to use a "reassembled_table".
@@ -147,10 +147,10 @@ extern fragment_data *fragment_add_multiple_ok(tvbuff_t *tvb, int offset,
* to the table of reassembled fragments, and return a pointer to the
* head of the fragment list.
*/
-extern fragment_data *fragment_add_check(tvbuff_t *tvb, int offset,
- packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- GHashTable *reassembled_table, guint32 frag_offset,
- guint32 frag_data_len, gboolean more_frags);
+extern fragment_data *fragment_add_check(tvbuff_t *tvb, const int offset,
+ const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ GHashTable *reassembled_table, const guint32 frag_offset,
+ const guint32 frag_data_len, const gboolean more_frags);
/* same as fragment_add() but this one assumes frag_number is a block
sequence number. note that frag_number is 0 for the first fragment. */
@@ -186,24 +186,24 @@ extern fragment_data *fragment_add_check(tvbuff_t *tvb, int offset,
* inserting a new entry to the hash.
*/
extern fragment_data *
-fragment_add_seq_key(tvbuff_t *tvb, int offset, packet_info *pinfo,
+fragment_add_seq_key(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
void *key, fragment_key_copier key_copier,
GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags,
- guint32 flags);
+ const guint32 frag_data_len, const gboolean more_frags,
+ const guint32 flags);
/* a wrapper for fragment_add_seq_key - uses a key of source, dest and id */
-extern fragment_data *fragment_add_seq(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags);
+extern fragment_data *fragment_add_seq(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags);
/* another wrapper for fragment_add_seq_key - uses a key of source, dest, id
* and act_id */
extern fragment_data *
-fragment_add_dcerpc_dg(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
+fragment_add_dcerpc_dg(tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id,
void *act_id,
- GHashTable *fragment_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags);
+ GHashTable *fragment_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags);
/*
* These routines extend fragment_add_seq_key to use a "reassembled_table".
@@ -214,10 +214,10 @@ fragment_add_dcerpc_dg(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id
* head of the fragment list.
*/
extern fragment_data *
-fragment_add_seq_check(tvbuff_t *tvb, int offset, packet_info *pinfo,
- guint32 id, GHashTable *fragment_table,
- GHashTable *reassembled_table, guint32 frag_number,
- guint32 frag_data_len, gboolean more_frags);
+fragment_add_seq_check(tvbuff_t *tvb, const int offset, const packet_info *pinfo,
+ const guint32 id, GHashTable *fragment_table,
+ GHashTable *reassembled_table, const guint32 frag_number,
+ const guint32 frag_data_len, const gboolean more_frags);
extern fragment_data *
fragment_add_seq_802_11(tvbuff_t *tvb, int offset, packet_info *pinfo,
@@ -231,11 +231,11 @@ fragment_add_seq_next(tvbuff_t *tvb, int offset, packet_info *pinfo, guint32 id,
guint32 frag_data_len, gboolean more_frags);
extern void
-fragment_start_seq_check(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- guint32 tot_len);
+fragment_start_seq_check(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ const guint32 tot_len);
extern fragment_data *
-fragment_end_seq_next(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
+fragment_end_seq_next(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
GHashTable *reassembled_table);
/* to specify how much to reassemble, for fragmentation where last fragment can not be
* identified by flags or such.
@@ -245,12 +245,12 @@ fragment_end_seq_next(packet_info *pinfo, guint32 id, GHashTable *fragment_table
*
*/
extern void
-fragment_set_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table,
- guint32 tot_len);
+fragment_set_tot_len(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table,
+ const guint32 tot_len);
/* to resad whatever totlen previously set */
extern guint32
-fragment_get_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table);
+fragment_get_tot_len(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table);
/*
* This function will set the partial reassembly flag(FD_PARTIAL_REASSEMBLY) for a fh.
@@ -261,21 +261,21 @@ fragment_get_tot_len(packet_info *pinfo, guint32 id, GHashTable *fragment_table)
* and if FD_DEFRAGMENTED is set, the reassembly process will be continued.
*/
extern void
-fragment_set_partial_reassembly(packet_info *pinfo, guint32 id, GHashTable *fragment_table);
+fragment_set_partial_reassembly(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table);
/* This function is used to check if there is partial or completed reassembly state
* matching this packet. I.e. Are there reassembly going on or not for this packet?
*/
extern fragment_data *
-fragment_get(packet_info *pinfo, guint32 id, GHashTable *fragment_table);
+fragment_get(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table);
/* The same for the reassemble table */
/* id *must* be the frame number for this to work! */
extern fragment_data *
-fragment_get_reassembled(packet_info *pinfo, guint32 id, GHashTable *reassembled_table);
+fragment_get_reassembled(const guint32 id, GHashTable *reassembled_table);
extern fragment_data *
-fragment_get_reassembled_id(packet_info *pinfo, guint32 id, GHashTable *reassembled_table);
+fragment_get_reassembled_id(const packet_info *pinfo, const guint32 id, GHashTable *reassembled_table);
/* This will free up all resources and delete reassembly state for this PDU.
* Except if the PDU is completely reassembled, then it would NOT deallocate the
@@ -286,7 +286,7 @@ fragment_get_reassembled_id(packet_info *pinfo, guint32 id, GHashTable *reassemb
* g_free() that buffer.
*/
extern unsigned char *
-fragment_delete(packet_info *pinfo, guint32 id, GHashTable *fragment_table);
+fragment_delete(const packet_info *pinfo, const guint32 id, GHashTable *fragment_table);
/* hf_fragment, hf_fragment_error, and hf_reassembled_in should be
FT_FRAMENUM, the others should be FT_BOOLEAN
@@ -309,7 +309,7 @@ typedef struct _fragment_items {
} fragment_items;
extern tvbuff_t *
-process_reassembled_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
+process_reassembled_data(tvbuff_t *tvb, const int offset, packet_info *pinfo,
const char *name, fragment_data *fd_head, const fragment_items *fit,
gboolean *update_col_infop, proto_tree *tree);
diff --git a/epan/to_str.c b/epan/to_str.c
index ee1930be0b..f25ff992ad 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -118,7 +118,7 @@ bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct) {
* the resulting string is (len-1) bytes shorter)
*/
gchar *
-bytestring_to_str(const guint8 *ad, guint32 len, char punct) {
+bytestring_to_str(const guint8 *ad, const guint32 len, const char punct) {
gchar *buf;
size_t buflen;
@@ -203,7 +203,7 @@ bytes_to_str_punct(const guint8 *bd, int bd_len, gchar punct) {
}
static int
-guint32_to_str_buf_len(guint32 u) {
+guint32_to_str_buf_len(const guint32 u) {
if (u >= 1000000000)return 10;
if (u >= 100000000) return 9;
if (u >= 10000000) return 8;
@@ -280,7 +280,7 @@ guint32_to_str_buf(guint32 u, gchar *buf, int buf_len) {
}
gchar *
-guint32_to_str(guint32 u) {
+guint32_to_str(const guint32 u) {
int str_len = 16; /* guint32_to_str_buf_len(u)+1; */
gchar *bp = ep_alloc(str_len);
@@ -309,7 +309,7 @@ guint32_to_str(guint32 u) {
* If time is negative, add a '-' to all non-null components.
*/
static void
-time_secs_to_str_buf(gint32 time_val, guint32 frac, gboolean is_nsecs,
+time_secs_to_str_buf(gint32 time_val, const guint32 frac, const gboolean is_nsecs,
emem_strbuf_t *buf)
{
int hours, mins, secs;
@@ -360,7 +360,7 @@ time_secs_to_str_buf(gint32 time_val, guint32 frac, gboolean is_nsecs,
}
gchar *
-time_secs_to_str(gint32 time_val)
+time_secs_to_str(const gint32 time_val)
{
emem_strbuf_t *buf;
@@ -376,7 +376,7 @@ time_secs_to_str(gint32 time_val)
}
static void
-time_secs_to_str_buf_unsigned(guint32 time_val, guint32 frac, gboolean is_nsecs,
+time_secs_to_str_buf_unsigned(guint32 time_val, const guint32 frac, const gboolean is_nsecs,
emem_strbuf_t *buf)
{
int hours, mins, secs;
@@ -413,7 +413,7 @@ time_secs_to_str_buf_unsigned(guint32 time_val, guint32 frac, gboolean is_nsecs,
}
gchar *
-time_secs_to_str_unsigned(guint32 time_val)
+time_secs_to_str_unsigned(const guint32 time_val)
{
emem_strbuf_t *buf;
@@ -473,7 +473,7 @@ static const char *mon_names[12] = {
};
gchar *
-abs_time_to_str(nstime_t *abs_time, absolute_time_display_e fmt)
+abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt)
{
struct tm *tmp = NULL;
const char *zonename = "???";
@@ -543,7 +543,7 @@ abs_time_to_str(nstime_t *abs_time, absolute_time_display_e fmt)
}
gchar *
-abs_time_secs_to_str(time_t abs_time, absolute_time_display_e fmt)
+abs_time_secs_to_str(const time_t abs_time, const absolute_time_display_e fmt)
{
struct tm *tmp = NULL;
const char *zonename = "???";
@@ -611,8 +611,8 @@ abs_time_secs_to_str(time_t abs_time, absolute_time_display_e fmt)
}
void
-display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac,
- to_str_time_res_t units)
+display_signed_time(gchar *buf, int buflen, const gint32 sec, gint32 frac,
+ const to_str_time_res_t units)
{
/* If the fractional part of the time stamp is negative,
print its absolute value and, if the seconds part isn't
@@ -659,8 +659,8 @@ display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac,
void
-display_epoch_time(gchar *buf, int buflen, time_t sec, gint32 frac,
- to_str_time_res_t units)
+display_epoch_time(gchar *buf, int buflen, const time_t sec, gint32 frac,
+ const to_str_time_res_t units)
{
double elapsed_secs;
@@ -715,7 +715,7 @@ display_epoch_time(gchar *buf, int buflen, time_t sec, gint32 frac,
* Display a relative time as days/hours/minutes/seconds.
*/
gchar *
-rel_time_to_str(nstime_t *rel_time)
+rel_time_to_str(const nstime_t *rel_time)
{
emem_strbuf_t *buf;
const char *sign;
@@ -757,7 +757,7 @@ rel_time_to_str(nstime_t *rel_time)
* Display a relative time as seconds.
*/
gchar *
-rel_time_to_secs_str(nstime_t *rel_time)
+rel_time_to_secs_str(const nstime_t *rel_time)
{
gchar *buf;
@@ -775,7 +775,7 @@ rel_time_to_secs_str(nstime_t *rel_time)
*/
char *
-decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value)
+decode_bits_in_field(const gint bit_offset, const gint no_of_bits, const guint64 value)
{
guint64 mask = 0,tmp;
char *str;
@@ -826,7 +826,7 @@ decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value)
Return a pointer to the character after that string. */
/*XXX this needs a buf_len check */
char *
-other_decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width)
+other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, const int width)
{
int i;
guint32 bit;
@@ -858,7 +858,7 @@ other_decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width)
}
char *
-decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width)
+decode_bitfield_value(char *buf, const guint32 val, const guint32 mask, const int width)
{
char *p;
@@ -871,7 +871,7 @@ decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width)
/* Generate a string describing a Boolean bitfield (a one-bit field that
says something is either true of false). */
const char *
-decode_boolean_bitfield(guint32 val, guint32 mask, int width,
+decode_boolean_bitfield(const guint32 val, const guint32 mask, const int width,
const char *truedesc, const char *falsedesc)
{
char *buf;
@@ -889,7 +889,7 @@ decode_boolean_bitfield(guint32 val, guint32 mask, int width,
/* Generate a string describing a numeric bitfield (an N-bit field whose
value is just a number). */
const char *
-decode_numeric_bitfield(guint32 val, guint32 mask, int width,
+decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width,
const char *fmt)
{
char *buf;
@@ -912,7 +912,7 @@ decode_numeric_bitfield(guint32 val, guint32 mask, int width,
XXX update the ep_address_to_str stuff to use this function.
*/
void
-ip_to_str_buf(const guint8 *ad, gchar *buf, int buf_len)
+ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len)
{
register gchar const *p;
register gchar *b=buf;
diff --git a/epan/to_str.h b/epan/to_str.h
index 7f139f46c1..ab42c03ade 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -47,43 +47,43 @@ struct e_in6_addr;
extern gchar* ep_address_to_str(const address *);
extern gchar* se_address_to_str(const address *);
extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
-extern gchar* bytestring_to_str(const guint8 *, guint32, char);
+extern gchar* bytestring_to_str(const guint8 *, const guint32, const char);
extern gchar* ether_to_str(const guint8 *);
extern const gchar* ip_to_str(const guint8 *);
-extern void ip_to_str_buf(const guint8 *ad, gchar *buf, int buf_len);
+extern void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);
extern gchar* fc_to_str(const guint8 *);
extern gchar* fcwwn_to_str (const guint8 *);
extern gchar* ip6_to_str(const struct e_in6_addr *);
extern void ip6_to_str_buf(const struct e_in6_addr *, gchar *);
-extern gchar* ipx_addr_to_str(guint32, const guint8 *);
+extern gchar* ipx_addr_to_str(const guint32, const guint8 *);
extern gchar* ipxnet_to_string(const guint8 *ad);
-extern gchar* ipxnet_to_str_punct(const guint32 ad, char punct);
+extern gchar* ipxnet_to_str_punct(const guint32 ad, const char punct);
extern gchar* vines_addr_to_str(const guint8 *addrp);
-extern gchar* time_secs_to_str(gint32);
-extern gchar* time_secs_to_str_unsigned(guint32);
-extern gchar* time_msecs_to_str(gint32);
-extern gchar* abs_time_to_str(nstime_t*, absolute_time_display_e fmt);
-extern gchar* abs_time_secs_to_str(time_t, absolute_time_display_e fmt);
-extern void display_signed_time(gchar *, int, gint32, gint32, to_str_time_res_t);
-extern void display_epoch_time(gchar *, int, time_t, gint32, to_str_time_res_t);
+extern gchar* time_secs_to_str(const gint32 time_val);
+extern gchar* time_secs_to_str_unsigned(const guint32);
+extern gchar* time_msecs_to_str(gint32 time_val);
+extern gchar* abs_time_to_str(const nstime_t*, const absolute_time_display_e fmt);
+extern gchar* abs_time_secs_to_str(const time_t, const absolute_time_display_e fmt);
+extern void display_signed_time(gchar *, int, const gint32, gint32, const to_str_time_res_t);
+extern void display_epoch_time(gchar *, int, const time_t, gint32, const to_str_time_res_t);
-extern gchar* guint32_to_str(guint32 u);
+extern gchar* guint32_to_str(const guint32 u);
extern void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
-extern gchar* rel_time_to_str(nstime_t*);
-extern gchar* rel_time_to_secs_str(nstime_t*);
+extern gchar* rel_time_to_str(const nstime_t*);
+extern gchar* rel_time_to_secs_str(const nstime_t*);
extern gchar* guid_to_str(const e_guid_t*);
extern gchar* guid_to_str_buf(const e_guid_t*, gchar*, int);
-extern char *decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value);
+extern char *decode_bits_in_field(const gint bit_offset, const gint no_of_bits, const guint64 value);
-extern char *other_decode_bitfield_value(char *buf, guint32 val, guint32 mask,
- int width);
-extern char *decode_bitfield_value(char *buf, guint32 val, guint32 mask,
- int width);
-extern const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width,
+extern char *other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
+ const int width);
+extern char *decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
+ const int width);
+extern const char *decode_boolean_bitfield(const guint32 val, const guint32 mask, const int width,
const char *truedesc, const char *falsedesc);
-extern const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
+extern const char *decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width,
const char *fmt);
#endif /* __TO_STR_H__ */
diff --git a/epan/tvbparse.c b/epan/tvbparse.c
index 34d78298e2..4525b0e814 100644
--- a/epan/tvbparse.c
+++ b/epan/tvbparse.c
@@ -104,7 +104,7 @@ static tvbparse_elem_t* new_tok(tvbparse_t* tt,
return tok;
}
-static int ignore_fcn(tvbparse_t* tt,int offset) {
+static int ignore_fcn(tvbparse_t* tt, int offset) {
int len = 0;
int consumed;
tvbparse_elem_t* ignored = NULL;
@@ -132,7 +132,7 @@ static int ignore_fcn(tvbparse_t* tt,int offset) {
}
-static int cond_char (tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_char (tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
gchar c,t;
guint i;
@@ -158,7 +158,7 @@ static int cond_char (tvbparse_t* tt, int offset, const tvbparse_wanted_t * want
return -1;
}
-tvbparse_wanted_t* tvbparse_char(int id,
+tvbparse_wanted_t* tvbparse_char(const int id,
const gchar* chr,
const void* data,
tvbparse_action_t before_cb,
@@ -217,9 +217,9 @@ next_char:
}
}
-tvbparse_wanted_t* tvbparse_chars(int id,
- guint min_len,
- guint max_len,
+tvbparse_wanted_t* tvbparse_chars(const int id,
+ const guint min_len,
+ const guint max_len,
const gchar* chr,
const void* data,
tvbparse_action_t before_cb,
@@ -239,7 +239,7 @@ tvbparse_wanted_t* tvbparse_chars(int id,
}
-static int cond_not_char(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_not_char(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
gchar c, t;
guint i;
gboolean not_matched = FALSE;
@@ -271,7 +271,7 @@ static int cond_not_char(tvbparse_t* tt, int offset, const tvbparse_wanted_t * w
}
}
-tvbparse_wanted_t* tvbparse_not_char(int id,
+tvbparse_wanted_t* tvbparse_not_char(const int id,
const gchar* chr,
const void* data,
tvbparse_action_t before_cb,
@@ -331,9 +331,9 @@ end_not_chars:
}
}
-tvbparse_wanted_t* tvbparse_not_chars(int id,
- guint min_len,
- guint max_len,
+tvbparse_wanted_t* tvbparse_not_chars(const int id,
+ const guint min_len,
+ const guint max_len,
const gchar* chr,
const void* data,
tvbparse_action_t before_cb,
@@ -354,7 +354,7 @@ tvbparse_wanted_t* tvbparse_not_chars(int id,
}
-static int cond_string(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_string(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
int len = wanted->len;
#ifdef TVBPARSE_DEBUG
if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_STRING) g_warning("cond_string: control='%s'",wanted->control.str);
@@ -374,7 +374,7 @@ static int cond_string(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wan
}
}
-tvbparse_wanted_t* tvbparse_string(int id,
+tvbparse_wanted_t* tvbparse_string(const int id,
const gchar* str,
const void* data,
tvbparse_action_t before_cb,
@@ -392,7 +392,7 @@ tvbparse_wanted_t* tvbparse_string(int id,
return w;
}
-static int cond_casestring(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_casestring(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
int len = wanted->len;
#ifdef TVBPARSE_DEBUG
if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_CASESTRING) g_warning("cond_casestring: control='%s'",wanted->control.str);
@@ -413,7 +413,7 @@ static int cond_casestring(tvbparse_t* tt, int offset, const tvbparse_wanted_t *
}
}
-tvbparse_wanted_t* tvbparse_casestring(int id,
+tvbparse_wanted_t* tvbparse_casestring(const int id,
const gchar* str,
const void* data,
tvbparse_action_t before_cb,
@@ -431,7 +431,7 @@ tvbparse_wanted_t* tvbparse_casestring(int id,
return w;
}
-static int cond_one_of(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_one_of(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
guint i;
#ifdef TVBPARSE_DEBUG
if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_ONEOF) g_warning("cond_one_of: START");
@@ -463,7 +463,7 @@ static int cond_one_of(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wan
return -1;
}
-tvbparse_wanted_t* tvbparse_set_oneof(int id,
+tvbparse_wanted_t* tvbparse_set_oneof(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -490,7 +490,7 @@ tvbparse_wanted_t* tvbparse_set_oneof(int id,
return w;
}
-static int cond_hash(tvbparse_t* tt, int offset, const tvbparse_wanted_t* wanted, tvbparse_elem_t** tok) {
+static int cond_hash(tvbparse_t* tt, const int offset, const tvbparse_wanted_t* wanted, tvbparse_elem_t** tok) {
int key_len;
gchar* key = NULL;
tvbparse_elem_t* key_elem = NULL;
@@ -541,7 +541,7 @@ static int cond_hash(tvbparse_t* tt, int offset, const tvbparse_wanted_t* wanted
return tot_len;
}
-tvbparse_wanted_t* tvbparse_hashed(int id,
+tvbparse_wanted_t* tvbparse_hashed(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -639,7 +639,7 @@ static int cond_seq(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted
}
-tvbparse_wanted_t* tvbparse_set_seq(int id,
+tvbparse_wanted_t* tvbparse_set_seq(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -726,9 +726,9 @@ static int cond_some(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wante
return offset - start;
}
-tvbparse_wanted_t* tvbparse_some(int id,
- guint from,
- guint to,
+tvbparse_wanted_t* tvbparse_some(const int id,
+ const guint from,
+ const guint to,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -751,7 +751,7 @@ tvbparse_wanted_t* tvbparse_some(int id,
}
-static int cond_until(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_until(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
tvbparse_elem_t* new = NULL;
int len = 0;
int target_offset = offset;
@@ -805,7 +805,7 @@ static int cond_until(tvbparse_t* tt, int offset, const tvbparse_wanted_t * want
}
}
-tvbparse_wanted_t* tvbparse_until(int id,
+tvbparse_wanted_t* tvbparse_until(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -824,7 +824,7 @@ tvbparse_wanted_t* tvbparse_until(int id,
return w;
}
-static int cond_handle(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
+static int cond_handle(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted, tvbparse_elem_t** tok) {
tvbparse_wanted_t* w = *(wanted->control.handle);
int len = w->condition(tt, offset, w, tok);
@@ -844,7 +844,7 @@ tvbparse_wanted_t* tvbparse_handle(tvbparse_wanted_t** handle) {
return w;
}
-static int cond_end(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted _U_, tvbparse_elem_t** tok) {
+static int cond_end(tvbparse_t* tt, const int offset, const tvbparse_wanted_t * wanted _U_, tvbparse_elem_t** tok) {
if (offset == tt->end_offset) {
*tok = new_tok(tt,wanted->id,offset,0,wanted);
return 0;
@@ -853,7 +853,7 @@ static int cond_end(tvbparse_t* tt, int offset, const tvbparse_wanted_t * wanted
}
}
-tvbparse_wanted_t* tvbparse_end_of_buffer(int id,
+tvbparse_wanted_t* tvbparse_end_of_buffer(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb) {
@@ -1156,12 +1156,12 @@ tvbparse_wanted_t* tvbparse_ft_numcmp(int id,
#endif
-tvbparse_wanted_t* tvbparse_quoted(int id,
+tvbparse_wanted_t* tvbparse_quoted(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
- char quote,
- char esc) {
+ const char quote,
+ const char esc) {
gchar* esc_quot = g_strdup_printf("%c%c",esc,quote);
gchar* quot = g_strdup_printf("%c",quote);
@@ -1193,7 +1193,7 @@ void tvbparse_shrink_token_cb(void* tvbparse_data _U_,
}
tvbparse_t* tvbparse_init(tvbuff_t* tvb,
- int offset,
+ const int offset,
int len,
void* data,
const tvbparse_wanted_t* ignore) {
@@ -1214,7 +1214,7 @@ tvbparse_t* tvbparse_init(tvbuff_t* tvb,
}
gboolean tvbparse_reset(tvbparse_t* tt,
- int offset,
+ const int offset,
int len) {
#ifdef TVBPARSE_DEBUG
diff --git a/epan/tvbparse.h b/epan/tvbparse.h
index 2a971fa946..911367484f 100644
--- a/epan/tvbparse.h
+++ b/epan/tvbparse.h
@@ -89,7 +89,7 @@ typedef struct _tvbparse_t tvbparse_t;
typedef void (*tvbparse_action_t)(void* tvbparse_data, const void* wanted_data, struct _tvbparse_elem_t* elem);
typedef int (*tvbparse_condition_t)
-(tvbparse_t*, int,
+(tvbparse_t*, const int,
const tvbparse_wanted_t*,
tvbparse_elem_t**);
@@ -192,7 +192,7 @@ struct _tvbparse_elem_t {
* When looked for it returns a simple element one character long if the char
* at the current offset matches one of the the needles.
*/
-tvbparse_wanted_t* tvbparse_char(int id,
+tvbparse_wanted_t* tvbparse_char(const int id,
const gchar* needles,
const void* private_data,
tvbparse_action_t before_cb,
@@ -204,7 +204,7 @@ tvbparse_wanted_t* tvbparse_char(int id,
* When looked for it returns a simple element one character long if the char
* at the current offset does not match one of the the needles.
*/
-tvbparse_wanted_t* tvbparse_not_char(int id,
+tvbparse_wanted_t* tvbparse_not_char(const int id,
const gchar* needle,
const void* private_data,
tvbparse_action_t before_cb,
@@ -218,9 +218,9 @@ tvbparse_wanted_t* tvbparse_not_char(int id,
* An element will be returned if at least min_len chars are given (1 if it's 0)
* It will get at most max_len chars or as much as it can if max_len is 0.
*/
-tvbparse_wanted_t* tvbparse_chars(int id,
- guint min_len,
- guint max_len,
+tvbparse_wanted_t* tvbparse_chars(const int id,
+ const guint min_len,
+ const guint max_len,
const gchar* needles,
const void* private_data,
tvbparse_action_t before_cb,
@@ -235,9 +235,9 @@ tvbparse_wanted_t* tvbparse_chars(int id,
* An element will be returned if at least min_len chars are given (1 if it's 0)
* It will get at most max_len chars or as much as it can if max_len is 0.
*/
-tvbparse_wanted_t* tvbparse_not_chars(int id,
- guint min_len,
- guint max_len,
+tvbparse_wanted_t* tvbparse_not_chars(const int id,
+ const guint min_len,
+ const guint max_len,
const gchar* needles,
const void* private_data,
tvbparse_action_t before_cb,
@@ -249,7 +249,7 @@ tvbparse_wanted_t* tvbparse_not_chars(int id,
* When looked for it returns a simple element if we have the given string at
* the current offset
*/
-tvbparse_wanted_t* tvbparse_string(int id,
+tvbparse_wanted_t* tvbparse_string(const int id,
const gchar* string,
const void* private_data,
tvbparse_action_t before_cb,
@@ -261,7 +261,7 @@ tvbparse_wanted_t* tvbparse_string(int id,
* When looked for it returns a simple element if we have a matching string at
* the current offset
*/
-tvbparse_wanted_t* tvbparse_casestring(int id,
+tvbparse_wanted_t* tvbparse_casestring(const int id,
const gchar* str,
const void* data,
tvbparse_action_t before_cb,
@@ -283,7 +283,7 @@ tvbparse_wanted_t* tvbparse_casestring(int id,
* op_mode values determine how the terminating element and the current offset
* of the parser are handled
*/
-tvbparse_wanted_t* tvbparse_until(int id,
+tvbparse_wanted_t* tvbparse_until(const int id,
const void* private_data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -299,7 +299,7 @@ tvbparse_wanted_t* tvbparse_until(int id,
* The list of candidates is terminated with a NULL
*
*/
-tvbparse_wanted_t* tvbparse_set_oneof(int id,
+tvbparse_wanted_t* tvbparse_set_oneof(const int id,
const void* private_data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -309,7 +309,7 @@ tvbparse_wanted_t* tvbparse_set_oneof(int id,
* hashed
*/
-tvbparse_wanted_t* tvbparse_hashed(int id,
+tvbparse_wanted_t* tvbparse_hashed(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -329,7 +329,7 @@ void tvbparse_hashed_add(tvbparse_wanted_t* w, ...);
* The list of candidates is terminated with a NULL.
*
*/
-tvbparse_wanted_t* tvbparse_set_seq(int id,
+tvbparse_wanted_t* tvbparse_set_seq(const int id,
const void* private_data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -342,9 +342,9 @@ tvbparse_wanted_t* tvbparse_set_seq(int id,
* a composed element is returned.
*
*/
-tvbparse_wanted_t* tvbparse_some(int id,
- guint min,
- guint max,
+tvbparse_wanted_t* tvbparse_some(const int id,
+ const guint min,
+ const guint max,
const void* private_data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
@@ -403,12 +403,12 @@ tvbparse_wanted_t* tvbparse_ft_numcmp(int id,
*
* C strings are matched with tvbparse_quoted(-1,NULL,NULL,NULL,"\"","\\")
*/
-tvbparse_wanted_t* tvbparse_quoted(int id,
+tvbparse_wanted_t* tvbparse_quoted(const int id,
const void* data,
tvbparse_action_t before_cb,
tvbparse_action_t after_cb,
- char quote,
- char escape);
+ const char quote,
+ const char escape);
/*
* a helper callback for quoted strings that will shrink the token to contain
@@ -429,13 +429,13 @@ void tvbparse_shrink_token_cb(void* tvbparse_data,
* ignore: a wanted token type to be ignored (the associated cb WILL be called when it matches)
*/
tvbparse_t* tvbparse_init(tvbuff_t* tvb,
- int offset,
+ const int offset,
int len,
void* private_data,
const tvbparse_wanted_t* ignore);
/* reset the parser */
-gboolean tvbparse_reset(tvbparse_t* tt, int offset, int len);
+gboolean tvbparse_reset(tvbparse_t* tt, const int offset, int len);
guint tvbparse_curr_offset(tvbparse_t* tt);
guint tvbparse_len_left(tvbparse_t* tt);
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 4a12b8efa7..8ecc1b9865 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -52,11 +52,11 @@
#include "proto.h" /* XXX - only used for DISSECTOR_ASSERT, probably a new header file? */
static const guint8*
-ensure_contiguous_no_exception(tvbuff_t *tvb, gint offset, gint length,
+ensure_contiguous_no_exception(tvbuff_t *tvb, const gint offset, const gint length,
int *exception);
static const guint8*
-ensure_contiguous(tvbuff_t *tvb, gint offset, gint length);
+ensure_contiguous(tvbuff_t *tvb, const gint offset, const gint length);
#if GLIB_CHECK_VERSION(2,10,0)
#else
@@ -87,7 +87,7 @@ tvbuff_cleanup(void)
}
static void
-tvb_init(tvbuff_t *tvb, tvbuff_type type)
+tvb_init(tvbuff_t *tvb, const tvbuff_type type)
{
tvb_backing_t *backing;
tvb_comp_t *composite;
@@ -130,7 +130,7 @@ tvb_init(tvbuff_t *tvb, tvbuff_type type)
tvbuff_t*
-tvb_new(tvbuff_type type)
+tvb_new(const tvbuff_type type)
{
tvbuff_t *tvb;
@@ -146,7 +146,7 @@ tvb_new(tvbuff_type type)
}
static tvbuff_t*
-tvb_new_with_subset(guint subset_tvb_offset, guint subset_tvb_length)
+tvb_new_with_subset(const guint subset_tvb_offset, const guint subset_tvb_length)
{
tvbuff_t *tvb = tvb_new(TVBUFF_SUBSET);
tvb->tvbuffs.subset.offset = subset_tvb_offset;
@@ -217,7 +217,7 @@ tvb_free(tvbuff_t* tvb)
}
guint
-tvb_increment_usage_count(tvbuff_t* tvb, guint count)
+tvb_increment_usage_count(tvbuff_t* tvb, const guint count)
{
tvb->usage_count += count;
@@ -225,7 +225,7 @@ tvb_increment_usage_count(tvbuff_t* tvb, guint count)
}
guint
-tvb_decrement_usage_count(tvbuff_t* tvb, guint count)
+tvb_decrement_usage_count(tvbuff_t* tvb, const guint count)
{
if (tvb->usage_count <= count) {
tvb->usage_count = 1;
@@ -256,7 +256,7 @@ tvb_free_chain(tvbuff_t* tvb)
void
-tvb_set_free_cb(tvbuff_t* tvb, tvbuff_free_cb_t func)
+tvb_set_free_cb(tvbuff_t* tvb, const tvbuff_free_cb_t func)
{
DISSECTOR_ASSERT(tvb);
DISSECTOR_ASSERT(tvb->type == TVBUFF_REAL_DATA);
@@ -281,7 +281,7 @@ tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child)
}
static void
-tvb_set_real_data_no_exceptions(tvbuff_t* tvb, const guint8* data, guint length, gint reported_length)
+tvb_set_real_data_no_exceptions(tvbuff_t* tvb, const guint8* data, const guint length, const gint reported_length)
{
tvb->real_data = data;
tvb->length = length;
@@ -290,7 +290,7 @@ tvb_set_real_data_no_exceptions(tvbuff_t* tvb, const guint8* data, guint length,
}
void
-tvb_set_real_data(tvbuff_t* tvb, const guint8* data, guint length, gint reported_length)
+tvb_set_real_data(tvbuff_t* tvb, const guint8* data, const guint length, const gint reported_length)
{
DISSECTOR_ASSERT(tvb);
DISSECTOR_ASSERT(tvb->type == TVBUFF_REAL_DATA);
@@ -302,7 +302,7 @@ tvb_set_real_data(tvbuff_t* tvb, const guint8* data, guint length, gint reported
}
tvbuff_t*
-tvb_new_real_data(const guint8* data, guint length, gint reported_length)
+tvb_new_real_data(const guint8* data, const guint length, const gint reported_length)
{
tvbuff_t *tvb;
@@ -322,7 +322,7 @@ tvb_new_real_data(const guint8* data, guint length, gint reported_length)
}
tvbuff_t*
-tvb_new_child_real_data(tvbuff_t *parent, const guint8* data, guint length, gint reported_length)
+tvb_new_child_real_data(tvbuff_t *parent, const guint8* data, const guint length, const gint reported_length)
{
tvbuff_t *tvb = tvb_new_real_data(data, length, reported_length);
if (tvb) {
@@ -346,7 +346,7 @@ tvb_new_child_real_data(tvbuff_t *parent, const guint8* data, guint length, gint
* that gets an exception, so the error is reported as an error in that
* protocol rather than the containing protocol. */
static gboolean
-compute_offset_length(guint tvb_length_val, guint tvb_reported_length_val, gint offset, gint length_val,
+compute_offset_length(const guint tvb_length_val, const guint tvb_reported_length_val, const gint offset, const gint length_val,
guint *offset_ptr, guint *length_ptr, int *exception)
{
DISSECTOR_ASSERT(offset_ptr);
@@ -410,7 +410,7 @@ compute_offset_length(guint tvb_length_val, guint tvb_reported_length_val, gint
static gboolean
-check_offset_length_no_exception(guint tvb_length_val, guint tvb_reported_length_val, gint offset, gint length_val,
+check_offset_length_no_exception(const guint tvb_length_val, const guint tvb_reported_length_val, const gint offset, gint const length_val,
guint *offset_ptr, guint *length_ptr, int *exception)
{
guint end_offset;
@@ -460,7 +460,7 @@ check_offset_length_no_exception(guint tvb_length_val, guint tvb_reported_length
* either is out of bounds. Sets integer ptrs to the new offset
* and length. */
static void
-check_offset_length(guint tvb_length_val, guint tvb_reported_length_val, gint offset, gint length_val,
+check_offset_length(const guint tvb_length_val, const guint tvb_reported_length_val, const gint offset, gint const length_val,
guint *offset_ptr, guint *length_ptr)
{
int exception = 0;
@@ -472,7 +472,7 @@ check_offset_length(guint tvb_length_val, guint tvb_reported_length_val, gint of
}
static void
-tvb_set_subset_no_exceptions(tvbuff_t *tvb, tvbuff_t *backing, gint reported_length)
+tvb_set_subset_no_exceptions(tvbuff_t *tvb, tvbuff_t *backing, const gint reported_length)
{
tvb->tvbuffs.subset.tvb = backing;
tvb->length = tvb->tvbuffs.subset.length;
@@ -495,7 +495,7 @@ tvb_set_subset_no_exceptions(tvbuff_t *tvb, tvbuff_t *backing, gint reported_len
void
tvb_set_subset(tvbuff_t *tvb, tvbuff_t *backing,
- gint backing_offset, gint backing_length, gint reported_length)
+ const gint backing_offset, const gint backing_length, const gint reported_length)
{
DISSECTOR_ASSERT(tvb);
DISSECTOR_ASSERT(tvb->type == TVBUFF_SUBSET);
@@ -511,7 +511,7 @@ tvb_set_subset(tvbuff_t *tvb, tvbuff_t *backing,
}
tvbuff_t*
-tvb_new_subset(tvbuff_t *backing, gint backing_offset, gint backing_length, gint reported_length)
+tvb_new_subset(tvbuff_t *backing, const gint backing_offset, const gint backing_length, const gint reported_length)
{
tvbuff_t *tvb;
guint subset_tvb_offset;
@@ -539,7 +539,7 @@ tvb_new_subset(tvbuff_t *backing, gint backing_offset, gint backing_length, gint
}
tvbuff_t*
-tvb_new_subset_remaining(tvbuff_t *backing, gint backing_offset)
+tvb_new_subset_remaining(tvbuff_t *backing, const gint backing_offset)
{
tvbuff_t *tvb;
guint subset_tvb_offset;
@@ -626,7 +626,7 @@ tvb_composite_finalize(tvbuff_t* tvb)
guint
-tvb_length(tvbuff_t* tvb)
+tvb_length(const tvbuff_t* tvb)
{
DISSECTOR_ASSERT(tvb && tvb->initialized);
@@ -634,7 +634,7 @@ tvb_length(tvbuff_t* tvb)
}
gint
-tvb_length_remaining(tvbuff_t *tvb, gint offset)
+tvb_length_remaining(const tvbuff_t *tvb, const gint offset)
{
guint abs_offset, abs_length;
@@ -649,7 +649,7 @@ tvb_length_remaining(tvbuff_t *tvb, gint offset)
}
guint
-tvb_ensure_length_remaining(tvbuff_t *tvb, gint offset)
+tvb_ensure_length_remaining(const tvbuff_t *tvb, const gint offset)
{
guint abs_offset, abs_length;
int exception;
@@ -679,7 +679,7 @@ tvb_ensure_length_remaining(tvbuff_t *tvb, gint offset)
/* Validates that 'length' bytes are available starting from
* offset (pos/neg). Does not throw an exception. */
gboolean
-tvb_bytes_exist(tvbuff_t *tvb, gint offset, gint length)
+tvb_bytes_exist(const tvbuff_t *tvb, const gint offset, const gint length)
{
guint abs_offset, abs_length;
@@ -699,7 +699,7 @@ tvb_bytes_exist(tvbuff_t *tvb, gint offset, gint length)
/* Validates that 'length' bytes are available starting from
* offset (pos/neg). Throws an exception if they aren't. */
void
-tvb_ensure_bytes_exist(tvbuff_t *tvb, gint offset, gint length)
+tvb_ensure_bytes_exist(const tvbuff_t *tvb, const gint offset, const gint length)
{
guint abs_offset, abs_length;
@@ -722,7 +722,7 @@ tvb_ensure_bytes_exist(tvbuff_t *tvb, gint offset, gint length)
}
gboolean
-tvb_offset_exists(tvbuff_t *tvb, gint offset)
+tvb_offset_exists(const tvbuff_t *tvb, const gint offset)
{
guint abs_offset, abs_length;
@@ -739,7 +739,7 @@ tvb_offset_exists(tvbuff_t *tvb, gint offset)
}
guint
-tvb_reported_length(tvbuff_t* tvb)
+tvb_reported_length(const tvbuff_t* tvb)
{
DISSECTOR_ASSERT(tvb && tvb->initialized);
@@ -747,7 +747,7 @@ tvb_reported_length(tvbuff_t* tvb)
}
gint
-tvb_reported_length_remaining(tvbuff_t *tvb, gint offset)
+tvb_reported_length_remaining(const tvbuff_t *tvb, const gint offset)
{
guint abs_offset, abs_length;
@@ -771,7 +771,7 @@ tvb_reported_length_remaining(tvbuff_t *tvb, gint offset)
Also adjusts the data length. */
void
-tvb_set_reported_length(tvbuff_t* tvb, guint reported_length)
+tvb_set_reported_length(tvbuff_t* tvb, const guint reported_length)
{
DISSECTOR_ASSERT(tvb && tvb->initialized);
@@ -807,7 +807,7 @@ first_real_data_ptr(tvbuff_t *tvb)
#endif
static guint
-offset_from_real_beginning(tvbuff_t *tvb, guint counter)
+offset_from_real_beginning(const tvbuff_t *tvb, const guint counter)
{
tvbuff_t *member;
@@ -827,14 +827,14 @@ offset_from_real_beginning(tvbuff_t *tvb, guint counter)
}
guint
-tvb_offset_from_real_beginning(tvbuff_t *tvb)
+tvb_offset_from_real_beginning(const tvbuff_t *tvb)
{
return offset_from_real_beginning(tvb, 0);
}
static const guint8*
-composite_ensure_contiguous_no_exception(tvbuff_t *tvb, guint abs_offset,
- guint abs_length)
+composite_ensure_contiguous_no_exception(tvbuff_t *tvb, const guint abs_offset,
+ const guint abs_length)
{
guint i, num_members;
tvb_comp_t *composite;
@@ -877,7 +877,7 @@ composite_ensure_contiguous_no_exception(tvbuff_t *tvb, guint abs_offset,
}
static const guint8*
-ensure_contiguous_no_exception(tvbuff_t *tvb, gint offset, gint length,
+ensure_contiguous_no_exception(tvbuff_t *tvb, const gint offset, const gint length,
int *exception)
{
guint abs_offset, abs_length;
@@ -912,7 +912,7 @@ ensure_contiguous_no_exception(tvbuff_t *tvb, gint offset, gint length,
}
static const guint8*
-ensure_contiguous(tvbuff_t *tvb, gint offset, gint length)
+ensure_contiguous(tvbuff_t *tvb, const gint offset, const gint length)
{
int exception;
const guint8 *p;
@@ -926,7 +926,7 @@ ensure_contiguous(tvbuff_t *tvb, gint offset, gint length)
}
static const guint8*
-fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length)
+fast_ensure_contiguous(tvbuff_t *tvb, const gint offset, const guint length)
{
guint end_offset;
guint u_offset;
@@ -955,7 +955,7 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length)
}
static const guint8*
-guint8_find(const guint8* haystack, size_t haystacklen, guint8 needle)
+guint8_find(const guint8* haystack, const size_t haystacklen, const guint8 needle)
{
const guint8 *b;
int i;
@@ -1056,7 +1056,7 @@ composite_memcpy(tvbuff_t *tvb, guint8* target, guint abs_offset, size_t abs_len
}
void*
-tvb_memcpy(tvbuff_t *tvb, void* target, gint offset, size_t length)
+tvb_memcpy(tvbuff_t *tvb, void* target, const gint offset, size_t length)
{
guint abs_offset, abs_length;
@@ -1109,7 +1109,7 @@ tvb_memcpy(tvbuff_t *tvb, void* target, gint offset, size_t length)
* meaning "to the end of the buffer"?
*/
void*
-tvb_memdup(tvbuff_t *tvb, gint offset, size_t length)
+tvb_memdup(tvbuff_t *tvb, const gint offset, size_t length)
{
guint abs_offset, abs_length;
void *duped;
@@ -1139,7 +1139,7 @@ tvb_memdup(tvbuff_t *tvb, gint offset, size_t length)
* after the current packet has been dissected.
*/
void*
-ep_tvb_memdup(tvbuff_t *tvb, gint offset, size_t length)
+ep_tvb_memdup(tvbuff_t *tvb, const gint offset, size_t length)
{
guint abs_offset, abs_length;
void *duped;
@@ -1155,14 +1155,14 @@ ep_tvb_memdup(tvbuff_t *tvb, gint offset, size_t length)
const guint8*
-tvb_get_ptr(tvbuff_t *tvb, gint offset, gint length)
+tvb_get_ptr(tvbuff_t *tvb, const gint offset, const gint length)
{
return ensure_contiguous(tvb, offset, length);
}
/* ---------------- */
guint8
-tvb_get_guint8(tvbuff_t *tvb, gint offset)
+tvb_get_guint8(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1171,7 +1171,7 @@ tvb_get_guint8(tvbuff_t *tvb, gint offset)
}
guint16
-tvb_get_ntohs(tvbuff_t *tvb, gint offset)
+tvb_get_ntohs(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1180,7 +1180,7 @@ tvb_get_ntohs(tvbuff_t *tvb, gint offset)
}
guint32
-tvb_get_ntoh24(tvbuff_t *tvb, gint offset)
+tvb_get_ntoh24(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1189,7 +1189,7 @@ tvb_get_ntoh24(tvbuff_t *tvb, gint offset)
}
guint32
-tvb_get_ntohl(tvbuff_t *tvb, gint offset)
+tvb_get_ntohl(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1198,7 +1198,7 @@ tvb_get_ntohl(tvbuff_t *tvb, gint offset)
}
guint64
-tvb_get_ntoh64(tvbuff_t *tvb, gint offset)
+tvb_get_ntoh64(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1248,13 +1248,13 @@ tvb_get_ntoh64(tvbuff_t *tvb, gint offset)
#define IEEE_SP_BIAS ((1 << (IEEE_SP_EXP_WIDTH - 1)) - 1)
static int
-ieee_float_is_zero(guint32 w)
+ieee_float_is_zero(const guint32 w)
{
return ((w & ~IEEE_SP_SIGN_MASK) == 0);
}
static gfloat
-get_ieee_float(guint32 w)
+get_ieee_float(const guint32 w)
{
long sign;
long exponent;
@@ -1309,13 +1309,13 @@ get_ieee_float(guint32 w)
#define IEEE_DP_BIAS ((1 << (IEEE_DP_EXP_WIDTH - 1)) - 1)
static int
-ieee_double_is_zero(guint64 w)
+ieee_double_is_zero(const guint64 w)
{
return ((w & ~IEEE_SP_SIGN_MASK) == 0);
}
static gdouble
-get_ieee_double(guint64 w)
+get_ieee_double(const guint64 w)
{
gint64 sign;
gint64 exponent;
@@ -1361,7 +1361,7 @@ get_ieee_double(guint64 w)
* "float" format?
*/
gfloat
-tvb_get_ntohieee_float(tvbuff_t *tvb, int offset)
+tvb_get_ntohieee_float(tvbuff_t *tvb, const int offset)
{
#if defined(vax)
return get_ieee_float(tvb_get_ntohl(tvb, offset));
@@ -1381,7 +1381,7 @@ tvb_get_ntohieee_float(tvbuff_t *tvb, int offset)
* big-endian form, and returns a "double".
*/
gdouble
-tvb_get_ntohieee_double(tvbuff_t *tvb, int offset)
+tvb_get_ntohieee_double(tvbuff_t *tvb, const int offset)
{
#if defined(vax)
union {
@@ -1410,7 +1410,7 @@ tvb_get_ntohieee_double(tvbuff_t *tvb, int offset)
}
guint16
-tvb_get_letohs(tvbuff_t *tvb, gint offset)
+tvb_get_letohs(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1419,7 +1419,7 @@ tvb_get_letohs(tvbuff_t *tvb, gint offset)
}
guint32
-tvb_get_letoh24(tvbuff_t *tvb, gint offset)
+tvb_get_letoh24(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1428,7 +1428,7 @@ tvb_get_letoh24(tvbuff_t *tvb, gint offset)
}
guint32
-tvb_get_letohl(tvbuff_t *tvb, gint offset)
+tvb_get_letohl(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1437,7 +1437,7 @@ tvb_get_letohl(tvbuff_t *tvb, gint offset)
}
guint64
-tvb_get_letoh64(tvbuff_t *tvb, gint offset)
+tvb_get_letoh64(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
@@ -1454,7 +1454,7 @@ tvb_get_letoh64(tvbuff_t *tvb, gint offset)
* "float" format?
*/
gfloat
-tvb_get_letohieee_float(tvbuff_t *tvb, int offset)
+tvb_get_letohieee_float(tvbuff_t *tvb, const int offset)
{
#if defined(vax)
return get_ieee_float(tvb_get_letohl(tvb, offset));
@@ -1474,7 +1474,7 @@ tvb_get_letohieee_float(tvbuff_t *tvb, int offset)
* little-endian form, and returns a "double".
*/
gdouble
-tvb_get_letohieee_double(tvbuff_t *tvb, int offset)
+tvb_get_letohieee_double(tvbuff_t *tvb, const int offset)
{
#if defined(vax)
union {
@@ -1506,7 +1506,7 @@ tvb_get_letohieee_double(tvbuff_t *tvb, int offset)
* We do *not* convert them to host byte order; we leave them in
* network byte order. */
guint32
-tvb_get_ipv4(tvbuff_t *tvb, gint offset)
+tvb_get_ipv4(tvbuff_t *tvb, const gint offset)
{
const guint8* ptr;
guint32 addr;
@@ -1518,7 +1518,7 @@ tvb_get_ipv4(tvbuff_t *tvb, gint offset)
/* Fetch an IPv6 address. */
void
-tvb_get_ipv6(tvbuff_t *tvb, gint offset, struct e_in6_addr *addr)
+tvb_get_ipv6(tvbuff_t *tvb, const gint offset, struct e_in6_addr *addr)
{
const guint8* ptr;
@@ -1528,7 +1528,7 @@ tvb_get_ipv6(tvbuff_t *tvb, gint offset, struct e_in6_addr *addr)
/* Fetch a GUID. */
void
-tvb_get_ntohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid)
+tvb_get_ntohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid)
{
ensure_contiguous(tvb, offset, sizeof(*guid));
guid->data1 = tvb_get_ntohl(tvb, offset);
@@ -1538,7 +1538,7 @@ tvb_get_ntohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid)
}
void
-tvb_get_letohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid)
+tvb_get_letohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid)
{
ensure_contiguous(tvb, offset, sizeof(*guid));
guid->data1 = tvb_get_letohl(tvb, offset);
@@ -1548,7 +1548,7 @@ tvb_get_letohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid)
}
void
-tvb_get_guid(tvbuff_t *tvb, gint offset, e_guid_t *guid, gboolean little_endian)
+tvb_get_guid(tvbuff_t *tvb, const gint offset, e_guid_t *guid, const gboolean little_endian)
{
if (little_endian) {
tvb_get_letohguid(tvb, offset, guid);
@@ -1582,7 +1582,7 @@ static const guint16 bit_mask16[] = {
/* Get 1 - 8 bits */
guint8
-tvb_get_bits8(tvbuff_t *tvb, gint bit_offset, gint no_of_bits)
+tvb_get_bits8(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits)
{
gint offset;
guint16 value = 0;
@@ -1627,7 +1627,7 @@ static const guint32 bit_mask32[] = {
};
guint16
-tvb_get_bits16(tvbuff_t *tvb, gint bit_offset, gint no_of_bits,gboolean little_endian)
+tvb_get_bits16(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits,const gboolean little_endian)
{
gint offset;
guint16 value = 0;
@@ -1681,7 +1681,7 @@ static const guint64 bit_mask64[] = {
};
guint32
-tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian)
+tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits, const gboolean little_endian)
{
gint offset;
guint32 value = 0;
@@ -1723,7 +1723,7 @@ tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_
}
guint64
-tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian)
+tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits, const gboolean little_endian)
{
gint offset;
guint64 value = 0;
@@ -1765,7 +1765,7 @@ tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_
}
guint32
-tvb_get_bits(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian)
+tvb_get_bits(tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, const gboolean little_endian)
{
/* This function can handle only up to 32 requested bits */
if (no_of_bits > 32)
@@ -1794,7 +1794,7 @@ tvb_get_bits(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_en
* in that case, -1 will be returned if the boundary is reached before
* finding needle. */
gint
-tvb_find_guint8(tvbuff_t *tvb, gint offset, gint maxlength, guint8 needle)
+tvb_find_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const guint8 needle)
{
const guint8 *result;
guint abs_offset, junk_length;
@@ -1859,7 +1859,7 @@ tvb_find_guint8(tvbuff_t *tvb, gint offset, gint maxlength, guint8 needle)
* in that case, -1 will be returned if the boundary is reached before
* finding needle. */
gint
-tvb_pbrk_guint8(tvbuff_t *tvb, gint offset, gint maxlength, const guint8 *needles, guchar *found_needle)
+tvb_pbrk_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const guint8 *needles, guchar *found_needle)
{
const guint8 *result;
guint abs_offset, junk_length;
@@ -1922,7 +1922,7 @@ tvb_pbrk_guint8(tvbuff_t *tvb, gint offset, gint maxlength, const guint8 *needle
* If the NUL isn't found, it throws the appropriate exception.
*/
guint
-tvb_strsize(tvbuff_t *tvb, gint offset)
+tvb_strsize(tvbuff_t *tvb, const gint offset)
{
guint abs_offset, junk_length;
gint nul_offset;
@@ -1956,7 +1956,7 @@ tvb_strsize(tvbuff_t *tvb, gint offset)
* of tvbuff.
* Returns -1 if 'maxlength' reached before finding EOS. */
gint
-tvb_strnlen(tvbuff_t *tvb, gint offset, guint maxlength)
+tvb_strnlen(tvbuff_t *tvb, const gint offset, const guint maxlength)
{
gint result_offset;
guint abs_offset, junk_length;
@@ -1984,7 +1984,7 @@ tvb_strnlen(tvbuff_t *tvb, gint offset, guint maxlength)
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
gint
-tvb_strneql(tvbuff_t *tvb, gint offset, const gchar *str, gint size)
+tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str, const gint size)
{
const guint8 *ptr;
@@ -2011,7 +2011,7 @@ tvb_strneql(tvbuff_t *tvb, gint offset, const gchar *str, gint size)
* 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
gint
-tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str, gint size)
+tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str, const gint size)
{
const guint8 *ptr;
@@ -2038,7 +2038,7 @@ tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str, gint size)
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
gint
-tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str, size_t size)
+tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str, size_t size)
{
const guint8 *ptr;
@@ -2065,7 +2065,7 @@ tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str, size_t size)
* free the result returned. The len parameter is the number of guint16's
* to convert from Unicode. */
char *
-tvb_fake_unicode(tvbuff_t *tvb, int offset, int len, gboolean little_endian)
+tvb_fake_unicode(tvbuff_t *tvb, int offset, const int len, const gboolean little_endian)
{
char *buffer;
int i;
@@ -2100,7 +2100,7 @@ tvb_fake_unicode(tvbuff_t *tvb, int offset, int len, gboolean little_endian)
* when wireshark starts decoding the next packet.
*/
char *
-tvb_get_ephemeral_faked_unicode(tvbuff_t *tvb, int offset, int len, gboolean little_endian)
+tvb_get_ephemeral_faked_unicode(tvbuff_t *tvb, int offset, const int len, const gboolean little_endian)
{
char *buffer;
int i;
@@ -2131,7 +2131,7 @@ tvb_get_ephemeral_faked_unicode(tvbuff_t *tvb, int offset, int len, gboolean lit
*/
gchar *
-tvb_format_text(tvbuff_t *tvb, gint offset, gint size)
+tvb_format_text(tvbuff_t *tvb, const gint offset, const gint size)
{
const guint8 *ptr;
gint len = size;
@@ -2149,7 +2149,7 @@ tvb_format_text(tvbuff_t *tvb, gint offset, gint size)
*/
gchar *
-tvb_format_text_wsp(tvbuff_t *tvb, gint offset, gint size)
+tvb_format_text_wsp(tvbuff_t *tvb, const gint offset, const gint size)
{
const guint8 *ptr;
gint len = size;
@@ -2170,7 +2170,7 @@ tvb_format_text_wsp(tvbuff_t *tvb, gint offset, gint size)
* the null padding characters as "\000".
*/
gchar *
-tvb_format_stringzpad(tvbuff_t *tvb, gint offset, gint size)
+tvb_format_stringzpad(tvbuff_t *tvb, const gint offset, const gint size)
{
const guint8 *ptr, *p;
gint len = size;
@@ -2194,7 +2194,7 @@ tvb_format_stringzpad(tvbuff_t *tvb, gint offset, gint size)
* the null padding characters as "\000".
*/
gchar *
-tvb_format_stringzpad_wsp(tvbuff_t *tvb, gint offset, gint size)
+tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const gint size)
{
const guint8 *ptr, *p;
gint len = size;
@@ -2222,7 +2222,7 @@ tvb_format_stringzpad_wsp(tvbuff_t *tvb, gint offset, gint size)
* Throws an exception if the tvbuff ends before the string does.
*/
guint8 *
-tvb_get_string(tvbuff_t *tvb, gint offset, gint length)
+tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length)
{
const guint8 *ptr;
guint8 *strbuf = NULL;
@@ -2252,7 +2252,7 @@ tvb_get_string(tvbuff_t *tvb, gint offset, gint length)
* after the current packet has been dissected.
*/
guint8 *
-tvb_get_ephemeral_string(tvbuff_t *tvb, gint offset, gint length)
+tvb_get_ephemeral_string(tvbuff_t *tvb, const gint offset, const gint length)
{
const guint8 *ptr;
guint8 *strbuf = NULL;
@@ -2281,7 +2281,7 @@ tvb_get_ephemeral_string(tvbuff_t *tvb, gint offset, gint length)
* when wireshark starts or opens a new capture.
*/
guint8 *
-tvb_get_seasonal_string(tvbuff_t *tvb, gint offset, gint length)
+tvb_get_seasonal_string(tvbuff_t *tvb, const gint offset, const gint length)
{
const guint8 *ptr;
guint8 *strbuf = NULL;
@@ -2306,7 +2306,7 @@ tvb_get_seasonal_string(tvbuff_t *tvb, gint offset, gint length)
* string (including the terminating null) through a pointer.
*/
guint8 *
-tvb_get_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
+tvb_get_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
{
guint size;
guint8 *strptr;
@@ -2333,7 +2333,7 @@ tvb_get_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
* after the current packet has been dissected.
*/
guint8 *
-tvb_get_ephemeral_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
+tvb_get_ephemeral_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
{
guint size;
guint8 *strptr;
@@ -2359,7 +2359,7 @@ tvb_get_ephemeral_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
* when wireshark starts or opens a new capture.
*/
guint8 *
-tvb_get_seasonal_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
+tvb_get_seasonal_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
{
guint size;
guint8 *strptr;
@@ -2391,7 +2391,7 @@ tvb_get_seasonal_stringz(tvbuff_t *tvb, gint offset, gint *lengthp)
* including the terminating-NUL.
*/
static gint
-_tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer,
+_tvb_get_nstringz(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* buffer,
gint *bytes_copied)
{
gint stringlen;
@@ -2475,7 +2475,7 @@ _tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer,
* at the correct spot, terminating the string.
*/
gint
-tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer)
+tvb_get_nstringz(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* buffer)
{
gint bytes_copied;
@@ -2489,7 +2489,7 @@ tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer)
* a NUL is placed at the end of buffer to terminate it.
*/
gint
-tvb_get_nstringz0(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer)
+tvb_get_nstringz0(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* buffer)
{
gint len, bytes_copied;
@@ -2526,8 +2526,8 @@ tvb_get_nstringz0(tvbuff_t *tvb, gint offset, guint bufsize, guint8* buffer)
* terminator. (It's not set if we return -1.)
*/
gint
-tvb_find_line_end(tvbuff_t *tvb, gint offset, int len, gint *next_offset,
- gboolean desegment)
+tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset,
+ const gboolean desegment)
{
gint eob_offset;
gint eol_offset;
@@ -2642,7 +2642,7 @@ tvb_find_line_end(tvbuff_t *tvb, gint offset, int len, gint *next_offset,
* terminator.
*/
gint
-tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
+tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len,
gint *next_offset)
{
gint cur_offset, char_offset;
@@ -2783,7 +2783,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
* character following offset or offset + maxlength -1 whichever
* is smaller.
*/
-gint tvb_skip_wsp(tvbuff_t* tvb, gint offset, gint maxlength)
+gint tvb_skip_wsp(tvbuff_t* tvb, const gint offset, const gint maxlength)
{
gint counter = offset;
gint end = offset + maxlength,tvb_len;
@@ -2807,7 +2807,7 @@ gint tvb_skip_wsp(tvbuff_t* tvb, gint offset, gint maxlength)
return (counter);
}
-gint tvb_skip_wsp_return(tvbuff_t* tvb, gint offset){
+gint tvb_skip_wsp_return(tvbuff_t* tvb, const gint offset){
gint counter = offset;
gint end;
guint8 tempchar;
@@ -2827,7 +2827,7 @@ gint tvb_skip_wsp_return(tvbuff_t* tvb, gint offset){
* separator.
*/
gchar *
-tvb_bytes_to_str_punct(tvbuff_t *tvb, gint offset, gint len, gchar punct)
+tvb_bytes_to_str_punct(tvbuff_t *tvb, const gint offset, const gint len, const gchar punct)
{
return bytes_to_str_punct(tvb_get_ptr(tvb, offset, len), len, punct);
}
@@ -2837,14 +2837,14 @@ tvb_bytes_to_str_punct(tvbuff_t *tvb, gint offset, gint len, gchar punct)
* to the string with the formatted data.
*/
gchar *
-tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len)
+tvb_bytes_to_str(tvbuff_t *tvb, const gint offset, const gint len)
{
return bytes_to_str(tvb_get_ptr(tvb, offset, len), len);
}
/* Find a needle tvbuff within a haystack tvbuff. */
gint
-tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset)
+tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, const gint haystack_offset)
{
guint haystack_abs_offset, haystack_abs_length;
const guint8 *haystack_data;
@@ -2887,7 +2887,7 @@ tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset)
#undef TVB_Z_DEBUG
tvbuff_t *
-tvb_uncompress(tvbuff_t *tvb, int offset, int comprlen)
+tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
{
gint err = Z_OK;
guint bytes_out = 0;
@@ -3139,13 +3139,13 @@ tvb_uncompress(tvbuff_t *tvb, int offset, int comprlen)
}
#else
tvbuff_t *
-tvb_uncompress(tvbuff_t *tvb _U_, int offset _U_, int comprlen _U_)
+tvb_uncompress(tvbuff_t *tvb _U_, const int offset _U_, int comprlen _U_)
{
return NULL;
}
#endif
-tvbuff_t* tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, int offset, int comprlen)
+tvbuff_t* tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
{
tvbuff_t *new_tvb = tvb_uncompress(tvb, offset, comprlen);
if (new_tvb)
diff --git a/epan/tvbuff.h b/epan/tvbuff.h
index dce30af923..0278ce2fd3 100644
--- a/epan/tvbuff.h
+++ b/epan/tvbuff.h
@@ -181,20 +181,20 @@ extern void tvb_free(tvbuff_t*);
extern void tvb_free_chain(tvbuff_t*);
/** Both return the new usage count, after the increment or decrement */
-extern guint tvb_increment_usage_count(tvbuff_t*, guint count);
+extern guint tvb_increment_usage_count(tvbuff_t*, const guint count);
/** If a decrement causes the usage count to drop to 0, a the tvbuff
* is immediately freed. Be sure you know exactly what you're doing
* if you decide to use this function, as another tvbuff could
* still have a pointer to the just-freed tvbuff, causing corrupted data
* or a segfault in the future */
-extern guint tvb_decrement_usage_count(tvbuff_t*, guint count);
+extern guint tvb_decrement_usage_count(tvbuff_t*, const guint count);
/** Set a callback function to call when a tvbuff is actually freed
* (once the usage count drops to 0). One argument is passed to
* that callback --- a void* that points to the real data.
* Obviously, this only applies to a TVBUFF_REAL_DATA tvbuff. */
-extern void tvb_set_free_cb(tvbuff_t*, tvbuff_free_cb_t);
+extern void tvb_set_free_cb(tvbuff_t*, const tvbuff_free_cb_t);
/** Attach a TVBUFF_REAL_DATA tvbuff to a parent tvbuff. This connection
@@ -208,16 +208,16 @@ extern void tvb_set_free_cb(tvbuff_t*, tvbuff_free_cb_t);
* the tvbuff routines knowledgable of this fact. */
extern void tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child);
-extern tvbuff_t* tvb_new_child_real_data(tvbuff_t* parent, const guint8* data, guint length,
- gint reported_length);
+extern tvbuff_t* tvb_new_child_real_data(tvbuff_t* parent, const guint8* data, const guint length,
+ const gint reported_length);
/**Sets parameters for TVBUFF_REAL_DATA. Can throw ReportedBoundsError. */
-extern void tvb_set_real_data(tvbuff_t*, const guint8* data, guint length,
- gint reported_length);
+extern void tvb_set_real_data(tvbuff_t*, const guint8* data, const guint length,
+ const gint reported_length);
/** Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */
-extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
- gint reported_length);
+extern tvbuff_t* tvb_new_real_data(const guint8* data, const guint length,
+ const gint reported_length);
/** Define the subset of the backing buffer to use.
@@ -234,17 +234,17 @@ extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
* is beyond the bounds of the backing tvbuff.
* Can throw ReportedBoundsError. */
extern void tvb_set_subset(tvbuff_t* tvb, tvbuff_t* backing,
- gint backing_offset, gint backing_length, gint reported_length);
+ const gint backing_offset, const gint backing_length, const gint reported_length);
/** Combination of tvb_new() and tvb_set_subset()
* Can throw ReportedBoundsError. */
extern tvbuff_t* tvb_new_subset(tvbuff_t* backing,
- gint backing_offset, gint backing_length, gint reported_length);
+ const gint backing_offset, const gint backing_length, const gint reported_length);
/** Similar to tvb_new_subset() but with backing_length and reported_length set to -1.
* Can throw ReportedBoundsError. */
extern tvbuff_t* tvb_new_subset_remaining(tvbuff_t* backing,
- gint backing_offset);
+ const gint backing_offset);
/** Both tvb_composite_append and tvb_composite_prepend can throw
* BoundsError if member_offset/member_length goes beyond bounds of
@@ -266,35 +266,35 @@ extern void tvb_composite_finalize(tvbuff_t* tvb);
/* Get total length of buffer */
-extern guint tvb_length(tvbuff_t*);
+extern guint tvb_length(const tvbuff_t*);
/** Computes bytes to end of buffer, from offset (which can be negative,
* to indicate bytes from end of buffer). Function returns -1 to
* indicate that offset is out of bounds. No exception is thrown. */
-extern gint tvb_length_remaining(tvbuff_t*, gint offset);
+extern gint tvb_length_remaining(const tvbuff_t*, const gint offset);
/** Same as above, but throws an exception if the offset is out of bounds. */
-extern guint tvb_ensure_length_remaining(tvbuff_t*, gint offset);
+extern guint tvb_ensure_length_remaining(const tvbuff_t*, const gint offset);
/* Checks (w/o throwing exception) that the bytes referred to by
* 'offset'/'length' actually exist in the buffer */
-extern gboolean tvb_bytes_exist(tvbuff_t*, gint offset, gint length);
+extern gboolean tvb_bytes_exist(const tvbuff_t*, const gint offset, const gint length);
/** Checks that the bytes referred to by 'offset'/'length' actually exist
* in the buffer, and throws an exception if they aren't. */
-extern void tvb_ensure_bytes_exist(tvbuff_t *tvb, gint offset, gint length);
+extern void tvb_ensure_bytes_exist(const tvbuff_t *tvb, const gint offset, const gint length);
/* Checks (w/o throwing exception) that offset exists in buffer */
-extern gboolean tvb_offset_exists(tvbuff_t*, gint offset);
+extern gboolean tvb_offset_exists(const tvbuff_t*, const gint offset);
/* Get reported length of buffer */
-extern guint tvb_reported_length(tvbuff_t*);
+extern guint tvb_reported_length(const tvbuff_t*);
/** Computes bytes of reported packet data to end of buffer, from offset
* (which can be negative, to indicate bytes from end of buffer). Function
* returns -1 to indicate that offset is out of bounds. No exception is
* thrown. */
-extern gint tvb_reported_length_remaining(tvbuff_t *tvb, gint offset);
+extern gint tvb_reported_length_remaining(const tvbuff_t *tvb, const gint offset);
/** Set the reported length of a tvbuff to a given value; used for protocols
whose headers contain an explicit length and where the calling
@@ -302,9 +302,9 @@ extern gint tvb_reported_length_remaining(tvbuff_t *tvb, gint offset);
this protocol.
Also adjusts the data length. */
-extern void tvb_set_reported_length(tvbuff_t*, guint);
+extern void tvb_set_reported_length(tvbuff_t*, const guint);
-extern guint tvb_offset_from_real_beginning(tvbuff_t *tvb);
+extern guint tvb_offset_from_real_beginning(const tvbuff_t *tvb);
/* Returns the offset from the first byte of real data. */
#define TVB_RAW_OFFSET(tvb) \
@@ -313,48 +313,48 @@ extern guint tvb_offset_from_real_beginning(tvbuff_t *tvb);
/************** START OF ACCESSORS ****************/
/* All accessors will throw an exception if appropriate */
-extern guint8 tvb_get_guint8(tvbuff_t*, gint offset);
+extern guint8 tvb_get_guint8(tvbuff_t*, const gint offset);
-extern guint16 tvb_get_ntohs(tvbuff_t*, gint offset);
-extern guint32 tvb_get_ntoh24(tvbuff_t*, gint offset);
-extern guint32 tvb_get_ntohl(tvbuff_t*, gint offset);
-extern guint64 tvb_get_ntoh64(tvbuff_t*, gint offset);
-extern gfloat tvb_get_ntohieee_float(tvbuff_t*, gint offset);
-extern gdouble tvb_get_ntohieee_double(tvbuff_t*, gint offset);
+extern guint16 tvb_get_ntohs(tvbuff_t*, const gint offset);
+extern guint32 tvb_get_ntoh24(tvbuff_t*, const gint offset);
+extern guint32 tvb_get_ntohl(tvbuff_t*, const gint offset);
+extern guint64 tvb_get_ntoh64(tvbuff_t*, const gint offset);
+extern gfloat tvb_get_ntohieee_float(tvbuff_t*, const gint offset);
+extern gdouble tvb_get_ntohieee_double(tvbuff_t*, const gint offset);
-extern guint16 tvb_get_letohs(tvbuff_t*, gint offset);
-extern guint32 tvb_get_letoh24(tvbuff_t*, gint offset);
-extern guint32 tvb_get_letohl(tvbuff_t*, gint offset);
-extern guint64 tvb_get_letoh64(tvbuff_t*, gint offset);
-extern gfloat tvb_get_letohieee_float(tvbuff_t*, gint offset);
-extern gdouble tvb_get_letohieee_double(tvbuff_t*, gint offset);
+extern guint16 tvb_get_letohs(tvbuff_t*, const gint offset);
+extern guint32 tvb_get_letoh24(tvbuff_t*, const gint offset);
+extern guint32 tvb_get_letohl(tvbuff_t*, const gint offset);
+extern guint64 tvb_get_letoh64(tvbuff_t*, const gint offset);
+extern gfloat tvb_get_letohieee_float(tvbuff_t*, const gint offset);
+extern gdouble tvb_get_letohieee_double(tvbuff_t*, const gint offset);
/**
* Fetch an IPv4 address, in network byte order.
* We do *not* convert it to host byte order; we leave it in
* network byte order, as that's what its callers expect. */
-extern guint32 tvb_get_ipv4(tvbuff_t*, gint offset);
+extern guint32 tvb_get_ipv4(tvbuff_t*, const gint offset);
/* Fetch an IPv6 address. */
-extern void tvb_get_ipv6(tvbuff_t*, gint offset, struct e_in6_addr *addr);
+extern void tvb_get_ipv6(tvbuff_t*, const gint offset, struct e_in6_addr *addr);
/* Fetch a GUID. */
-extern void tvb_get_ntohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid);
-extern void tvb_get_letohguid(tvbuff_t *tvb, gint offset, e_guid_t *guid);
-extern void tvb_get_guid(tvbuff_t *tvb, gint offset, e_guid_t *guid, gboolean little_endian);
+extern void tvb_get_ntohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid);
+extern void tvb_get_letohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid);
+extern void tvb_get_guid(tvbuff_t *tvb, const gint offset, e_guid_t *guid, const gboolean little_endian);
/* Fetch a specified number of bits from bit offset in a tvb */
-extern guint8 tvb_get_bits8(tvbuff_t *tvb, gint bit_offset, gint no_of_bits);
-extern guint16 tvb_get_bits16(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian);
-extern guint32 tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian);
-extern guint64 tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian);
+extern guint8 tvb_get_bits8(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits);
+extern guint16 tvb_get_bits16(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits, const gboolean little_endian);
+extern guint32 tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits, const gboolean little_endian);
+extern guint64 tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits, const gboolean little_endian);
/* Fetch a specified number of bits from bit offset in a tvb, but allow number
* of bits to range between 1 and 32. If the requested number of bits is known
* beforehand, or its range can be handled by a single function of the group
* above, use one of them instead.
*/
-extern guint32 tvb_get_bits(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gboolean little_endian);
+extern guint32 tvb_get_bits(tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, const gboolean little_endian);
/** Returns target for convenience. Does not suffer from possible
* expense of tvb_get_ptr(), since this routine is smart enough
@@ -362,17 +362,17 @@ extern guint32 tvb_get_bits(tvbuff_t *tvb, gint bit_offset, gint no_of_bits, gbo
* different TVBUFF_REAL_DATA tvbuffs. This function assumes that the
* target memory is already allocated; it does not allocate or free the
* target memory. */
-extern void* tvb_memcpy(tvbuff_t*, void* target, gint offset, size_t length);
+extern void* tvb_memcpy(tvbuff_t*, void* target, const gint offset, size_t length);
/** It is the user's responsibility to g_free() the memory allocated by
* tvb_memdup(). Calls tvb_memcpy() */
-extern void* tvb_memdup(tvbuff_t*, gint offset, size_t length);
+extern void* tvb_memdup(tvbuff_t*, const gint offset, size_t length);
/* Same as above but the buffer returned from this function does not have to
* be freed. It will be automatically freed after the packet is dissected.
* Buffers allocated by this function are NOT persistent.
*/
-extern void* ep_tvb_memdup(tvbuff_t *tvb, gint offset, size_t length);
+extern void* ep_tvb_memdup(tvbuff_t *tvb, const gint offset, size_t length);
/** WARNING! This function is possibly expensive, temporarily allocating
* another copy of the packet data. Furthermore, it's dangerous because once
@@ -399,7 +399,7 @@ extern void* ep_tvb_memdup(tvbuff_t *tvb, gint offset, size_t length);
* and the pointer to the newly-contiguous data is returned. This dynamically-
* allocated memory will be freed when the tvbuff is freed, after the
* tvbuff_free_cb_t() is called, if any. */
-extern const guint8* tvb_get_ptr(tvbuff_t*, gint offset, gint length);
+extern const guint8* tvb_get_ptr(tvbuff_t*, const gint offset, const gint length);
/** Find first occurence of any of the needles in tvbuff, starting at offset.
* Searches at most maxlength number of bytes; if maxlength is -1, searches
@@ -408,8 +408,8 @@ extern const guint8* tvb_get_ptr(tvbuff_t*, gint offset, gint length);
* Will not throw an exception, even if maxlength exceeds boundary of tvbuff;
* in that case, -1 will be returned if the boundary is reached before
* finding needle. */
-extern gint tvb_find_guint8(tvbuff_t*, gint offset, gint maxlength,
- guint8 needle);
+extern gint tvb_find_guint8(tvbuff_t*, const gint offset, const gint maxlength,
+ const guint8 needle);
/** Find first occurence of any of the needles in tvbuff, starting at offset.
* Searches at most maxlength number of bytes. Returns the offset of the
@@ -417,7 +417,7 @@ extern gint tvb_find_guint8(tvbuff_t*, gint offset, gint maxlength,
* Will not throw an exception, even if
* maxlength exceeds boundary of tvbuff; in that case, -1 will be returned if
* the boundary is reached before finding needle. */
-extern gint tvb_pbrk_guint8(tvbuff_t *, gint offset, gint maxlength,
+extern gint tvb_pbrk_guint8(tvbuff_t *, const gint offset, const gint maxlength,
const guint8 *needles, guchar *found_needle);
/** Find size of stringz (NUL-terminated string) by looking for terminating
@@ -425,13 +425,13 @@ extern gint tvb_pbrk_guint8(tvbuff_t *, gint offset, gint maxlength,
*
* If the NUL isn't found, it throws the appropriate exception.
*/
-extern guint tvb_strsize(tvbuff_t *tvb, gint offset);
+extern guint tvb_strsize(tvbuff_t *tvb, const gint offset);
/** Find length of string by looking for end of zero terminated string, up to
* 'maxlength' characters'; if 'maxlength' is -1, searches to end
* of tvbuff.
* Returns -1 if 'maxlength' reached before finding EOS. */
-extern gint tvb_strnlen(tvbuff_t*, gint offset, guint maxlength);
+extern gint tvb_strnlen(tvbuff_t*, const gint offset, const guint maxlength);
/** Convert a string from Unicode to ASCII. At the moment we fake it by
* assuming all characters are ASCII )-: The len parameter is the number
@@ -444,33 +444,33 @@ extern gint tvb_strnlen(tvbuff_t*, gint offset, guint maxlength);
* automatically freed when wireshark starts dissecting
* the next packet.
*/
-extern char *tvb_fake_unicode(tvbuff_t *tvb, int offset, int len,
- gboolean little_endian);
-extern char *tvb_get_ephemeral_faked_unicode(tvbuff_t *tvb, int offset, int len,
- gboolean little_endian);
+extern char *tvb_fake_unicode(tvbuff_t *tvb, int offset, const int len,
+ const gboolean little_endian);
+extern char *tvb_get_ephemeral_faked_unicode(tvbuff_t *tvb, int offset, const int len,
+ const gboolean little_endian);
/**
* Format the data in the tvb from offset for size ...
*/
-extern gchar * tvb_format_text(tvbuff_t *tvb, gint offset, gint size);
+extern gchar * tvb_format_text(tvbuff_t *tvb, const gint offset, const gint size);
/**
* Like "tvb_format_text()", but for 'wsp'; don't show
* the characters as C-style escapes.
*/
-extern gchar * tvb_format_text_wsp(tvbuff_t *tvb, gint offset, gint size);
+extern gchar * tvb_format_text_wsp(tvbuff_t *tvb, const gint offset, const gint size);
/**
* Like "tvb_format_text()", but for null-padded strings; don't show
* the null padding characters as "\000".
*/
-extern gchar *tvb_format_stringzpad(tvbuff_t *tvb, gint offset, gint size);
+extern gchar *tvb_format_stringzpad(tvbuff_t *tvb, const gint offset, const gint size);
/**
* Like "tvb_format_text_wsp()", but for null-padded strings; don't show
* the null padding characters as "\000".
*/
-extern gchar *tvb_format_stringzpad_wsp(tvbuff_t *tvb, gint offset, gint size);
+extern gchar *tvb_format_stringzpad_wsp(tvbuff_t *tvb, const gint offset, const gint size);
/**
@@ -493,9 +493,9 @@ extern gchar *tvb_format_stringzpad_wsp(tvbuff_t *tvb, gint offset, gint size);
* instead it will automatically be freed when a new capture
* or file is opened.
*/
-extern guint8 *tvb_get_string(tvbuff_t *tvb, gint offset, gint length);
-extern guint8 *tvb_get_ephemeral_string(tvbuff_t *tvb, gint offset, gint length);
-extern guint8 *tvb_get_seasonal_string(tvbuff_t *tvb, gint offset, gint length);
+extern guint8 *tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length);
+extern guint8 *tvb_get_ephemeral_string(tvbuff_t *tvb, const gint offset, const gint length);
+extern guint8 *tvb_get_seasonal_string(tvbuff_t *tvb, const gint offset, const gint length);
/**
@@ -518,9 +518,9 @@ extern guint8 *tvb_get_seasonal_string(tvbuff_t *tvb, gint offset, gint length);
* instead it will automatically be freed when a new capture
* or file is opened.
*/
-extern guint8 *tvb_get_stringz(tvbuff_t *tvb, gint offset, gint *lengthp);
-extern guint8 *tvb_get_ephemeral_stringz(tvbuff_t *tvb, gint offset, gint *lengthp);
-extern guint8 *tvb_get_seasonal_stringz(tvbuff_t *tvb, gint offset, gint *lengthp);
+extern guint8 *tvb_get_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
+extern guint8 *tvb_get_ephemeral_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
+extern guint8 *tvb_get_seasonal_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp);
/** Looks for a stringz (NUL-terminated string) in tvbuff and copies
* no more than bufsize number of bytes, including terminating NUL, to buffer.
@@ -535,7 +535,7 @@ extern guint8 *tvb_get_seasonal_stringz(tvbuff_t *tvb, gint offset, gint *length
* is truncated with a NUL, albeit not at buffer[bufsize - 1], but
* at the correct spot, terminating the string.
*/
-extern gint tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize,
+extern gint tvb_get_nstringz(tvbuff_t *tvb, const gint offset, const guint bufsize,
guint8* buffer);
/** Like tvb_get_nstringz(), but never returns -1. The string is guaranteed to
@@ -544,7 +544,7 @@ extern gint tvb_get_nstringz(tvbuff_t *tvb, gint offset, guint bufsize,
*
* bufsize MUST be greater than 0.
*/
-extern gint tvb_get_nstringz0(tvbuff_t *tvb, gint offset, guint bufsize,
+extern gint tvb_get_nstringz0(tvbuff_t *tvb, const gint offset, const guint bufsize,
guint8* buffer);
/**
@@ -566,8 +566,8 @@ extern gint tvb_get_nstringz0(tvbuff_t *tvb, gint offset, guint bufsize,
* terminator, or past the end of the buffer if we don't find a line
* terminator. (It's not set if we return -1.)
*/
-extern gint tvb_find_line_end(tvbuff_t *tvb, gint offset, int len,
- gint *next_offset, gboolean desegment);
+extern gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len,
+ gint *next_offset, const gboolean desegment);
/**
* Given a tvbuff, an offset into the tvbuff, and a length that starts
@@ -587,7 +587,7 @@ extern gint tvb_find_line_end(tvbuff_t *tvb, gint offset, int len,
* terminator, or past the end of the buffer if we don't find a line
* terminator.
*/
-extern gint tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
+extern gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len,
gint *next_offset);
/**
@@ -607,29 +607,29 @@ extern gint tvb_find_line_end_unquoted(tvbuff_t *tvb, gint offset, int len,
* is smaller.
*/
-extern gint tvb_skip_wsp(tvbuff_t* tvb, gint offset, gint maxlength);
+extern gint tvb_skip_wsp(tvbuff_t* tvb, const gint offset, const gint maxlength);
-extern gint tvb_skip_wsp_return(tvbuff_t* tvb, gint offset);
+extern gint tvb_skip_wsp_return(tvbuff_t* tvb, const gint offset);
/**
* Call strncmp after checking if enough chars left, returning 0 if
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
-extern gint tvb_strneql(tvbuff_t *tvb, gint offset, const gchar *str,
- gint size);
+extern gint tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str,
+ const gint size);
/**
* Call g_ascii_strncasecmp after checking if enough chars left, returning
* 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
-extern gint tvb_strncaseeql(tvbuff_t *tvb, gint offset, const gchar *str,
- gint size);
+extern gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str,
+ const gint size);
/**
* Call memcmp after checking if enough chars left, returning 0 if
* it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1.
*/
-extern gint tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str,
+extern gint tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str,
size_t size);
/**
@@ -637,14 +637,14 @@ extern gint tvb_memeql(tvbuff_t *tvb, gint offset, const guint8 *str,
* to the string with the formatted data, with "punct" as a byte
* separator.
*/
-extern gchar *tvb_bytes_to_str_punct(tvbuff_t *tvb, gint offset, gint len,
- gchar punct);
+extern gchar *tvb_bytes_to_str_punct(tvbuff_t *tvb, const gint offset, const gint len,
+ const gchar punct);
/*
* Format a bunch of data from a tvbuff as bytes, returning a pointer
* to the string with the formatted data.
*/
-extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
+extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, const gint offset, const gint len);
#define TVB_GET_DS_TVB(tvb) \
(tvb->ds_tvb)
@@ -654,21 +654,21 @@ extern gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len);
* 'haystack', or -1 if 'needle' is not found. The index is relative
* to the start of 'haystack', not 'haystack_offset'. */
extern gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
- gint haystack_offset);
+ const gint haystack_offset);
/**
* Uncompresses a zlib compressed packet inside a tvbuff at offset with
* length comprlen. Returns an uncompressed tvbuffer if uncompression
* succeeded or NULL if uncompression failed.
*/
-extern tvbuff_t* tvb_uncompress(tvbuff_t *tvb, int offset, int comprlen);
+extern tvbuff_t* tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen);
/**
* Uncompresses a zlib compressed packet inside a tvbuff at offset with
* length comprlen. Returns an uncompressed tvbuffer attached to tvb if uncompression
* succeeded or NULL if uncompression failed.
*/
-extern tvbuff_t* tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, int offset, int comprlen);
+extern tvbuff_t* tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen);
/************** END OF ACCESSORS ****************/
diff --git a/epan/value_string.c b/epan/value_string.c
index d75def715b..0e43750c71 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -37,7 +37,7 @@
Returns the associated string ptr on a match.
Formats val with fmt, and returns the resulting string, on failure. */
const gchar*
-val_to_str(guint32 val, const value_string *vs, const char *fmt) {
+val_to_str(const guint32 val, const value_string *vs, const char *fmt) {
const gchar *ret;
g_assert(fmt != NULL);
@@ -53,7 +53,7 @@ val_to_str(guint32 val, const value_string *vs, const char *fmt) {
Returns the associated string ptr on a match.
Returns 'unknown_str', on failure. */
const gchar*
-val_to_str_const(guint32 val, const value_string *vs, const char *unknown_str) {
+val_to_str_const(const guint32 val, const value_string *vs, const char *unknown_str) {
const gchar *ret;
g_assert(unknown_str != NULL);
@@ -70,7 +70,7 @@ val_to_str_const(guint32 val, const value_string *vs, const char *unknown_str) {
that table, on a match, and returns NULL, and sets "*idx" to -1,
on failure. */
const gchar*
-match_strval_idx(guint32 val, const value_string *vs, gint *idx) {
+match_strval_idx(const guint32 val, const value_string *vs, gint *idx) {
gint i = 0;
if(vs) {
@@ -89,7 +89,7 @@ match_strval_idx(guint32 val, const value_string *vs, gint *idx) {
/* Like match_strval_idx(), but doesn't return the index. */
const gchar*
-match_strval(guint32 val, const value_string *vs) {
+match_strval(const guint32 val, const value_string *vs) {
gint ignore_me;
return match_strval_idx(val, vs, &ignore_me);
}
@@ -142,7 +142,7 @@ match_strstr(const gchar *val, const string_string *vs) {
/* Generate a string describing an enumerated bitfield (an N-bit field
with various specific values having particular names). */
const char *
-decode_enumerated_bitfield(guint32 val, guint32 mask, int width,
+decode_enumerated_bitfield(const guint32 val, const guint32 mask, const int width,
const value_string *tab, const char *fmt)
{
static char buf[1025];
@@ -157,7 +157,7 @@ decode_enumerated_bitfield(guint32 val, guint32 mask, int width,
/* Generate a string describing an enumerated bitfield (an N-bit field
with various specific values having particular names). */
const char *
-decode_enumerated_bitfield_shifted(guint32 val, guint32 mask, int width,
+decode_enumerated_bitfield_shifted(const guint32 val, const guint32 mask, const int width,
const value_string *tab, const char *fmt)
{
static char buf[1025];
@@ -180,7 +180,7 @@ decode_enumerated_bitfield_shifted(guint32 val, guint32 mask, int width,
/* Tries to match val against each range in the range_string array rs.
Returns the associated string ptr on a match.
Formats val with fmt, and returns the resulting string, on failure. */
-const gchar *rval_to_str(guint32 val, const range_string *rs, const char *fmt)
+const gchar *rval_to_str(const guint32 val, const range_string *rs, const char *fmt)
{
const gchar *ret = NULL;
@@ -197,7 +197,7 @@ const gchar *rval_to_str(guint32 val, const range_string *rs, const char *fmt)
Returns the associated string ptr, and sets "*idx" to the index in
that table, on a match, and returns NULL, and sets "*idx" to -1,
on failure. */
-const gchar *match_strrval_idx(guint32 val, const range_string *rs, gint *idx)
+const gchar *match_strrval_idx(const guint32 val, const range_string *rs, gint *idx)
{
gint i = 0;
@@ -216,7 +216,7 @@ const gchar *match_strrval_idx(guint32 val, const range_string *rs, gint *idx)
}
/* Like match_strrval_idx(), but doesn't return the index. */
-const gchar *match_strrval(guint32 val, const range_string *rs)
+const gchar *match_strrval(const guint32 val, const range_string *rs)
{
gint ignore_me = 0;
return match_strrval_idx(val, rs, &ignore_me);
diff --git a/epan/value_string.h b/epan/value_string.h
index a4ae024ef9..7fcbb30500 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -55,20 +55,20 @@ typedef struct _range_string {
Returns the associated string ptr, and sets "*idx" to the index in
that table, on a match, and returns NULL, and sets "*idx" to -1,
on failure. */
-extern const gchar* match_strval_idx(guint32 val, const value_string *vs, gint *idx);
+extern const gchar* match_strval_idx(const guint32 val, const value_string *vs, gint *idx);
/* Like match_strval_idx(), but doesn't return the index. */
-extern const gchar* match_strval(guint32 val, const value_string *vs);
+extern const gchar* match_strval(const guint32 val, const value_string *vs);
/* Tries to match val against each element in the value_string array vs.
Returns the associated string ptr on a match.
Formats val with fmt, and returns the resulting string, on failure. */
-extern const gchar* val_to_str(guint32 val, const value_string *vs, const char *fmt);
+extern const gchar* val_to_str(const guint32 val, const value_string *vs, const char *fmt);
/* Tries to match val against each element in the value_string array vs.
Returns the associated string ptr on a match.
Returns 'unknown_str', on failure. */
-extern const gchar* val_to_str_const(guint32 val, const value_string *vs, const char *unknown_str);
+extern const gchar* val_to_str_const(const guint32 val, const value_string *vs, const char *unknown_str);
/* Tries to match val against each element in the value_string array vs.
Returns the associated string ptr, and sets "*idx" to the index in
@@ -86,13 +86,13 @@ extern const gchar* str_to_str(const gchar *val, const string_string *vs, const
/* Generate a string describing an enumerated bitfield (an N-bit field
with various specific values having particular names). */
-extern const char *decode_enumerated_bitfield(guint32 val, guint32 mask,
- int width, const value_string *tab, const char *fmt);
+extern const char *decode_enumerated_bitfield(const guint32 val, const guint32 mask,
+ const int width, const value_string *tab, const char *fmt);
/* Generate a string describing an enumerated bitfield (an N-bit field
with various specific values having particular names). */
-extern const char *decode_enumerated_bitfield_shifted(guint32 val, guint32 mask,
- int width, const value_string *tab, const char *fmt);
+extern const char *decode_enumerated_bitfield_shifted(const guint32 val, const guint32 mask,
+ const int width, const value_string *tab, const char *fmt);
/* ranges aware versions */
@@ -100,15 +100,15 @@ extern const char *decode_enumerated_bitfield_shifted(guint32 val, guint32 mask,
/* Tries to match val against each range in the range_string array rs.
Returns the associated string ptr on a match.
Formats val with fmt, and returns the resulting string, on failure. */
-extern const gchar* rval_to_str(guint32 val, const range_string *rs, const char *fmt);
+extern const gchar* rval_to_str(const guint32 val, const range_string *rs, const char *fmt);
/* Tries to match val against each range in the range_string array rs.
Returns the associated string ptr, and sets "*idx" to the index in
that table, on a match, and returns NULL, and sets "*idx" to -1,
on failure. */
-extern const gchar *match_strrval_idx(guint32 val, const range_string *rs, gint *idx);
+extern const gchar *match_strrval_idx(const guint32 val, const range_string *rs, gint *idx);
/* Like match_strrval_idx(), but doesn't return the index. */
-extern const gchar *match_strrval(guint32 val, const range_string *rs);
+extern const gchar *match_strrval(const guint32 val, const range_string *rs);
#endif /* __VALUE_STRING_H__ */