network-netpacket-0.0.1: Haskell bindings for low-level packet sockets (AF_PACKET)

Safe HaskellSafe-Infered

Network.Socket.NetPacket

Synopsis

Documentation

c_sendto_ll :: CInt -> CString -> CSize -> CInt -> Ptr SockAddrLL -> CSize -> IO CSizeSource

Low-level sendto call. Normally, this would not be used, as sendToLL provides a | more convenient interface.

c_recvfrom_ll :: CInt -> CString -> CSize -> CInt -> Ptr SockAddrLL -> Ptr CSize -> IO CSizeSource

Low-level recvfrom call. Normally, this would not be used, as recvFromLL provides | a more convenient interface.

c_setsockopt_ll :: CInt -> CInt -> CInt -> Ptr () -> CSize -> IO CIntSource

Low-level setsockopt operation. Normally, it will be more convenient to use | setPacketOption instead.

c_bind_ll :: CInt -> Ptr SockAddrLL -> CSize -> IO CIntSource

Low-level bind operation. Normally, this would not be used, as bindLL provides a | more convenient interface.

ethProtocolIPv4 :: ProtocolNumberSource

Ethernet protocol numbers, for use with socket

ethProtocolIPv6 :: ProtocolNumberSource

Represents a type of packet

data PktType Source

Constructors

PktType 

Fields

unPktType :: Word8
 

afPacket :: CIntSource

The address family of a packet socket.

packetOtherhost :: PktTypeSource

Represents a low-level protocol appearing in an address.

packetLoopback :: PktTypeSource

Represents a hardware type appearing in an address.

packetFastroute :: PktTypeSource

Represents the Ethernet hardware type

data HWAddr Source

Hardware address

Constructors

HWAddr ByteString 

Instances

getInterfaceIndex :: Socket -> String -> IO IFIndexSource

Gets the index for a named interface, for use with SockAddrLL

sendToLL :: Socket -> ByteString -> SockAddrLL -> IO IntSource

Sends a packet to a particular low-level socket address.

recvFromLL :: Socket -> Int -> IO (SockAddrLL, ByteString)Source

Receives a packet from a socket, returning the address of the packet.

setPacketOption :: Socket -> PacketSocketOption -> PacketMReq -> IO ()Source

Sets an option on a packet socket. This can be used to control the receipt of multicast packets

bindLL :: Socket -> SockAddrLL -> IO ()Source

Binds a packet socket to an address. This is not essential, but acts as a filter on received packets.