Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on LWIP #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions include/posix/netinet/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,57 @@

#include <netinet/in6.h>

#ifndef CONFIG_LWIP
/**
* Convert an u16_t from host- to network byte order.
*
* @param n u16_t in host byte order
* @return n in network byte order
*/
inline u16_t
htons(u16_t n)
{
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
}

/**
* Convert an u16_t from network- to host byte order.
*
* @param n u16_t in network byte order
* @return n in host byte order
*/
inline u16_t
ntohs(u16_t n)
{
return htons(n);
}

/**
* Convert an u32_t from host- to network byte order.
*
* @param n u32_t in host byte order
* @return n in network byte order
*/
inline u32_t
htonl(u32_t n)
{
return ((n & 0xff) << 24) |
((n & 0xff00) << 8) |
((n & 0xff0000UL) >> 8) |
((n & 0xff000000UL) >> 24);
}

/**
* Convert an u32_t from network- to host byte order.
*
* @param n u32_t in network byte order
* @return n in host byte order
*/
inline u32_t
ntohl(u32_t n)
{
return htonl(n);
}
#endif

#endif /* _POSIX_SYS_IN_H_ */
8 changes: 5 additions & 3 deletions stub.mk
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CONFIG_CONSFRONT ?= n
CONFIG_CONSFRONT_SYNC ?= n
CONFIG_XENBUS ?= y
CONFIG_XC ?= y
CONFIG_LWIP ?= y
CONFIG_LWIP ?= n
CONFIG_SHUTDOWN ?= y
CONFIG_PVH ?= y

Expand All @@ -146,8 +146,6 @@ MINIOS_OBJS0-y := \
hypervisor.o \
kernel.o \
lock.o \
lwip-arch.o \
lwip-net.o \
main.o \
math.o \
mm.o \
Expand All @@ -159,6 +157,7 @@ MINIOS_OBJS0-y := \
sys.o \
xencons_ring.o \
xmalloc.o
MINIOS_OBJS0-$(CONFIG_LWIP) += lwip-arch.o lwip-net.o
MINIOS_OBJS0-$(CONFIG_XENBUS) += xenbus.o
MINIOS_OBJS0-$(CONFIG_XENBUS) += xs.o
MINIOS_OBJS0-$(CONFIG_BLKFRONT) += blkfront.o
Expand All @@ -169,6 +168,7 @@ MINIOS_OBJS0-$(CONFIG_FBFRONT) += fbfront.o
MINIOS_OBJS0-$(CONFIG_PCIFRONT) += pcifront.o
MINIOS_OBJS0-$(CONFIG_CONSFRONT) += xencons_bus.o
MINIOS_OBJS0-$(CONFIG_NETFRONT) += netfront.o
MINIOS_OPT_FLAGS-$(CONFIG_LWIP) += -DCONFIG_LWIP
MINIOS_OPT_FLAGS-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
MINIOS_OPT_FLAGS-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
MINIOS_OPT_FLAGS-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
Expand Down Expand Up @@ -387,6 +387,8 @@ distclean-lwip:

else

CINCLUDES += -isystem $(LWIP_ROOT)/include/lwip
CINCLUDES += -isystem $(LWIP_ROOT)/include/lwip/ipv4
MINIOS_LWIP_LIB :=
MINIOS_LWIP_OBJS :=

Expand Down