1: 
   2: /*
   3:  * Copyright (c) 1983 Regents of the University of California.
   4:  * All rights reserved.  The Berkeley software License Agreement
   5:  * specifies the terms and conditions for redistribution.
   6:  */
   7: 
   8: #ifndef lint
   9: static char sccsid[] = "@(#)cksum.c	2.1 (Berkeley) 6/6/86";
  10: #endif not lint
  11: 
  12: #include "../globals.h"
  13: #include <protocols/timed.h>
  14: 
  15: /* computes the checksum for ip packets for a pdp-11 base computer */
  16: 
  17: in_cksum(w, mlen)
  18:     register u_char *w;     /* known to be r4 */
  19:     register u_int mlen;        /* known to be r3 */
  20: {
  21:     register u_int sum = 0;         /* known to be r2 */
  22: 
  23:     if (mlen > 0) {
  24:         if (mlen & 01) {
  25:             /*
  26: 			 * The segment is an odd length, add the high
  27: 			 * order byte into the checksum.
  28: 			 */
  29:             sum = in_ckadd(sum,(*w++ << 8));
  30:             mlen--;
  31:         }
  32:         if (mlen > 0)
  33:             in_ckbuf();     /* arguments already in registers */
  34:     }
  35:     return (~sum);
  36: }

Defined functions

in_cksum defined in line 17; never used

Defined variables

sccsid defined in line 9; never used
Last modified: 1987-07-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2396
Valid CSS Valid XHTML 1.0 Strict