in_cksum.h (a5f50ef9e43b28e15a7e2a2aec73754456619f17) | in_cksum.h (920b965865cd72bbb131f4461feb176074ce164a) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 25 unchanged lines hidden (view full) --- 34 35#ifndef _MACHINE_IN_CKSUM_H_ 36#define _MACHINE_IN_CKSUM_H_ 1 37 38#include <sys/cdefs.h> 39 40#define in_cksum(m, len) in_cksum_skip(m, len, 0) 41 | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 25 unchanged lines hidden (view full) --- 34 35#ifndef _MACHINE_IN_CKSUM_H_ 36#define _MACHINE_IN_CKSUM_H_ 1 37 38#include <sys/cdefs.h> 39 40#define in_cksum(m, len) in_cksum_skip(m, len, 0) 41 |
42#if defined(IPVERSION) && (IPVERSION == 4) |
|
42/* 43 * It it useful to have an Internet checksum routine which is inlineable 44 * and optimized specifically for the task of computing IP header checksums 45 * in the normal case (where there are no options and the header length is 46 * therefore always exactly five 32-bit words. 47 */ 48#ifdef __CC_SUPPORTS___INLINE 49 --- 10 unchanged lines hidden (view full) --- 60#define in_cksum_update(ip) \ 61 do { \ 62 int __tmpsum; \ 63 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 64 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 65 } while(0) 66 67#endif | 43/* 44 * It it useful to have an Internet checksum routine which is inlineable 45 * and optimized specifically for the task of computing IP header checksums 46 * in the normal case (where there are no options and the header length is 47 * therefore always exactly five 32-bit words. 48 */ 49#ifdef __CC_SUPPORTS___INLINE 50 --- 10 unchanged lines hidden (view full) --- 61#define in_cksum_update(ip) \ 62 do { \ 63 int __tmpsum; \ 64 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 65 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 66 } while(0) 67 68#endif |
69#endif |
|
68 69#ifdef _KERNEL | 70 71#ifdef _KERNEL |
72#if defined(IPVERSION) && (IPVERSION == 4) |
|
70u_int in_cksum_hdr(const struct ip *ip); | 73u_int in_cksum_hdr(const struct ip *ip); |
74#endif |
|
71u_short in_addword(u_short sum, u_short b); 72u_short in_pseudo(u_int sum, u_int b, u_int c); 73u_short in_cksum_skip(struct mbuf *m, int len, int skip); 74#endif 75 76#endif /* _MACHINE_IN_CKSUM_H_ */ | 75u_short in_addword(u_short sum, u_short b); 76u_short in_pseudo(u_int sum, u_int b, u_int c); 77u_short in_cksum_skip(struct mbuf *m, int len, int skip); 78#endif 79 80#endif /* _MACHINE_IN_CKSUM_H_ */ |