File: inet.h

package info (click to toggle)
picolibc 1.8.11-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 50,064 kB
  • sloc: ansic: 404,031; asm: 24,984; sh: 2,585; python: 2,289; perl: 680; pascal: 329; exp: 287; makefile: 222; cpp: 71; xml: 40
file content (30 lines) | stat: -rw-r--r-- 909 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Copyright (c) 2004 Jeff Johnston  <jjohnstn@redhat.com> */
#ifndef __ARPA_INET_H__
#define __ARPA_INET_H__

#include <endian.h>

/* byteorder(3) - simimlar to linux <arpa/inet.h> */
#ifndef __machine_host_to_from_network_defined
#if _BYTE_ORDER == _LITTLE_ENDIAN
#define __htonl(_x) __bswap32(_x)
#define __htons(_x) __bswap16(_x)
#define __ntohl(_x) __bswap32(_x)
#define __ntohs(_x) __bswap16(_x)
#define htonl(_x)   __htonl(_x)
#define htons(_x)   __htons(_x)
#define ntohl(_x)   __htonl(_x)
#define ntohs(_x)   __htons(_x)
#else
#define __htonl(_x) ((__uint32_t)(_x))
#define __htons(_x) ((__uint16_t)(_x))
#define __ntohl(_x) ((__uint32_t)(_x))
#define __ntohs(_x) ((__uint16_t)(_x))
#define htonl(_x)   __htonl(_x)
#define htons(_x)   __htons(_x)
#define ntohl(_x)   __ntohl(_x)
#define ntohs(_x)   __ntohs(_x)
#endif
#endif /* __machine_host_to_from_network_defined */

#endif /* __ARPA_INET_H__ */