inet_lnaof.c (dde4a85d9ddb5d516c37a565156ef509738c3c22) inet_lnaof.c (060e5496fc388fc6c9f2f377050f69f8e8cd15b0)
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

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

42#include "port_after.h"
43
44/*%
45 * Return the local network address portion of an
46 * internet address; handles class a/b/c network
47 * number formats.
48 */
49in_addr_t
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

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

42#include "port_after.h"
43
44/*%
45 * Return the local network address portion of an
46 * internet address; handles class a/b/c network
47 * number formats.
48 */
49in_addr_t
50inet_lnaof(in)
51 struct in_addr in;
50inet_lnaof(struct in_addr in)
52{
53 in_addr_t i = ntohl(in.s_addr);
54
55 if (IN_CLASSA(i))
56 return ((i)&IN_CLASSA_HOST);
57 else if (IN_CLASSB(i))
58 return ((i)&IN_CLASSB_HOST);
59 else
60 return ((i)&IN_CLASSC_HOST);
61}
62
63/*
64 * Weak aliases for applications that use certain private entry points,
65 * and fail to include <arpa/inet.h>.
66 */
67#undef inet_lnaof
68__weak_reference(__inet_lnaof, inet_lnaof);
69
70/*! \file */
51{
52 in_addr_t i = ntohl(in.s_addr);
53
54 if (IN_CLASSA(i))
55 return ((i)&IN_CLASSA_HOST);
56 else if (IN_CLASSB(i))
57 return ((i)&IN_CLASSB_HOST);
58 else
59 return ((i)&IN_CLASSC_HOST);
60}
61
62/*
63 * Weak aliases for applications that use certain private entry points,
64 * and fail to include <arpa/inet.h>.
65 */
66#undef inet_lnaof
67__weak_reference(__inet_lnaof, inet_lnaof);
68
69/*! \file */