inet_lnaof.c (65e96449) inet_lnaof.c (ab96eeab)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. 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

--- 20 unchanged lines hidden (view full) ---

29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if defined(LIBC_SCCS) && !defined(lint)
35static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. 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

--- 20 unchanged lines hidden (view full) ---

29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if defined(LIBC_SCCS) && !defined(lint)
35static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD$");
37
38#include "port_before.h"
39
40#include <sys/param.h>
41#include <netinet/in.h>
42#include <arpa/inet.h>
43
44#include "port_after.h"
45
46/*
47 * Return the local network address portion of an
48 * internet address; handles class a/b/c network
49 * number formats.
50 */
39
40#include "port_before.h"
41
42#include <sys/param.h>
43#include <netinet/in.h>
44#include <arpa/inet.h>
45
46#include "port_after.h"
47
48/*
49 * Return the local network address portion of an
50 * internet address; handles class a/b/c network
51 * number formats.
52 */
51u_long
53in_addr_t
52inet_lnaof(in)
53 struct in_addr in;
54{
54inet_lnaof(in)
55 struct in_addr in;
56{
55 register u_long i = ntohl(in.s_addr);
57 in_addr_t i = ntohl(in.s_addr);
56
57 if (IN_CLASSA(i))
58 return ((i)&IN_CLASSA_HOST);
59 else if (IN_CLASSB(i))
60 return ((i)&IN_CLASSB_HOST);
61 else
62 return ((i)&IN_CLASSC_HOST);
63}
58
59 if (IN_CLASSA(i))
60 return ((i)&IN_CLASSA_HOST);
61 else if (IN_CLASSB(i))
62 return ((i)&IN_CLASSB_HOST);
63 else
64 return ((i)&IN_CLASSC_HOST);
65}
66
67/*
68 * Weak aliases for applications that use certain private entry points,
69 * and fail to include <arpa/inet.h>.
70 */
71#undef inet_lnaof
72__weak_reference(__inet_lnaof, inet_lnaof);