Back to index

glibc  2.9
Functions
inet_mkadr.c File Reference
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>

Go to the source code of this file.

Functions

struct in_addr inet_makeaddr (in_addr_t net, in_addr_t host)

Function Documentation

struct in_addr inet_makeaddr ( in_addr_t  net,
in_addr_t  host 
) [read]

Definition at line 43 of file inet_mkadr.c.

{
       struct in_addr in;

       if (net < 128)
              in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
       else if (net < 65536)
              in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
       else if (net < 16777216L)
              in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
       else
              in.s_addr = net | host;
       in.s_addr = htonl(in.s_addr);
       return in;
}

Here is the caller graph for this function: