streaming-commons-0.2.3.1: Common lower-level functions needed by various streaming data libraries

Safe Haskell | None
Language | Haskell2010

Data.Streaming.Network.Internal

Synopsis

- data ServerSettings = ServerSettings {
  - serverPort :: !Int
  - serverHost :: !HostPreference
  - serverSocket :: !(Maybe Socket)
  - serverAfterBind :: !(Socket -> IO ())
  - serverNeedLocalAddr :: !Bool
  - serverReadBufferSize :: !Int
  }
- data ClientSettings = ClientSettings {
  - clientPort :: !Int
  - clientHost :: !ByteString
  - clientAddrFamily :: !Family
  - clientReadBufferSize :: !Int
  }
- data HostPreference
  - = HostAny
  - | HostIPv4
  - | HostIPv4Only
  - | HostIPv6
  - | HostIPv6Only
  - | Host String
- data Message = Message {
  - msgData :: !ByteString
  - msgSender :: !SockAddr
  }
- data AppData = AppData {
  - appRead' :: !(IO ByteString)
  - appWrite' :: !(ByteString -> IO ())
  - appSockAddr' :: !SockAddr
  - appLocalAddr' :: !(Maybe SockAddr)
  - appCloseConnection' :: !(IO ())
  - appRawSocket' :: Maybe Socket
  }
- data ServerSettingsUnix = ServerSettingsUnix {
  - serverPath :: !FilePath
  - serverAfterBindUnix :: !(Socket -> IO ())
  - serverReadBufferSizeUnix :: !Int
  }
- data ClientSettingsUnix = ClientSettingsUnix {
  - clientPath :: !FilePath
  - clientReadBufferSizeUnix :: !Int
  }
- data AppDataUnix = AppDataUnix {
  - appReadUnix :: !(IO ByteString)
  - appWriteUnix :: !(ByteString -> IO ())
  }

# Documentation

data ServerSettings Source #

Settings for a TCP server. It takes a port to listen on, and an optional hostname to bind to.

Constructors

ServerSettings |

Fields

- serverPort :: !Int
- serverHost :: !HostPreference
- serverSocket :: !(Maybe Socket)

  listening socket

- serverAfterBind :: !(Socket -> IO ())
- serverNeedLocalAddr :: !Bool
- serverReadBufferSize :: !Int

#### Instances

Instances details

HasAfterBind ServerSettings Source # |
Instance details Defined in Data.Streaming.Network Methods afterBindLens :: Functor f => ((Socket -> IO ()) -> f (Socket -> IO ())) -> ServerSettings -> f ServerSettings Source #
HasPort ServerSettings Source # |
Instance details Defined in Data.Streaming.Network Methods portLens :: Functor f => (Int -> f Int) -> ServerSettings -> f ServerSettings Source #
HasReadBufferSize ServerSettings Source # | Since 0.1.13
Instance details Defined in Data.Streaming.Network Methods readBufferSizeLens :: Functor f => (Int -> f Int) -> ServerSettings -> f ServerSettings Source #

data ClientSettings Source #

Settings for a TCP client, specifying how to connect to the server.

Constructors

ClientSettings |

Fields

- clientPort :: !Int
- clientHost :: !ByteString
- clientAddrFamily :: !Family
- clientReadBufferSize :: !Int

#### Instances

Instances details

HasPort ClientSettings Source # |
Instance details Defined in Data.Streaming.Network Methods portLens :: Functor f => (Int -> f Int) -> ClientSettings -> f ClientSettings Source #
HasReadBufferSize ClientSettings Source # | Since 0.1.13
Instance details Defined in Data.Streaming.Network Methods readBufferSizeLens :: Functor f => (Int -> f Int) -> ClientSettings -> f ClientSettings Source #

data HostPreference Source #

Which host to bind.

Note: The `IsString` instance recognizes the following special values:

- `*` means `HostAny` - "any IPv4 or IPv6 hostname"
- `*4` means `HostIPv4` - "any IPv4 or IPv6 hostname, IPv4 preferred"
- `!4` means `HostIPv4Only` - "any IPv4 hostname"
- `*6` means `HostIPv6`@ - "any IPv4 or IPv6 hostname, IPv6 preferred"
- `!6` means `HostIPv6Only` - "any IPv6 hostname"

Note that the permissive `*` values allow binding to an IPv4 or an IPv6 hostname, which means you might be able to successfully bind to a port more times than you expect (eg once on the IPv4 localhost 127.0.0.1 and again on the IPv6 localhost 0:0:0:0:0:0:0:1).

Any other value is treated as a hostname. As an example, to bind to the IPv4 local host only, use "127.0.0.1".

Constructors

HostAny |
HostIPv4 |
HostIPv4Only |
HostIPv6 |
HostIPv6Only |
Host String |

#### Instances

Instances details

