/* checksum.h: IP/UDP/TCP checksum routines on the V9. * * Copyright(C) 1995 Linus Torvalds * Copyright(C) 1995 Miguel de Icaza * Copyright(C) 1996 David S. Miller * Copyright(C) 1996 Eddie C. Dost * Copyright(C) 1997 Jakub Jelinek * * derived from: * Alpha checksum c-code * ix86 inline assembly * RFC1071 Computing the Internet Checksum
*/
#include <linux/in6.h> #include <linux/uaccess.h>
/* computes the checksum of a memory block at buff, length len, * and adds in "sum" (32-bit) * * returns a 32-bit number suitable for feeding into itself * or csum_tcpudp_magic * * this function must be called with even lengths, except * for the last fragment, which may be odd * * it's best to have buff aligned on a 32-bit boundary
*/
__wsum csum_partial(constvoid * buff, int len, __wsum sum);
/* the same as csum_partial, but copies from user space while it * checksums * * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary
*/
__wsum csum_partial_copy_nocheck(constvoid *src, void *dst, int len);
__wsum csum_and_copy_from_user(constvoid __user *src, void *dst, int len);
__wsum csum_and_copy_to_user(constvoid *src, void __user *dst, int len);
/* ihl is always 5 or greater, almost always is 5, and iph is word aligned * the majority of the time.
*/
__sum16 ip_fast_csum(constvoid *iph, unsignedint ihl);
/* Fold a partial checksum without adding pseudo headers. */ staticinline __sum16 csum_fold(__wsum sum)
{ unsignedint tmp;
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ staticinline __sum16 ip_compute_csum(constvoid *buff, int len)
{ return csum_fold(csum_partial(buff, len, 0));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.