diff --git a/.nvimrc b/.nvimrc index a325e7d..9378ea2 100644 --- a/.nvimrc +++ b/.nvimrc @@ -1,3 +1,3 @@ -let g:loaded_airline=1 -autocmd FileType hs let b:airline_disable_statusline = 1 -set statusline=%!StatusLSP() +" let g:loaded_airline=1 +" autocmd FileType hs let b:airline_disable_statusline = 1 +" set statusline=%!StatusLSP() diff --git a/Net/Tcp/Constants.chs b/Net/Tcp/Constants.chs index 267ba97..5027f95 100644 --- a/Net/Tcp/Constants.chs +++ b/Net/Tcp/Constants.chs @@ -15,6 +15,7 @@ module Net.Tcp.Constants where import Data.Bits () +import Data.Word (Word8, Word32) -- copy from include/net/tcp_states since it's not part of the user API #include @@ -26,4 +27,39 @@ import Data.Bits () -- http://www.yonch.com/tech/linux-tcp-congestion-control-internals #include + {#enum TCP_CA_Open as TcpCAState {underscoreToCase} deriving (Eq, Show)#} + +-- GenBind.evalCCast: Casts are implemented only for integral constants +-- {#enum define TcpFlag {TCP_FLAG_SYN as TcpFlagSyn} deriving (Eq, Show)#} + +data TcpFlag = TcpFlagSyn | TcpFlagFin | TcpFlagAck + +-- {#const TCP_FLAG_SYN#} +tcpFlagSynVal :: Word32 +tcpFlagSynVal = 2 + +tcpFlagFinVal :: Word32 +tcpFlagFinVal = 1 + +tcpFlagAckVal :: Word32 +tcpFlagAckVal = 8 +-- tcpFlagAck :: Word8 +-- tcpFlagAck = {#const TCP_FLAG_ACK #} + + +-- TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), +-- TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), +-- TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), +-- TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), +-- TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), +-- TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), +-- TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), +-- TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), + +-- #define TH_FIN 0x0001 +-- #define TH_SYN 0x0002 +-- #define TH_RST 0x0004 +-- #define TH_PUSH 0x0008 +-- #define TH_ACK 0x0010 +