31,7 → 31,7 |
*/ |
|
/** @file |
* |
* INET family common definitions. |
*/ |
|
#ifndef __NET_IN_H__ |
42,20 → 42,45 |
#include "ip_protocols.h" |
#include "inet.h" |
|
/** INET string address maximum length. |
*/ |
#define INET_ADDRSTRLEN ( 4 * 3 + 3 + 1 ) |
|
/** Type definition of the INET address. |
* @see in_addr |
*/ |
typedef struct in_addr in_addr_t; |
|
/** Type definition of the INET socket address. |
* @see sockaddr_in |
*/ |
typedef struct sockaddr_in sockaddr_in_t; |
|
/** INET address. |
*/ |
struct in_addr{ |
uint32_t s_addr; // that's a 32-bit int (4 bytes) |
/** 4 byte IP address. |
*/ |
uint32_t s_addr; |
}; |
|
/** INET socket address. |
* @see sockaddr |
*/ |
struct sockaddr_in{ |
uint16_t sin_family; // Address family, AF_INET |
uint16_t sin_port; // Port number |
struct in_addr sin_addr; // Internet address |
uint8_t sin_zero[ 8 ]; // Same size as struct sockaddr |
/** Address family. |
* Should be AF_INET. |
*/ |
uint16_t sin_family; |
/** Port number. |
*/ |
uint16_t sin_port; |
/** Internet address. |
*/ |
struct in_addr sin_addr; |
/** Padding to meet the sockaddr size. |
*/ |
uint8_t sin_zero[ 8 ]; |
}; |
|
#endif |