IPPOLib
 All Classes Files Functions Variables Typedefs Macros
checksum.h
Go to the documentation of this file.
1 /*
2  * ippo-lib - IP oPtion-based active PrObing
3  * An Active Probing Library for IP Options Equipped probes (http://traffic.comics.unina.it/ippolib)
4  *
5  * Copyright : (C) 2012 by Pietro Marchetta, Walter de Donato, Francesco Cesareo,
6  * Antonio Pescape' (PI)
7  * of the COMICS (COMputer for Interaction and
8  * CommunicationS) Group, Dipartimento di Informatica
9  * e Sistemistica of the University of Napoli "Federico II".
10  *
11  * email : pietro.marchetta@unina.it , walter.dedonato@unina.it , cesareo.francesco@gmail.com
12  * pescape@unina.it
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  */
28 
29 #ifndef CHECKSUM_H
30 #define CHECKSUM_H
31 
32 #include <string.h>
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <stdint.h>
36 
37 u_short in_chksum (u_short *addr, int len);
38 uint16_t udp_sum_calc( uint16_t len_udp, uint32_t src_addr, uint16_t src_port, uint32_t dest_addr, uint16_t dest_port, const void * buff );
39 uint16_t udp_sum_calc2(uint16_t len_udp, uint16_t src_addr[],uint16_t dest_addr[], bool padding, uint16_t buff[]);
40 unsigned short in_chksum_udp( unsigned short *h, unsigned short * d, int dlen );
41 unsigned short in_chksum_tcp( unsigned short *h, unsigned short * d, int dlen );
42 unsigned short cksum(unsigned short *addr, int len);
43 
44 #endif // CHECKSUM_H