    module Network.HTTP2.H2.EncodeFrame where

    import Network.HTTP2.Frame

    import Imports

    ----------------------------------------------------------------

    goawayFrame :: StreamId -> ErrorCode -> ByteString -> ByteString
    goawayFrame :: StreamId -> ErrorCode -> ByteString -> ByteString
    goawayFrame StreamId
    sid ErrorCode
    etype ByteString
    debugmsg = EncodeInfo -> FramePayload -> ByteString
    encodeFrame EncodeInfo
    einfo FramePayload
    frame
      where
        einfo :: EncodeInfo
    einfo = (FrameFlags -> FrameFlags) -> StreamId -> EncodeInfo
    encodeInfo FrameFlags -> FrameFlags
    forall a. a -> a
    id StreamId
    0
        frame :: FramePayload
    frame = StreamId -> ErrorCode -> ByteString -> FramePayload
    GoAwayFrame StreamId
    sid ErrorCode
    etype ByteString
    debugmsg

    resetFrame :: ErrorCode -> StreamId -> ByteString
    resetFrame :: ErrorCode -> StreamId -> ByteString
    resetFrame ErrorCode
    etype StreamId
    sid = EncodeInfo -> FramePayload -> ByteString
    encodeFrame EncodeInfo
    einfo FramePayload
    frame
      where
        einfo :: EncodeInfo
    einfo = (FrameFlags -> FrameFlags) -> StreamId -> EncodeInfo
    encodeInfo FrameFlags -> FrameFlags
    forall a. a -> a
    id StreamId
    sid
        frame :: FramePayload
    frame = ErrorCode -> FramePayload
    RSTStreamFrame ErrorCode
    etype

    settingsFrame :: (FrameFlags -> FrameFlags) -> SettingsList -> ByteString
    settingsFrame :: (FrameFlags -> FrameFlags) -> SettingsList -> ByteString
    settingsFrame FrameFlags -> FrameFlags
    func SettingsList
    alist = EncodeInfo -> FramePayload -> ByteString
    encodeFrame EncodeInfo
    einfo (FramePayload -> ByteString) -> FramePayload -> ByteString
    forall a b. (a -> b) -> a -> b
    $ SettingsList -> FramePayload
    SettingsFrame SettingsList
    alist
      where
        einfo :: EncodeInfo
    einfo = (FrameFlags -> FrameFlags) -> StreamId -> EncodeInfo
    encodeInfo FrameFlags -> FrameFlags
    func StreamId
    0

    pingFrame :: ByteString -> ByteString
    pingFrame :: ByteString -> ByteString
    pingFrame ByteString
    bs = EncodeInfo -> FramePayload -> ByteString
    encodeFrame EncodeInfo
    einfo (FramePayload -> ByteString) -> FramePayload -> ByteString
    forall a b. (a -> b) -> a -> b
    $ ByteString -> FramePayload
    PingFrame ByteString
    bs
      where
        einfo :: EncodeInfo
    einfo = (FrameFlags -> FrameFlags) -> StreamId -> EncodeInfo
    encodeInfo FrameFlags -> FrameFlags
    setAck StreamId
    0

    windowUpdateFrame :: StreamId -> WindowSize -> ByteString
    windowUpdateFrame :: StreamId -> StreamId -> ByteString
    windowUpdateFrame StreamId
    sid StreamId
    winsiz = EncodeInfo -> FramePayload -> ByteString
    encodeFrame EncodeInfo
    einfo (FramePayload -> ByteString) -> FramePayload -> ByteString
    forall a b. (a -> b) -> a -> b
    $ StreamId -> FramePayload
    WindowUpdateFrame StreamId
    winsiz
      where
        einfo :: EncodeInfo
    einfo = (FrameFlags -> FrameFlags) -> StreamId -> EncodeInfo
    encodeInfo FrameFlags -> FrameFlags
    forall a. a -> a
    id StreamId
    sid