in_addr

Defines a network address.

Service:Networking

Structure

  #include <netinet/in.h>
  
  struct in_addr
  {
     union {
        struct {unsigned char s_b1, s_b2, s_b3, s_b4;} S_un_b; 
        struct {unsigned short s_w1, s_w2;}           S_un_w; 
        unsigned long                                 S_addr; 
     } S_un;
  #define s_addr  S_un.S_addr 
  #define s_host  S_un.S_un_b.s_b2
  #define s_net   S_un.S_un_b.s_b1
  #define s_imp   S_un.S_un_w.s_w2
  #define s_impno S_un.S_un_b.s_b4
  #define s_lh    S_un.S_un_b.s_b3 
  };
  
  typedef struct in_addr     in_addr_t;
  

Fields

s_b1

Specifies the first octet of the 32-bit IPv4 address.

s_b2

Specifies the second octet of the 32-bit IPv4 address.

s_b3

Specifies the third octet of the 32-bit IPv4 address.

s_b4

Specifies the fourth octet of the 32-bit IPv4 address.

s_w1

Specifies the first and second octets of the IPv4 address.

s_w2

Specifies the third and fourth octets of the IPv4 address.

S_addr

Specifies the 32-bit IPv4 address as a single unsigned long.

Remarks

The in_addr structure is used to pass the address in network byte order to sockaddr_in and by functions that manipulate addresses between network addresses format and standard dotted decimal notation.