Skip to content
Snippets Groups Projects
Commit 5f36ebb7 authored by Avi Kivity's avatar Avi Kivity Committed by Pekka Enberg
Browse files

net: add ntoh()/hton() for in_addr

parent ef235552
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@
#define _NETINET_IP_H_
#include <sys/cdefs.h>
#include <bsd/sys/sys/param.h>
/*
* Definitions for internet protocol version 4.
......@@ -71,6 +72,20 @@ struct ip {
#define IP_MAXPACKET 65535 /* maximum packet size */
#ifdef __cplusplus
inline in_addr ntoh(in_addr a)
{
return { ntohl(a.s_addr) };
}
inline in_addr hton(in_addr a)
{
return { htonl(a.s_addr) };
}
#endif
/*
* Maximum number of bytes to be reserved for L2 header.
* Currently equals to ETH header size since this is the only
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment