Skip to content

haiku: depends on libnetwork #561

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

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
4 changes: 4 additions & 0 deletions Network/Socket/Posix/Cmsg.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ pattern CmsgIdIPv4TOS = CmsgId (#const IPPROTO_IP) (#const IP_TOS)

-- | The identifier for 'IPv6TClass'.
pattern CmsgIdIPv6TClass :: CmsgId
#if defined(IPV6_TCLASS)
pattern CmsgIdIPv6TClass = CmsgId (#const IPPROTO_IPV6) (#const IPV6_TCLASS)
#else
pattern CmsgIdIPv6TClass = CmsgId (-1) (-1)
#endif

-- | The identifier for 'IPv4PktInfo'.
pattern CmsgIdIPv4PktInfo :: CmsgId
Expand Down
16 changes: 16 additions & 0 deletions cbits/swap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <netinet/in.h>

static uint32_t my_htonl(uint32_t x) { return htonl(x); }
static uint16_t my_htons(uint16_t x) { return htons(x); }
static uint32_t my_ntohl(uint32_t x) { return ntohl(x); }
static uint32_t my_ntohs(uint16_t x) { return ntohs(x); }

#undef htonl
#undef htons
#undef ntohl
#undef ntohs

uint32_t htonl(uint32_t x) { return my_htonl(x); }
uint32_t htons(uint16_t x) { return my_htons(x); }
uint32_t ntohl(uint32_t x) { return my_ntohl(x); }
uint32_t ntohs(uint16_t x) { return my_ntohs(x); }
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ AC_CHECK_FUNCS([gai_strerror gethostent accept4])
AC_CHECK_FUNCS([getpeereid])

AC_CHECK_DECLS([AI_ADDRCONFIG, AI_ALL, AI_NUMERICSERV, AI_V4MAPPED])
AC_CHECK_DECLS([IPV6_V6ONLY])
AC_CHECK_DECLS([IPV6_V6ONLY, IPV6_TCLASS])
AC_CHECK_DECLS([IPPROTO_IP, IPPROTO_TCP, IPPROTO_IPV6])
AC_CHECK_DECLS([SO_PEERCRED])

Expand Down
7 changes: 7 additions & 0 deletions network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ library
build-depends:
temporary

if os(haiku)
c-sources:
cbits/swap.c

extra-libraries:
network

if impl(ghc >=8)
default-extensions: Strict StrictData

Expand Down