| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
in_cksum.h
Go to the documentation of this file.
1
9#pragma once
10#include "ws_symbol_export.h"
11
15 typedef struct {
16 const uint8_t* ptr;
17 int len;
18} vec_t;
19
26#define SET_CKSUM_VEC_PTR(vecelem, data, length) \
27 G_STMT_START { \
28 vecelem.ptr = (data); \
29 vecelem.len = (length); \
30 } G_STMT_END
31
39#define SET_CKSUM_VEC_TVB(vecelem, tvb, offset, length) \
40 G_STMT_START { \
41 vecelem.len = (length); \
42 vecelem.ptr = tvb_get_ptr((tvb), (offset), vecelem.len); \
43 } G_STMT_END
44
52WS_DLL_PUBLIC uint16_t ip_checksum(const uint8_t *ptr, int len);
53
62WS_DLL_PUBLIC uint16_t ip_checksum_tvb(tvbuff_t *tvb, int offset, int len);
63
75WS_DLL_PUBLIC int in_cksum_ret_partial(const vec_t *vec, int veclen, uint16_t *partial);
76
86WS_DLL_PUBLIC int in_cksum(const vec_t *vec, int veclen);
87
98WS_DLL_PUBLIC uint16_t in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum);
ip_checksum_tvb
WS_DLL_PUBLIC uint16_t ip_checksum_tvb(tvbuff_t *tvb, int offset, int len)
Calculate the IP checksum for a given TVB.
Definition in_cksum.c:160
in_cksum_shouldbe
WS_DLL_PUBLIC uint16_t in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum)
Calculate the expected checksum value based on the computed checksum and the checksum field value.
Definition in_cksum.c:180
ip_checksum
WS_DLL_PUBLIC uint16_t ip_checksum(const uint8_t *ptr, int len)
Calculate the IP checksum for a given buffer.
Definition in_cksum.c:151
in_cksum_ret_partial
WS_DLL_PUBLIC int in_cksum_ret_partial(const vec_t *vec, int veclen, uint16_t *partial)
Calculates a partial checksum for a vector of data.
Definition in_cksum.c:47
in_cksum
WS_DLL_PUBLIC int in_cksum(const vec_t *vec, int veclen)
Calculate the IP checksum for a given vector of data.
Definition in_cksum.c:145
vec_t
Represents a contiguous buffer fragment used as input to checksum computation routines.
Definition in_cksum.h:15
vec_t::len
int len
Definition in_cksum.h:17
vec_t::ptr
const uint8_t * ptr
Definition in_cksum.h:16