2021-03-04 16:30:38 +05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
2024-08-20 19:08:40 +05:00
|
|
|
|
|
|
|
#define __FAVOR_BSD
|
2021-03-04 16:30:38 +05:00
|
|
|
#include <netinet/ip6.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/tcp.h>
|
2022-01-01 22:22:04 +05:00
|
|
|
#include <netinet/udp.h>
|
2021-03-04 16:30:38 +05:00
|
|
|
|
|
|
|
uint16_t csum_partial(const void *buff, size_t len);
|
|
|
|
uint16_t csum_tcpudp_magic(uint32_t saddr, uint32_t daddr, size_t len, uint8_t proto, uint16_t sum);
|
|
|
|
uint16_t csum_ipv6_magic(const void *saddr, const void *daddr, size_t len, uint8_t proto, uint16_t sum);
|
2022-01-01 22:22:04 +05:00
|
|
|
|
2021-03-04 16:30:38 +05:00
|
|
|
uint16_t ip4_compute_csum(const void *buff, size_t len);
|
|
|
|
void ip4_fix_checksum(struct ip *ip);
|
|
|
|
|
|
|
|
void tcp4_fix_checksum(struct tcphdr *tcp,size_t len, const struct in_addr *src_addr, const struct in_addr *dest_addr);
|
|
|
|
void tcp6_fix_checksum(struct tcphdr *tcp,size_t len, const struct in6_addr *src_addr, const struct in6_addr *dest_addr);
|
|
|
|
void tcp_fix_checksum(struct tcphdr *tcp,size_t len,const struct ip *ip,const struct ip6_hdr *ip6hdr);
|
2022-01-01 22:22:04 +05:00
|
|
|
|
|
|
|
void udp4_fix_checksum(struct udphdr *udp,size_t len, const struct in_addr *src_addr, const struct in_addr *dest_addr);
|
|
|
|
void udp6_fix_checksum(struct udphdr *udp,size_t len, const struct in6_addr *src_addr, const struct in6_addr *dest_addr);
|
|
|
|
void udp_fix_checksum(struct udphdr *udp,size_t len,const struct ip *ip,const struct ip6_hdr *ip6hdr);
|