Commit ed057ceb authored by Mart Lubbers's avatar Mart Lubbers

rename Sa* types

parent 59f78ba4
...@@ -5,9 +5,9 @@ from Network.IP import :: IPAddress ...@@ -5,9 +5,9 @@ from Network.IP import :: IPAddress
from StdMaybe import :: Maybe from StdMaybe import :: Maybe
from System.Socket import class SocketAddress from System.Socket import class SocketAddress
:: SaInet = :: Ipv4SocketAddress =
{ sin_port :: !Int { sin_port :: !Int
, sin_addr :: !Maybe IPAddress , sin_addr :: !Maybe IPAddress
} }
instance SocketAddress SaInet instance SocketAddress Ipv4SocketAddress
instance toString SaInet instance toString Ipv4SocketAddress
...@@ -7,7 +7,7 @@ import System.Socket ...@@ -7,7 +7,7 @@ import System.Socket
import System._Pointer import System._Pointer
import Text.GenPrint import Text.GenPrint
instance SocketAddress SaInet where instance SocketAddress Ipv4SocketAddress where
sa_serialize sa p w sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa) # p = writeInt2 p 0 (sa_domain sa)
# p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin_port) # p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin_port)
...@@ -20,5 +20,5 @@ instance SocketAddress SaInet where ...@@ -20,5 +20,5 @@ instance SocketAddress SaInet where
sa_null = {sin_port=0, sin_addr=Nothing} sa_null = {sin_port=0, sin_addr=Nothing}
gPrint{|IPAddress|} a s = gPrint{|*|} (toString a) s gPrint{|IPAddress|} a s = gPrint{|*|} (toString a) s
derive gPrint SaInet, Maybe derive gPrint Ipv4SocketAddress, Maybe
instance toString SaInet where toString s = printToString s instance toString Ipv4SocketAddress where toString s = printToString s
...@@ -5,11 +5,11 @@ from Network.IP import :: IPAddress ...@@ -5,11 +5,11 @@ from Network.IP import :: IPAddress
from StdMaybe import :: Maybe from StdMaybe import :: Maybe
from System.Socket import class SocketAddress from System.Socket import class SocketAddress
:: SaInet6 = :: Ipv6SocketAddress =
{ sin6_port :: !Int { sin6_port :: !Int
, sin6_flowinfo :: !Int , sin6_flowinfo :: !Int
, sin6_addr :: !Maybe String , sin6_addr :: !Maybe String
, sin6_scope_id :: !Int , sin6_scope_id :: !Int
} }
instance SocketAddress SaInet6 instance SocketAddress Ipv6SocketAddress
instance toString SaInet6 instance toString Ipv6SocketAddress
...@@ -8,7 +8,7 @@ import System._Pointer ...@@ -8,7 +8,7 @@ import System._Pointer
import Text.GenPrint import Text.GenPrint
from System._Socket import AF_INET6 from System._Socket import AF_INET6
instance SocketAddress SaInet6 where instance SocketAddress Ipv6SocketAddress where
sa_serialize sa p w sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa) # p = writeInt2 p 0 (sa_domain sa)
# p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin6_port) # p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin6_port)
...@@ -28,5 +28,5 @@ instance SocketAddress SaInet6 where ...@@ -28,5 +28,5 @@ instance SocketAddress SaInet6 where
sa_domain _ = AF_INET6 sa_domain _ = AF_INET6
sa_null = {sin6_port=0,sin6_flowinfo=0,sin6_addr=Nothing,sin6_scope_id=0} sa_null = {sin6_port=0,sin6_flowinfo=0,sin6_addr=Nothing,sin6_scope_id=0}
derive gPrint SaInet6, Maybe derive gPrint Ipv6SocketAddress, Maybe
instance toString SaInet6 where toString s = printToString s instance toString Ipv6SocketAddress where toString s = printToString s
...@@ -4,8 +4,8 @@ from System.FilePath import :: FilePath(..) ...@@ -4,8 +4,8 @@ from System.FilePath import :: FilePath(..)
from StdOverloaded import class toString from StdOverloaded import class toString
from System.Socket import class SocketAddress from System.Socket import class SocketAddress
:: SaUnix = :: UnixSocketAddress =
{ sun_path :: !FilePath { sun_path :: !FilePath
} }
instance SocketAddress SaUnix instance SocketAddress UnixSocketAddress
instance toString SaUnix instance toString UnixSocketAddress
...@@ -7,7 +7,7 @@ import System.Socket ...@@ -7,7 +7,7 @@ import System.Socket
import System._Pointer import System._Pointer
from System._Socket import AF_UNIX from System._Socket import AF_UNIX
instance SocketAddress SaUnix where instance SocketAddress UnixSocketAddress where
sa_serialize sa p w sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa) # p = writeInt2 p 0 (sa_domain sa)
# p = writeCharArray (p+2) (packString sa.sun_path) # p = writeCharArray (p+2) (packString sa.sun_path)
...@@ -18,4 +18,4 @@ instance SocketAddress SaUnix where ...@@ -18,4 +18,4 @@ instance SocketAddress SaUnix where
sa_domain _ = AF_UNIX sa_domain _ = AF_UNIX
sa_null = {sun_path="/"} sa_null = {sun_path="/"}
instance toString SaUnix where toString s = s.sun_path instance toString UnixSocketAddress where toString s = s.sun_path
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment