0 | -- Note: This module is automatically generated when Idris builds
  1 | -- the library and the constants will be replaced with values
  2 | -- matching the system this is generated on.
  3 | --
  4 | -- The placeholders are here so that it works with tools like the LSP
  5 | -- without first compiling the library. They were generated on an x86_64
  6 | -- GNU/Linux system with GCC. If you are on a similar system, your numbers
  7 | -- might very well be identical.
  8 | module System.Posix.Socket.Types
  9 |
 10 | import Data.Bits
 11 | import Data.C.Integer
 12 | import Derive.Finite
 13 | import Derive.Prelude
 14 |
 15 | %default total
 16 | %language ElabReflection
 17 |
 18 | public export
 19 | data Domain : Type where
 20 |   AF_UNIX  : Domain
 21 |   AF_INET  : Domain
 22 |   AF_INET6 : Domain
 23 |
 24 | %runElab derive "Domain" [Show,Eq,Ord,Finite]
 25 |
 26 | public export
 27 | record SockType where
 28 |   constructor ST
 29 |   type : Bits32
 30 |
 31 | %runElab derive "SockType" [Show,Eq,Ord,FromInteger]
 32 |
 33 | public export
 34 | Semigroup SockType where
 35 |   ST x <+> ST y = ST $ x .|. y
 36 |
 37 | public export
 38 | record SockFlags where
 39 |   constructor SF
 40 |   flags : Bits32
 41 |
 42 | namespace SockFlags
 43 |   %runElab derive "SockFlags" [Show,Eq,Ord,FromInteger]
 44 |
 45 | public export
 46 | Semigroup SockFlags where
 47 |   SF x <+> SF y = SF $ x .|. y
 48 |
 49 | public export
 50 | domainCode : Domain -> Bits8
 51 | domainCode AF_UNIX  = 1
 52 | domainCode AF_INET  = 2
 53 | domainCode AF_INET6 = 10
 54 |
 55 | public export
 56 | SOCK_STREAM : SockType
 57 | SOCK_STREAM = 1
 58 |
 59 | public export
 60 | SOCK_DGRAM : SockType
 61 | SOCK_DGRAM = 2
 62 |
 63 | public export
 64 | SOCK_RAW : SockType
 65 | SOCK_RAW = 3
 66 |
 67 | public export
 68 | SOCK_NONBLOCK : SockType
 69 | SOCK_NONBLOCK = 2048
 70 |
 71 | public export
 72 | SOCK_CLOEXEC : SockType
 73 | SOCK_CLOEXEC = 524288
 74 |
 75 | public export
 76 | MSG_DONTWAIT : SockFlags
 77 | MSG_DONTWAIT = 64
 78 |
 79 | public export
 80 | MSG_OOB : SockFlags
 81 | MSG_OOB = 1
 82 |
 83 | public export
 84 | MSG_PEEK : SockFlags
 85 | MSG_PEEK = 2
 86 |
 87 | public export
 88 | MSG_WAITALL : SockFlags
 89 | MSG_WAITALL = 256
 90 |
 91 | public export
 92 | MSG_NOSIGNAL : SockFlags
 93 | MSG_NOSIGNAL = 16384
 94 |
 95 | public export
 96 | sockaddr_un_size : Bits32
 97 | sockaddr_un_size = 110
 98 |
 99 | public export
100 | sockaddr_in_size : Bits32
101 | sockaddr_in_size = 16
102 |
103 | public export
104 | sockaddr_in6_size : Bits32
105 | sockaddr_in6_size = 28
106 |
107 | public export
108 | SOL_SOCKET : Bits32
109 | SOL_SOCKET = 1
110 |
111 | public export
112 | IPPROTO_TCP : Bits32
113 | IPPROTO_TCP = 6
114 |
115 | public export
116 | SO_REUSEADDR : Bits32
117 | SO_REUSEADDR = 2
118 |
119 | public export
120 | SO_LINGER : Bits32
121 | SO_LINGER = 13
122 |
123 | public export
124 | TCP_NODELAY : Bits32
125 | TCP_NODELAY = 1
126 |