{-# LINE 1 "Network/Socket/Flag.hsc" #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PatternSynonyms #-}



module Network.Socket.Flag where

import qualified Data.Semigroup as Sem

import Network.Socket.Imports

{-
import Network.Socket.ReadShow

import qualified Text.Read as P
-}

-- | Message flags. To combine flags, use '(<>)'.
newtype MsgFlag = MsgFlag { MsgFlag -> CInt
fromMsgFlag :: CInt }
                deriving (Int -> MsgFlag -> ShowS
[MsgFlag] -> ShowS
MsgFlag -> String
(Int -> MsgFlag -> ShowS)
-> (MsgFlag -> String) -> ([MsgFlag] -> ShowS) -> Show MsgFlag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MsgFlag -> ShowS
showsPrec :: Int -> MsgFlag -> ShowS
$cshow :: MsgFlag -> String
show :: MsgFlag -> String
$cshowList :: [MsgFlag] -> ShowS
showList :: [MsgFlag] -> ShowS
Show, MsgFlag -> MsgFlag -> Bool
(MsgFlag -> MsgFlag -> Bool)
-> (MsgFlag -> MsgFlag -> Bool) -> Eq MsgFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MsgFlag -> MsgFlag -> Bool
== :: MsgFlag -> MsgFlag -> Bool
$c/= :: MsgFlag -> MsgFlag -> Bool
/= :: MsgFlag -> MsgFlag -> Bool
Eq, Eq MsgFlag
Eq MsgFlag =>
(MsgFlag -> MsgFlag -> Ordering)
-> (MsgFlag -> MsgFlag -> Bool)
-> (MsgFlag -> MsgFlag -> Bool)
-> (MsgFlag -> MsgFlag -> Bool)
-> (MsgFlag -> MsgFlag -> Bool)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> Ord MsgFlag
MsgFlag -> MsgFlag -> Bool
MsgFlag -> MsgFlag -> Ordering
MsgFlag -> MsgFlag -> MsgFlag
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: MsgFlag -> MsgFlag -> Ordering
compare :: MsgFlag -> MsgFlag -> Ordering
$c< :: MsgFlag -> MsgFlag -> Bool
< :: MsgFlag -> MsgFlag -> Bool
$c<= :: MsgFlag -> MsgFlag -> Bool
<= :: MsgFlag -> MsgFlag -> Bool
$c> :: MsgFlag -> MsgFlag -> Bool
> :: MsgFlag -> MsgFlag -> Bool
$c>= :: MsgFlag -> MsgFlag -> Bool
>= :: MsgFlag -> MsgFlag -> Bool
$cmax :: MsgFlag -> MsgFlag -> MsgFlag
max :: MsgFlag -> MsgFlag -> MsgFlag
$cmin :: MsgFlag -> MsgFlag -> MsgFlag
min :: MsgFlag -> MsgFlag -> MsgFlag
Ord, Integer -> MsgFlag
MsgFlag -> MsgFlag
MsgFlag -> MsgFlag -> MsgFlag
(MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag)
-> (Integer -> MsgFlag)
-> Num MsgFlag
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: MsgFlag -> MsgFlag -> MsgFlag
+ :: MsgFlag -> MsgFlag -> MsgFlag
$c- :: MsgFlag -> MsgFlag -> MsgFlag
- :: MsgFlag -> MsgFlag -> MsgFlag
$c* :: MsgFlag -> MsgFlag -> MsgFlag
* :: MsgFlag -> MsgFlag -> MsgFlag
$cnegate :: MsgFlag -> MsgFlag
negate :: MsgFlag -> MsgFlag
$cabs :: MsgFlag -> MsgFlag
abs :: MsgFlag -> MsgFlag
$csignum :: MsgFlag -> MsgFlag
signum :: MsgFlag -> MsgFlag
$cfromInteger :: Integer -> MsgFlag
fromInteger :: Integer -> MsgFlag
Num, Eq MsgFlag
MsgFlag
Eq MsgFlag =>
(MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag -> MsgFlag)
-> (MsgFlag -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> MsgFlag
-> (Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> Bool)
-> (MsgFlag -> Maybe Int)
-> (MsgFlag -> Int)
-> (MsgFlag -> Bool)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int -> MsgFlag)
-> (MsgFlag -> Int)
-> Bits MsgFlag
Int -> MsgFlag
MsgFlag -> Bool
MsgFlag -> Int
MsgFlag -> Maybe Int
MsgFlag -> MsgFlag
MsgFlag -> Int -> Bool
MsgFlag -> Int -> MsgFlag
MsgFlag -> MsgFlag -> MsgFlag
forall a.
Eq a =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
$c.&. :: MsgFlag -> MsgFlag -> MsgFlag
.&. :: MsgFlag -> MsgFlag -> MsgFlag
$c.|. :: MsgFlag -> MsgFlag -> MsgFlag
.|. :: MsgFlag -> MsgFlag -> MsgFlag
$cxor :: MsgFlag -> MsgFlag -> MsgFlag
xor :: MsgFlag -> MsgFlag -> MsgFlag
$ccomplement :: MsgFlag -> MsgFlag
complement :: MsgFlag -> MsgFlag
$cshift :: MsgFlag -> Int -> MsgFlag
shift :: MsgFlag -> Int -> MsgFlag
$crotate :: MsgFlag -> Int -> MsgFlag
rotate :: MsgFlag -> Int -> MsgFlag
$czeroBits :: MsgFlag
zeroBits :: MsgFlag
$cbit :: Int -> MsgFlag
bit :: Int -> MsgFlag
$csetBit :: MsgFlag -> Int -> MsgFlag
setBit :: MsgFlag -> Int -> MsgFlag
$cclearBit :: MsgFlag -> Int -> MsgFlag
clearBit :: MsgFlag -> Int -> MsgFlag
$ccomplementBit :: MsgFlag -> Int -> MsgFlag
complementBit :: MsgFlag -> Int -> MsgFlag
$ctestBit :: MsgFlag -> Int -> Bool
testBit :: MsgFlag -> Int -> Bool
$cbitSizeMaybe :: MsgFlag -> Maybe Int
bitSizeMaybe :: MsgFlag -> Maybe Int
$cbitSize :: MsgFlag -> Int
bitSize :: MsgFlag -> Int
$cisSigned :: MsgFlag -> Bool
isSigned :: MsgFlag -> Bool
$cshiftL :: MsgFlag -> Int -> MsgFlag
shiftL :: MsgFlag -> Int -> MsgFlag
$cunsafeShiftL :: MsgFlag -> Int -> MsgFlag
unsafeShiftL :: MsgFlag -> Int -> MsgFlag
$cshiftR :: MsgFlag -> Int -> MsgFlag
shiftR :: MsgFlag -> Int -> MsgFlag
$cunsafeShiftR :: MsgFlag -> Int -> MsgFlag
unsafeShiftR :: MsgFlag -> Int -> MsgFlag
$crotateL :: MsgFlag -> Int -> MsgFlag
rotateL :: MsgFlag -> Int -> MsgFlag
$crotateR :: MsgFlag -> Int -> MsgFlag
rotateR :: MsgFlag -> Int -> MsgFlag
$cpopCount :: MsgFlag -> Int
popCount :: MsgFlag -> Int
Bits)

instance Sem.Semigroup MsgFlag where
    <> :: MsgFlag -> MsgFlag -> MsgFlag
(<>) = MsgFlag -> MsgFlag -> MsgFlag
forall a. Bits a => a -> a -> a
(.|.)

instance Monoid MsgFlag where
    mempty :: MsgFlag
mempty = CInt -> MsgFlag
MsgFlag CInt
0

{-# LINE 31 "Network/Socket/Flag.hsc" #-}

-- | Send or receive OOB(out-of-bound) data.
pattern MSG_OOB :: MsgFlag

{-# LINE 35 "Network/Socket/Flag.hsc" #-}
pattern MSG_OOB = MsgFlag (1)
{-# LINE 36 "Network/Socket/Flag.hsc" #-}

{-# LINE 39 "Network/Socket/Flag.hsc" #-}

-- | Bypass routing table lookup.
pattern MSG_DONTROUTE :: MsgFlag

{-# LINE 43 "Network/Socket/Flag.hsc" #-}
pattern MSG_DONTROUTE = MsgFlag (4)
{-# LINE 44 "Network/Socket/Flag.hsc" #-}

{-# LINE 47 "Network/Socket/Flag.hsc" #-}

-- | Peek at incoming message without removing it from the queue.
pattern MSG_PEEK :: MsgFlag

{-# LINE 51 "Network/Socket/Flag.hsc" #-}
pattern MSG_PEEK = MsgFlag (2)
{-# LINE 52 "Network/Socket/Flag.hsc" #-}

{-# LINE 55 "Network/Socket/Flag.hsc" #-}

-- | End of record.
pattern MSG_EOR :: MsgFlag

{-# LINE 59 "Network/Socket/Flag.hsc" #-}
pattern MSG_EOR = MsgFlag (128)
{-# LINE 60 "Network/Socket/Flag.hsc" #-}

{-# LINE 63 "Network/Socket/Flag.hsc" #-}

-- | Received data is truncated. More data exist.
pattern MSG_TRUNC :: MsgFlag

{-# LINE 67 "Network/Socket/Flag.hsc" #-}
pattern MSG_TRUNC = MsgFlag (32)
{-# LINE 68 "Network/Socket/Flag.hsc" #-}

{-# LINE 71 "Network/Socket/Flag.hsc" #-}

-- | Received control message is truncated. More control message exist.
pattern MSG_CTRUNC :: MsgFlag

{-# LINE 75 "Network/Socket/Flag.hsc" #-}
pattern MSG_CTRUNC = MsgFlag (8)
{-# LINE 76 "Network/Socket/Flag.hsc" #-}

{-# LINE 79 "Network/Socket/Flag.hsc" #-}

-- | Wait until the requested number of bytes have been read.
pattern MSG_WAITALL :: MsgFlag

{-# LINE 83 "Network/Socket/Flag.hsc" #-}
pattern MSG_WAITALL = MsgFlag (256)
{-# LINE 84 "Network/Socket/Flag.hsc" #-}

{-# LINE 87 "Network/Socket/Flag.hsc" #-}

{-
msgFlagPairs :: [Pair MsgFlag String]
msgFlagPairs =
    [ (MSG_OOB, "MSG_OOB")
    , (MSG_DONTROUTE, "MSG_DONTROUTE")
    , (MSG_PEEK, "MSG_PEEK")
    , (MSG_EOR, "MSG_EOR")
    , (MSG_TRUNC, "MSG_TRUNC")
    , (MSG_CTRUNC, "MSG_CTRUNC")
    , (MSG_WAITALL, "MSG_WAITALL")
    ]
-}