network-transport 0.4.0.0 → 0.4.1.0
raw patch · 4 files changed
+21/−2 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Network.Transport: instance Typeable1 TransportError
+ Network.Transport: instance Data EndPointAddress
+ Network.Transport: instance Typeable TransportError
Files
- ChangeLog +5/−0
- network-transport.cabal +3/−1
- src/Network/Transport.hs +2/−1
- src/Network/Transport/Internal.hs +11/−0
ChangeLog view
@@ -1,3 +1,8 @@+2014-12-09 Tim Watson <watson.timothy@gmail.com> 0.4.1.0++* foreigns htonl, ntohl, htons, ntohs are imported from ws2_32 on windows +* Created Data instance for EndPointAddress (thanks Andrew Rademacher)+ 2014-05-30 Tim Watson <watson.timothy@gmail.com> 0.4.0.0 * Fix build for GHC 7.4 - thanks mboes!
network-transport.cabal view
@@ -1,5 +1,5 @@ Name: network-transport-Version: 0.4.0.0+Version: 0.4.1.0 Cabal-Version: >=1.6 Build-Type: Simple License: BSD3 @@ -82,3 +82,5 @@ CPP GHC-Options: -Wall -fno-warn-unused-do-bind HS-Source-Dirs: src+ if os(win32)+ extra-libraries: ws2_32
src/Network/Transport.hs view
@@ -32,6 +32,7 @@ import Data.Binary (Binary(put, get), putWord8, getWord8) import Data.Hashable import Data.Word (Word64)+import Data.Data (Data) -------------------------------------------------------------------------------- -- Main API --@@ -140,7 +141,7 @@ -- | EndPointAddress of an endpoint. newtype EndPointAddress = EndPointAddress { endPointAddressToByteString :: ByteString }- deriving (Eq, Ord, Typeable, Hashable)+ deriving (Eq, Ord, Typeable, Data, Hashable) instance Binary EndPointAddress where put = put . endPointAddressToByteString
src/Network/Transport/Internal.hs view
@@ -51,10 +51,21 @@ import System.Timeout (timeout) --import Control.Concurrent (myThreadId) +#ifdef mingw32_HOST_OS++foreign import stdcall unsafe "htonl" htonl :: CInt -> CInt+foreign import stdcall unsafe "ntohl" ntohl :: CInt -> CInt+foreign import stdcall unsafe "htons" htons :: CShort -> CShort+foreign import stdcall unsafe "ntohs" ntohs :: CShort -> CShort++#else+ foreign import ccall unsafe "htonl" htonl :: CInt -> CInt foreign import ccall unsafe "ntohl" ntohl :: CInt -> CInt foreign import ccall unsafe "htons" htons :: CShort -> CShort foreign import ccall unsafe "ntohs" ntohs :: CShort -> CShort++#endif -- | Serialize 32-bit to network byte order encodeInt32 :: Enum a => a -> ByteString