Rev 4559 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4559 | Rev 4704 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | /** @addtogroup net |
29 | /** @addtogroup net |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | 32 | ||
33 | /** @file |
33 | /** @file |
34 | * |
34 | * INET family common definitions. |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #ifndef __NET_IN_H__ |
37 | #ifndef __NET_IN_H__ |
38 | #define __NET_IN_H__ |
38 | #define __NET_IN_H__ |
39 | 39 | ||
40 | #include <sys/types.h> |
40 | #include <sys/types.h> |
41 | 41 | ||
42 | #include "ip_protocols.h" |
42 | #include "ip_protocols.h" |
43 | #include "inet.h" |
43 | #include "inet.h" |
44 | 44 | ||
- | 45 | /** INET string address maximum length. |
|
- | 46 | */ |
|
45 | #define INET_ADDRSTRLEN ( 4 * 3 + 3 + 1 ) |
47 | #define INET_ADDRSTRLEN ( 4 * 3 + 3 + 1 ) |
46 | 48 | ||
- | 49 | /** Type definition of the INET address. |
|
- | 50 | * @see in_addr |
|
- | 51 | */ |
|
47 | typedef struct in_addr in_addr_t; |
52 | typedef struct in_addr in_addr_t; |
- | 53 | ||
- | 54 | /** Type definition of the INET socket address. |
|
- | 55 | * @see sockaddr_in |
|
- | 56 | */ |
|
48 | typedef struct sockaddr_in sockaddr_in_t; |
57 | typedef struct sockaddr_in sockaddr_in_t; |
49 | 58 | ||
- | 59 | /** INET address. |
|
- | 60 | */ |
|
50 | struct in_addr{ |
61 | struct in_addr{ |
- | 62 | /** 4 byte IP address. |
|
- | 63 | */ |
|
51 | uint32_t s_addr; // that's a 32-bit int (4 bytes) |
64 | uint32_t s_addr; |
52 | }; |
65 | }; |
53 | 66 | ||
- | 67 | /** INET socket address. |
|
- | 68 | * @see sockaddr |
|
- | 69 | */ |
|
54 | struct sockaddr_in{ |
70 | struct sockaddr_in{ |
- | 71 | /** Address family. |
|
- | 72 | * Should be AF_INET. |
|
- | 73 | */ |
|
55 | uint16_t sin_family; // Address family, AF_INET |
74 | uint16_t sin_family; |
- | 75 | /** Port number. |
|
- | 76 | */ |
|
56 | uint16_t sin_port; // Port number |
77 | uint16_t sin_port; |
- | 78 | /** Internet address. |
|
- | 79 | */ |
|
57 | struct in_addr sin_addr; // Internet address |
80 | struct in_addr sin_addr; |
- | 81 | /** Padding to meet the sockaddr size. |
|
- | 82 | */ |
|
58 | uint8_t sin_zero[ 8 ]; // Same size as struct sockaddr |
83 | uint8_t sin_zero[ 8 ]; |
59 | }; |
84 | }; |
60 | 85 | ||
61 | #endif |
86 | #endif |
62 | 87 | ||
63 | /** @} |
88 | /** @} |