purge socketaddr call in favor of getsockname
[unix-history] / usr / src / lib / libc / net / inet_makeaddr.c
CommitLineData
056d5bbd 1/* inet_makeaddr.c 4.3 82/11/14 */
9b8667c0
SL
2
3#include <sys/types.h>
056d5bbd 4#include <netinet/in.h>
9b8667c0
SL
5
6/*
7 * Formulate an Internet address from network + host. Used in
8 * building addresses stored in the ifnet structure.
9 */
10struct in_addr
3a3b7ace 11inet_makeaddr(net, host)
9b8667c0
SL
12 int net, host;
13{
14 u_long addr;
15
16 if (net < 128)
056d5bbd 17 addr = (net << IN_CLASSA_NSHIFT) | host;
9b8667c0 18 else if (net < 65536)
056d5bbd 19 addr = (net << IN_CLASSB_NSHIFT) | host;
9b8667c0 20 else
056d5bbd 21 addr = (net << IN_CLASSC_NSHIFT) | host;
9b8667c0
SL
22 addr = htonl(addr);
23 return (*(struct in_addr *)&addr);
24}