1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(LIBC_SCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)inet_netof.c	5.2 (Berkeley) 3/9/86";
   9: #endif LIBC_SCCS and not lint
  10: 
  11: #include <sys/types.h>
  12: #include <netinet/in.h>
  13: 
  14: /*
  15:  * Return the network number from an internet
  16:  * address; handles class a/b/c network #'s.
  17:  */
  18: inet_netof(in)
  19:     struct in_addr in;
  20: {
  21:     register u_long i = ntohl(in.s_addr);
  22: 
  23:     if (IN_CLASSA(i))
  24:         return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
  25:     else if (IN_CLASSB(i))
  26:         return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
  27:     else
  28:         return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
  29: }
Last modified: 1986-03-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 778
Valid CSS Valid XHTML 1.0 Strict