Commit ed057ceb authored by Mart Lubbers's avatar Mart Lubbers

rename Sa* types

parent 59f78ba4
......@@ -5,9 +5,9 @@ from Network.IP import :: IPAddress
from StdMaybe import :: Maybe
from System.Socket import class SocketAddress
:: SaInet =
:: Ipv4SocketAddress =
{ sin_port :: !Int
, sin_addr :: !Maybe IPAddress
}
instance SocketAddress SaInet
instance toString SaInet
instance SocketAddress Ipv4SocketAddress
instance toString Ipv4SocketAddress
......@@ -7,7 +7,7 @@ import System.Socket
import System._Pointer
import Text.GenPrint
instance SocketAddress SaInet where
instance SocketAddress Ipv4SocketAddress where
sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa)
# p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin_port)
......@@ -20,5 +20,5 @@ instance SocketAddress SaInet where
sa_null = {sin_port=0, sin_addr=Nothing}
gPrint{|IPAddress|} a s = gPrint{|*|} (toString a) s
derive gPrint SaInet, Maybe
instance toString SaInet where toString s = printToString s
derive gPrint Ipv4SocketAddress, Maybe
instance toString Ipv4SocketAddress where toString s = printToString s
......@@ -5,11 +5,11 @@ from Network.IP import :: IPAddress
from StdMaybe import :: Maybe
from System.Socket import class SocketAddress
:: SaInet6 =
:: Ipv6SocketAddress =
{ sin6_port :: !Int
, sin6_flowinfo :: !Int
, sin6_addr :: !Maybe String
, sin6_scope_id :: !Int
}
instance SocketAddress SaInet6
instance toString SaInet6
instance SocketAddress Ipv6SocketAddress
instance toString Ipv6SocketAddress
......@@ -8,7 +8,7 @@ import System._Pointer
import Text.GenPrint
from System._Socket import AF_INET6
instance SocketAddress SaInet6 where
instance SocketAddress Ipv6SocketAddress where
sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa)
# p = writeInt2 p 2 (hostToNetworkByteOrderShort sa.sin6_port)
......@@ -28,5 +28,5 @@ instance SocketAddress SaInet6 where
sa_domain _ = AF_INET6
sa_null = {sin6_port=0,sin6_flowinfo=0,sin6_addr=Nothing,sin6_scope_id=0}
derive gPrint SaInet6, Maybe
instance toString SaInet6 where toString s = printToString s
derive gPrint Ipv6SocketAddress, Maybe
instance toString Ipv6SocketAddress where toString s = printToString s
......@@ -4,8 +4,8 @@ from System.FilePath import :: FilePath(..)
from StdOverloaded import class toString
from System.Socket import class SocketAddress
:: SaUnix =
:: UnixSocketAddress =
{ sun_path :: !FilePath
}
instance SocketAddress SaUnix
instance toString SaUnix
instance SocketAddress UnixSocketAddress
instance toString UnixSocketAddress
......@@ -7,7 +7,7 @@ import System.Socket
import System._Pointer
from System._Socket import AF_UNIX
instance SocketAddress SaUnix where
instance SocketAddress UnixSocketAddress where
sa_serialize sa p w
# p = writeInt2 p 0 (sa_domain sa)
# p = writeCharArray (p+2) (packString sa.sun_path)
......@@ -18,4 +18,4 @@ instance SocketAddress SaUnix where
sa_domain _ = AF_UNIX
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