Commits

Anonymous committed abec7d7

getAddrInfo example

  • Participants
  • Parent commits a8be26a

Comments (0)

Files changed (2)

 import Network.DNSSD.ServicesUtils
 import Control.Concurrent
 import Foreign.Ptr
-import Network.Socket
+import Network.Socket hiding (getAddrInfo) -- TODO
 import Control.Monad (forever, forM_, liftM)
 import Data.Maybe(maybe)
 import System.Exit
     , ("Open NAT"                   , openNAT     >>= runServiceFor 5   )
     , ("Browse all services"        , browseAll   >>= runServiceFor 5   )
     , ("Enumerate domains"          , enumDomains >>= runServiceFor 5   )
+    , ("Get address info"           , getAddressInfo >>= runServiceFor 5)
     ]
 
 menuItemsWithChars = zip ['1'..] menuItems
     []
     DNSServiceInterfaceIndexAny 
 
+getAddressInfo =
+    getAddrInfo [DNSServiceProtocol_IPv4] "www.google.com" print [] DNSServiceInterfaceIndexAny
+
 enumDomains = enumerateDomainsS (print ) [DNSServiceFlagsBrowseDomains] DNSServiceInterfaceIndexAny 
 
 main :: IO ()

File Network/DNSSD/Services.chs

-{-# LANGUAGE DataKinds #-}
 {-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE TypeFamilies #-}
 module Network.DNSSD.Services -- {{{
 import Network.DNSSD.StringLike
 import Network.DNSSD.Error
 
-import Data.Word
 import Data.ByteString (packCStringLen)
 -- }}}
 #define _DNS_SD_LIBDISPATCH 0
     t  -- hostname
     SockAddr
     Int  -- ttl
+    deriving Show
 
 data RegisterRecordReply = RegisterRecordRepy Flags DNSRecordRef
 -- }}}