Wireshark 4.7.0
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
12typedef struct {
13 const uint8_t *ptr;
14 int len;
15} vec_t;
16
17#define SET_CKSUM_VEC_PTR(vecelem, data, length) \
18 G_STMT_START { \
19 vecelem.ptr = (data); \
20 vecelem.len = (length); \
21 } G_STMT_END
22
23#define SET_CKSUM_VEC_TVB(vecelem, tvb, offset, length) \
24 G_STMT_START { \
25 vecelem.len = (length); \
26 vecelem.ptr = tvb_get_ptr((tvb), (offset), vecelem.len); \
27 } G_STMT_END
28
36WS_DLL_PUBLIC uint16_t ip_checksum(const uint8_t *ptr, int len);
37
46WS_DLL_PUBLIC uint16_t ip_checksum_tvb(tvbuff_t *tvb, int offset, int len);
47
59WS_DLL_PUBLIC int in_cksum_ret_partial(const vec_t *vec, int veclen, uint16_t *partial);
60
70WS_DLL_PUBLIC int in_cksum(const vec_t *vec, int veclen);
71
82WS_DLL_PUBLIC uint16_t in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum);
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
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
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
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
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
Definition tvbuff-int.h:33
Definition in_cksum.h:12