IsString HostPreference Source # |
Instance details Defined in Data.Streaming.Network.Internal Methods fromString :: String -> HostPreference Source #
Read HostPreference Source # |
Instance details Defined in Data.Streaming.Network.Internal Methods readsPrec :: Int -> ReadS HostPreference Source # readList :: ReadS [HostPreference] Source # readPrec :: ReadPrec HostPreference Source # readListPrec :: ReadPrec [HostPreference] Source #
Show HostPreference Source # |
Instance details Defined in Data.Streaming.Network.Internal Methods showsPrec :: Int -> HostPreference -> ShowS Source # show :: HostPreference -> String Source # showList :: [HostPreference] -> ShowS Source #
Eq HostPreference Source # |
Instance details Defined in Data.Streaming.Network.Internal Methods (==) :: HostPreference -> HostPreference -> Bool Source # (/=) :: HostPreference -> HostPreference -> Bool Source #
Ord HostPreference Source # |

Instance details

Defined in Data.Streaming.Network.Internal

Methods

compare :: HostPreference -> HostPreference -> Ordering Source #

(<) :: HostPreference -> HostPreference -> Bool Source #

(<=) :: HostPreference -> HostPreference -> Bool Source #

(>) :: HostPreference -> HostPreference -> Bool Source #

(>=) :: HostPreference -> HostPreference -> Bool Source #

max :: HostPreference -> HostPreference -> HostPreference Source #

min :: HostPreference -> HostPreference -> HostPreference Source #

data Message Source #

Representation of a single UDP message

Constructors

Message |

Fields

- msgData :: !ByteString
- msgSender :: !SockAddr

data AppData Source #

The data passed to an `Application`.

Constructors

AppData |

Fields

- appRead' :: !(IO ByteString)
- appWrite' :: !(ByteString -> IO ())
- appSockAddr' :: !SockAddr
- appLocalAddr' :: !(Maybe SockAddr)
- appCloseConnection' :: !(IO ())
- appRawSocket' :: Maybe Socket

#### Instances

Instances details

HasReadWrite AppData Source # |
Instance details Defined in Data.Streaming.Network Methods readLens :: Functor f => (IO ByteString -> f (IO ByteString)) -> AppData -> f AppData Source # writeLens :: Functor f => ((ByteString -> IO ()) -> f (ByteString -> IO ())) -> AppData -> f AppData Source #

data ServerSettingsUnix Source #

Settings for a Unix domain sockets server.

Constructors

ServerSettingsUnix |

Fields

- serverPath :: !FilePath
- serverAfterBindUnix :: !(Socket -> IO ())
- serverReadBufferSizeUnix :: !Int

#### Instances

Instances details

HasAfterBind ServerSettingsUnix Source # |
Instance details Defined in Data.Streaming.Network Methods afterBindLens :: Functor f => ((Socket -> IO ()) -> f (Socket -> IO ())) -> ServerSettingsUnix -> f ServerSettingsUnix Source #
HasPath ServerSettingsUnix Source # |
Instance details Defined in Data.Streaming.Network Methods pathLens :: Functor f => (FilePath -> f FilePath) -> ServerSettingsUnix -> f ServerSettingsUnix Source #
HasReadBufferSize ServerSettingsUnix Source # | Since 0.1.13
Instance details Defined in Data.Streaming.Network Methods readBufferSizeLens :: Functor f => (Int -> f Int) -> ServerSettingsUnix -> f ServerSettingsUnix Source #

data ClientSettingsUnix Source #

Settings for a Unix domain sockets client.

Constructors

ClientSettingsUnix |

Fields

- clientPath :: !FilePath
- clientReadBufferSizeUnix :: !Int

#### Instances

Instances details

HasPath ClientSettingsUnix Source # |
Instance details Defined in Data.Streaming.Network Methods pathLens :: Functor f => (FilePath -> f FilePath) -> ClientSettingsUnix -> f ClientSettingsUnix Source #
HasReadBufferSize ClientSettingsUnix Source # | Since 0.1.14
Instance details Defined in Data.Streaming.Network Methods readBufferSizeLens :: Functor f => (Int -> f Int) -> ClientSettingsUnix -> f ClientSettingsUnix Source #

data AppDataUnix Source #

The data passed to a Unix domain sockets `Application`.

Constructors

AppDataUnix |

Fields

- appReadUnix :: !(IO ByteString)
- appWriteUnix :: !(ByteString -> IO ())

#### Instances

Instances details

HasReadWrite AppDataUnix Source # |
Instance details Defined in Data.Streaming.Network Methods readLens :: Functor f => (IO ByteString -> f (IO ByteString)) -> AppDataUnix -> f AppDataUnix Source # writeLens :: Functor f => ((ByteString -> IO ()) -> f (ByteString -> IO ())) -> AppDataUnix -> f AppDataUnix Source #