|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* Copyright (C) 2007-2013 Open Information Security Foundation
|
|
|
|
|
/* Copyright (C) 2007-2022 Open Information Security Foundation
|
|
|
|
|
*
|
|
|
|
|
* You can copy, redistribute or modify this Program under the terms of
|
|
|
|
|
* the GNU General Public License version 2 as published by the Free
|
|
|
|
|
@ -176,8 +176,6 @@ typedef struct TCPVars_
|
|
|
|
|
void DecodeTCPRegisterTests(void);
|
|
|
|
|
|
|
|
|
|
/** -------- Inline functions ------- */
|
|
|
|
|
static inline uint16_t TCPChecksum(uint16_t *, uint16_t *, uint16_t, uint16_t);
|
|
|
|
|
static inline uint16_t TCPV6Checksum(uint16_t *, uint16_t *, uint16_t, uint16_t);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Calculate or validate the checksum for the TCP packet
|
|
|
|
|
@ -191,8 +189,8 @@ static inline uint16_t TCPV6Checksum(uint16_t *, uint16_t *, uint16_t, uint16_t)
|
|
|
|
|
* \retval csum For validation 0 will be returned for success, for calculation
|
|
|
|
|
* this will be the checksum.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t TCPChecksum(uint16_t *shdr, uint16_t *pkt,
|
|
|
|
|
uint16_t tlen, uint16_t init)
|
|
|
|
|
static inline uint16_t TCPChecksum(
|
|
|
|
|
const uint16_t *shdr, const uint16_t *pkt, uint16_t tlen, uint16_t init)
|
|
|
|
|
{
|
|
|
|
|
uint16_t pad = 0;
|
|
|
|
|
uint32_t csum = init;
|
|
|
|
|
@ -256,8 +254,8 @@ static inline uint16_t TCPChecksum(uint16_t *shdr, uint16_t *pkt,
|
|
|
|
|
* \retval csum For validation 0 will be returned for success, for calculation
|
|
|
|
|
* this will be the checksum.
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t TCPV6Checksum(uint16_t *shdr, uint16_t *pkt,
|
|
|
|
|
uint16_t tlen, uint16_t init)
|
|
|
|
|
static inline uint16_t TCPV6Checksum(
|
|
|
|
|
const uint16_t *shdr, const uint16_t *pkt, uint16_t tlen, uint16_t init)
|
|
|
|
|
{
|
|
|
|
|
uint16_t pad = 0;
|
|
|
|
|
uint32_t csum = init;
|
|
|
|
|
@ -309,6 +307,4 @@ static inline uint16_t TCPV6Checksum(uint16_t *shdr, uint16_t *pkt,
|
|
|
|
|
return (uint16_t)~csum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __DECODE_TCP_H__ */
|
|
|
|
|
|
|
|
|
|
|