X-Git-Url: http://sjero.net/git/?p=ltp2tcp;a=blobdiff_plain;f=checksums.h;fp=checksums.h;h=6f1088bf3672007aaed29a1b03b294a482724d4b;hp=0000000000000000000000000000000000000000;hb=1e87d36e278f025744a728a854a81c1a01fecc57;hpb=415ee2322fe2a27adcd10e5db2871699fc4f4f07 diff --git a/checksums.h b/checksums.h new file mode 100644 index 0000000..6f1088b --- /dev/null +++ b/checksums.h @@ -0,0 +1,36 @@ +/****************************************************************************** +IPv4 and IPv6 Header Checksum Code + +Copyright (C) 2013 Samuel Jero + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Author: Samuel Jero +Date: 02/2013 +******************************************************************************/ +#ifndef CHECKUMS_H +#define CHECKSUMS_H + +#include +#include + +#define IP4_ADDR_LEN 4 +#define IP6_ADDR_LEN 16 + +u_int16_t ipv6_pseudohdr_chksum(u_char* buff, int len, u_char* dest, u_char* src, int type); +u_int16_t ipv4_pseudohdr_chksum(u_char* buff, int len, u_char* dest, u_char* src, int type); +u_int16_t ipv4_chksum(u_char* buff, int len); + + +#endif