Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
in.h
Go to the documentation of this file.
1
34#ifndef _NETINET_IN_H_
35#define _NETINET_IN_H_
36
37
38#include <inttypes.h>
39#include <sys/socket.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
46typedef uint32_t in_addr_t;
48struct in_addr
49{
52};
53
56{
57 uint16_t sin_family;
58 uint16_t sin_port;
62 unsigned char sin_zero[sizeof (struct sockaddr) - sizeof(uint16_t) -
63 sizeof (uint16_t) - sizeof (struct in_addr)];
64};
65
67#define INADDR_ANY (0)
68
70#define IPPROTO_TCP (6)
71
73#define IPPROTO_UDP (17)
74
76#define IPPROTO_RAW (255)
77
78#include <endian.h>
79
80#ifdef CONFIG_ENDIAN_BIG
81#define ntohl(x) (x)
82#define ntohs(x) (x)
83#define htonl(x) (x)
84#define htons(x) (x)
85#else
87#define ntohl(x) __bswap_32 (x)
89#define ntohs(x) __bswap_16 (x)
91#define htonl(x) __bswap_32 (x)
93#define htons(x) __bswap_16 (x)
94#endif
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* _NETINET_IN_H_ */
uint32_t in_addr_t
Primitive typeholding an ipv4 address.
Definition in.h:46
Structure describing an Internet address.
Definition in.h:49
in_addr_t s_addr
Address.
Definition in.h:51
Structure describing an Internet socket address.
Definition in.h:56
uint16_t sin_family
protocol family (AF_INET)
Definition in.h:57
uint16_t sin_port
port number
Definition in.h:58
struct in_addr sin_addr
internet address
Definition in.h:59
unsigned char sin_zero[sizeof(struct sockaddr) - sizeof(uint16_t) - sizeof(uint16_t) - sizeof(struct in_addr)]
Padding to size of ‘struct sockaddr’.
Definition in.h:63
IPv4 socket address.
Definition socket.h:83