Library
Module
Module type
Parameter
Class
Class type
module D : Qubes.S.DB
module C : Mirage_clock.MCLOCK
module Ethernet : Mirage_protocols_lwt.ETHERNET
module Arp : Mirage_protocols_lwt.ARP
include Mirage_protocols_lwt.IPV4
The type for IP errors.
val pp_error : error Fmt.t
pp_error
is the pretty-printer for errors.
type ipaddr = Ipaddr.V4.t
The type for IP addresses.
val pp_ipaddr : ipaddr Fmt.t
pp_ipaddr
is the pretty-printer for IP addresses.
include Mirage_device.S with type 'a io = 'a Lwt.t
type 'a io = 'a Lwt.t
The type for potentially blocking I/O operation
An input continuation used by the parsing functions to pass on an input packet down the stack.
callback ~src ~dst buf
will be called with src
and dst
containing the source and destination IP address respectively, and buf
will be a buffer pointing at the start of the IP payload.
val input :
t ->
tcp:callback ->
udp:callback ->
default:(proto:int -> callback) ->
buffer ->
unit io
input ~tcp ~udp ~default ip buf
demultiplexes an incoming buffer
that contains an IP frame. It examines the protocol header and passes the result onto either the tcp
or udp
function, or the default
function for unknown IP protocols.
val write :
t ->
?fragment:bool ->
?ttl:int ->
?src:ipaddr ->
ipaddr ->
Mirage_protocols.Ip.proto ->
?size:int ->
(buffer -> int) ->
buffer list ->
(unit, error) Stdlib.result io
write t ~fragment ~ttl ~src dst proto ~size headerf payload
allocates a buffer, writes the IP header, and calls the headerf function. This may write to the provided buffer of size
(default 0). If size + ip header
exceeds the maximum transfer unit, an error is returned. The payload
is appended. The optional fragment
argument defaults to true
, in which case multiple IP-fragmented frames are sent if the payload is too big for a single frame. When it is false
, the don't fragment bit is set and if the payload and header would exceed the maximum transfer unit, an error is returned.
val pseudoheader :
t ->
?src:ipaddr ->
ipaddr ->
Mirage_protocols.Ip.proto ->
int ->
buffer
pseudoheader t ~src dst proto len
gives a pseudoheader suitable for use in TCP or UDP checksum calculation based on t
.
src ip ~dst
is the source address to be used to send a packet to dst
. In the case of IPv4, this will always return the same IP, which is the only one set.
Get the IP addresses associated with this interface. For IPv4, only one IP address can be set at a time, so the list will always be of length 1 (and may be the default value, 0.0.0.0).
val mtu : t -> int
mtu ip
is the Maximum Transmission Unit of the ip
i.e. the maximum size of the payload, not including the IP header.
connect db clock ethernet arp
attempts to use the provided db
* to look up the correct IPV4 information, and construct * an ipv4 implementation based on clock
, ethernet
and arp
. If db
* can't be read or doesn't contain useful values, connect
will * raise a failure.