packages feed

network-fancy 0.1 → 0.1.1

raw patch · 3 files changed

+55/−7 lines, 3 files

Files

Network/Fancy.hsc view
@@ -38,7 +38,33 @@ import GHC.Conc(asyncDoProc) #endif -#include "network-fancy.h"+#ifndef WINDOWS+#include <arpa/inet.h>+#include <errno.h>+#include <netdb.h>+#include <sys/socket.h>+#include <sys/un.h>+#define SAFE_ON_WIN unsafe++#ifndef AF_LOCAL+#define AF_LOCAL AF_UNIX+#endif++#else /* WINDOWS */++#include <winsock2.h>+#include <ws2tcpip.h>+#define sa_family_t short+#define AI_NUMERICSERV 0++struct network_fancy_aaccept {+  SOCKET s;+  struct sockaddr *addr;+  int alen;+};+#define SAFE_ON_WIN safe++#endif /* WINDOWS */  type HostName = String 
cbits.c view
@@ -1,5 +1,31 @@-#include "network-fancy.h"+#ifndef WINDOWS+#include <arpa/inet.h>+#include <errno.h>+#include <netdb.h>+#include <sys/socket.h>+#include <sys/un.h>+#define SAFE_ON_WIN unsafe +#ifndef AF_LOCAL+#define AF_LOCAL AF_UNIX+#endif++#else /* WINDOWS */++#include <winsock2.h>+#include <ws2tcpip.h>+#define sa_family_t short+#define AI_NUMERICSERV 0++struct network_fancy_aaccept {+  SOCKET s;+  struct sockaddr *addr;+  int alen;+};+#define SAFE_ON_WIN safe+++#endif int getSocketError(void) { return errno; }  int getsockopt_error(int fd) {
network-fancy.cabal view
@@ -1,5 +1,5 @@ Name:                network-fancy-Version:             0.1+Version:             0.1.1 Synopsis:            Networking support with a cleaner API Description:         Networking support with a cleaner API License:             BSD3@@ -16,8 +16,6 @@     Other-Modules:       Network.Fancy     GHC-Options:         -threaded     C-Sources:           cbits.c-    Includes:            network-fancy.h-    Include-dirs:        .     Build-depends:	 base == 4.*, bytestring, random, directory     Extensions:          TypeSynonymInstances, ForeignFunctionInterface, CPP, DeriveDataTypeable     if os(windows) {@@ -36,8 +34,6 @@     Build-Depends:       base == 4.*, bytestring     Exposed-modules:     Network.Fancy     C-Sources:           cbits.c-    Includes:            network-fancy.h-    Include-dirs:        .     GHC-Options:         -Wall     Extensions:          TypeSynonymInstances, ForeignFunctionInterface, CPP, DeriveDataTypeable     if os(windows) {