-/* Copyright (C) 2007-2010 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
void DecodeICMPV4RegisterTests(void);
/** ------ Inline functions ------ */
-static inline uint16_t ICMPV4CalculateChecksum(uint16_t *, uint16_t);
/**
* \brief Calculates the checksum for the ICMP packet
*
* \retval csum Checksum for the ICMP packet
*/
-static inline uint16_t ICMPV4CalculateChecksum(uint16_t *pkt, uint16_t tlen)
+static inline uint16_t ICMPV4CalculateChecksum(const uint16_t *pkt, uint16_t tlen)
{
uint16_t pad = 0;
uint32_t csum = pkt[0];
int ICMPv4GetCounterpart(uint8_t type);
#endif /* __DECODE_ICMPV4_H__ */
-
-/* Copyright (C) 2007-2010 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
int ICMPv6GetCounterpart(uint8_t type);
/** -------- Inline functions --------- */
-static inline uint16_t ICMPV6CalculateChecksum(uint16_t *, uint16_t *, uint16_t);
/**
* \brief Calculates the checksum for the ICMPV6 packet
*
* \retval csum Checksum for the ICMPV6 packet
*/
-static inline uint16_t ICMPV6CalculateChecksum(uint16_t *shdr, uint16_t *pkt,
- uint16_t tlen)
+static inline uint16_t ICMPV6CalculateChecksum(
+ const uint16_t *shdr, const uint16_t *pkt, uint16_t tlen)
{
uint16_t pad = 0;
uint32_t csum = shdr[0];
return (uint16_t) ~csum;
}
-
#endif /* __DECODE_ICMPV6_H__ */
-
-/* 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
void DecodeIPV4RegisterTests(void);
/** ----- Inline functions ----- */
-static inline uint16_t IPV4Checksum(uint16_t *, uint16_t, uint16_t);
/**
* \brief Calculateor validate the checksum for the IP packet
* \retval csum For validation 0 will be returned for success, for calculation
* this will be the checksum.
*/
-static inline uint16_t IPV4Checksum(uint16_t *pkt, uint16_t hlen, uint16_t init)
+static inline uint16_t IPV4Checksum(const uint16_t *pkt, uint16_t hlen, uint16_t init)
{
uint32_t csum = init;
}
#endif /* __DECODE_IPV4_H__ */
-
-/* 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
void DecodeIPV6RegisterTests(void);
#endif /* __DECODE_IPV6_H__ */
-
-/* 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
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
* \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;
* \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;
return (uint16_t)~csum;
}
-
#endif /* __DECODE_TCP_H__ */
-
-/* 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
void DecodeUDPV4RegisterTests(void);
/** ------ Inline function ------ */
-static inline uint16_t UDPV4Checksum(uint16_t *, uint16_t *, uint16_t, uint16_t);
-static inline uint16_t UDPV6Checksum(uint16_t *, uint16_t *, uint16_t, uint16_t);
/**
* \brief Calculate or valid the checksum for the UDP packet
* \retval csum For validation 0 will be returned for success, for calculation
* this will be the checksum.
*/
-static inline uint16_t UDPV4Checksum(uint16_t *shdr, uint16_t *pkt,
- uint16_t tlen, uint16_t init)
+static inline uint16_t UDPV4Checksum(
+ const uint16_t *shdr, const uint16_t *pkt, uint16_t tlen, uint16_t init)
{
uint16_t pad = 0;
uint32_t csum = init;
* \retval csum For validation 0 will be returned for success, for calculation
* this will be the checksum.
*/
-static inline uint16_t UDPV6Checksum(uint16_t *shdr, uint16_t *pkt,
- uint16_t tlen, uint16_t init)
+static inline uint16_t UDPV6Checksum(
+ const uint16_t *shdr, const uint16_t *pkt, uint16_t tlen, uint16_t init)
{
uint16_t pad = 0;
uint32_t csum = init;
return csum_u16;
}
-
#endif /* __DECODE_UDP_H__ */