packages feed

socket-0.3.0.1: socket.cabal

name:                socket
version:             0.3.0.1
synopsis:            A portable and extensible sockets library.
description:
  __Motivation__
  .
  This library aims to expose a minimal and platform-independant interface for
  POSIX compliant networking code.
  .
  __Implementation Philosophy__
  .
    - Every operation and every flag exposed should be supported with same
      semantics on every platform. If this cannot be guaranteed it should
      be supplied by another (extension) package.
      Examples for things that have been ripped out of this library are:
      Unix sockets, SCTP, vectored IO (for now).
  .
    - Absolutely no conditional export.
  .
    - No `#ifdef` madness in the Haskell sources. The Haskell binding code
      uses the FFI to reference the platform's native networking functions.
      If they are not Posix compliant (i.e. under Windows) an level of
      indirection is introduced to write an Posix compliant equivalent in C
      using whatever the plaform specific building blocks are.
  .
  __Platform Support__
  .
  /Linux/
  .
  Working.
  .
  /BSD/
  .
  Unknown. Should work. Please report if not.
  .
  /MacOS/
  .
  Unknown. Please report if you have a Mac.
  .
  /Windows/
  .
  Unfinished (problem with non-blocking IO).
  .
  Aim: Support Windows7 or higher. Don't have dependencies on autotools, just
  Haskell Platform with MinGW should suffice.
  .
  /Android/
  .
  Unknown. Should be supported. Please get in touch if you plan to use it.
license:             MIT
license-file:        LICENSE
author:              Lars Petersen
maintainer:          info@lars-petersen.net
category:            System, Network
build-type:          Simple
cabal-version:       >=1.10
homepage:            https://github.com/lpeterse/haskell-socket
bug-reports:         https://github.com/lpeterse/haskell-socket/issues
tested-with:         GHC==7.10.1, GHC==7.8.3
extra-source-files:  README.md
                     CHANGELOG.md
                     include/hs_socket.h
                     include/hs_socket_win32.h
                     include/hs_socket_posix.h
                     cbits/hs_socket_win32.c
                     cbits/hs_socket_posix.c

library
  exposed-modules:     System.Socket
                     , System.Socket.Family
                     , System.Socket.Family.INET
                     , System.Socket.Family.INET6
                     , System.Socket.Type
                     , System.Socket.Type.RAW
                     , System.Socket.Type.DGRAM
                     , System.Socket.Type.STREAM
                     , System.Socket.Type.SEQPACKET
                     , System.Socket.Protocol
                     , System.Socket.Protocol.UDP
                     , System.Socket.Protocol.TCP
                     , System.Socket.Unsafe
  other-modules:       System.Socket.Internal.FFI
                     , System.Socket.Internal.Event
                     , System.Socket.Internal.Socket
                     , System.Socket.Internal.Exception
                     , System.Socket.Internal.Msg
                     , System.Socket.Internal.AddrInfo
  build-depends:       base >= 4.7 && < 5
                     , bytestring < 0.11
  hs-source-dirs:      src
  build-tools:         hsc2hs
  default-language:    Haskell2010
  ghc-options:         -Wall

  include-dirs:        include
  install-includes:    hs_socket.h
  if os(windows)
    c-sources:         cbits/hs_socket_win32.c
    extra-libraries:   ws2_32
    cpp-options:       -DFFI_SOCKET="hs_socket"
                       -DFFI_SOCKET_SAFETY=safe
                       -DFFI_BIND="hs_bind"
                       -DFFI_BIND_SAFETY=safe
                       -DFFI_LISTEN="hs_listen"
                       -DFFI_LISTEN_SAFETY=safe
                       -DFFI_CLOSE="hs_close"
                       -DFFI_CLOSE_SAFETY=safe
                       -DFFI_ACCEPT="hs_accept"
                       -DFFI_ACCEPT_SAFETY=safe
                       -DFFI_CONNECT="hs_connect"
                       -DFFI_CONNECT_SAFETY=safe
                       -DFFI_SEND="hs_send"
                       -DFFI_SEND_SAFETY=safe
                       -DFFI_SENDTO="hs_sendto"
                       -DFFI_SENDTO_SAFETY=safe
                       -DFFI_SENDMSG="hs_sendmsg"
                       -DFFI_SENDMSG_SAFETY=safe
                       -DFFI_RECV="hs_recv"
                       -DFFI_RECV_SAFETY=safe
                       -DFFI_RECVFROM="hs_recvfrom"
                       -DFFI_RECVFROM_SAFETY=safe
                       -DFFI_RECVMSG="hs_recvmsg"
                       -DFFI_RECVMSG_SAFETY=safe
                       -DFFI_GETSOCKOPT="hs_getsockopt"
                       -DFFI_GETSOCKOPT_SAFETY=safe
                       -DFFI_SETSOCKOPT="hs_setsockopt"
                       -DFFI_SETSOCKOPT_SAFETY=safe
                       -DFFI_GETADDRINFO="hs_getaddrinfo"
                       -DFFI_GETADDRINFO_SAFETY=safe
                       -DFFI_FREEADDRINFO="hs_freeaddrinfo"
                       -DFFI_FREEADDRINFO_SAFETY=unsafe
                       -DFFI_GETNAMEINFO="hs_getnameinfo"
                       -DFFI_GETNAMEINFO_SAFETY=safe
                       -DFFI_GAI_STRERROR="hs_gai_strerror"
                       -DFFI_GAI_STRERROR_SAFETY=unsafe
  else
    c-sources:         cbits/hs_socket_posix.c
    cpp-options:       -DFFI_SOCKET="socket"
                       -DFFI_SOCKET_SAFETY=unsafe
                       -DFFI_BIND="bind"
                       -DFFI_BIND_SAFETY=unsafe
                       -DFFI_LISTEN="listen"
                       -DFFI_LISTEN_SAFETY=unsafe
                       -DFFI_CLOSE="close"
                       -DFFI_CLOSE_SAFETY=unsafe
                       -DFFI_ACCEPT="accept"
                       -DFFI_ACCEPT_SAFETY=unsafe
                       -DFFI_CONNECT="connect"
                       -DFFI_CONNECT_SAFETY=unsafe
                       -DFFI_SEND="send"
                       -DFFI_SEND_SAFETY=unsafe
                       -DFFI_SENDTO="sendto"
                       -DFFI_SENDTO_SAFETY=unsafe
                       -DFFI_SENDMSG="sendmsg"
                       -DFFI_SENDMSG_SAFETY=unsafe
                       -DFFI_RECV="recv"
                       -DFFI_RECV_SAFETY=unsafe
                       -DFFI_RECVFROM="recvfrom"
                       -DFFI_RECVFROM_SAFETY=unsafe
                       -DFFI_RECVMSG="recvmsg"
                       -DFFI_RECVMSG_SAFETY=unsafe
                       -DFFI_GETSOCKOPT="getsockopt"
                       -DFFI_GETSOCKOPT_SAFETY=unsafe
                       -DFFI_SETSOCKOPT="setsockopt"
                       -DFFI_SETSOCKOPT_SAFETY=unsafe
                       -DFFI_GETADDRINFO="getaddrinfo"
                       -DFFI_GETADDRINFO_SAFETY=safe
                       -DFFI_FREEADDRINFO="freeaddrinfo"
                       -DFFI_FREEADDRINFO_SAFETY=unsafe
                       -DFFI_GETNAMEINFO="getnameinfo"
                       -DFFI_GETNAMEINFO_SAFETY=safe
                       -DFFI_GAI_STRERROR="gai_strerror"
                       -DFFI_GAI_STRERROR_SAFETY=unsafe

test-suite basic
  hs-source-dirs:      tests
  main-is:             Basic.hs
  type:                exitcode-stdio-1.0
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5
                     , bytestring < 0.11
                     , socket
                     , async

test-suite AddrInfo
  hs-source-dirs:      tests
  main-is:             AddrInfo.hs
  type:                exitcode-stdio-1.0
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5
                     , bytestring < 0.11
                     , socket

source-repository head
  type:     git
  location: git://github.com/lpeterse/haskell-socket.git