package charrua-client
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=5c6ad4b357037c4a0424d9db0a55f539ce639d02993e660e8c2879c5a11dee58
sha512=82a0ad98fdb27472b6506dce9756338e1f68a3f993560917505504a7b05471fa8af73228db1304f9fe2281a7b2ca16730588ca2e5aab9d04ffdd42ecb5a67452
doc/charrua-client.mirage/Dhcp_ipv4/Make/index.html
Module Dhcp_ipv4.Make
Source
Parameters
module Network : Mirage_net.S
module E : Ethernet.S
Signature
include Tcpip.Ip.S
with type ipaddr = Ipaddr.V4.t
and type prefix = Ipaddr.V4.Prefix.t
The type for IP errors.
type ipaddr = Ipaddr.V4.t
The type for IP addresses.
type prefix = Ipaddr.V4.Prefix.t
The type for the IP address and netmask.
Disconnect from the IP layer. While this might take some time to complete, it can never result in an error.
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) ->
Cstruct.t ->
unit Lwt.t
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 ->
Tcpip.Ip.proto ->
?size:int ->
(Cstruct.t -> int) ->
Cstruct.t list ->
(unit, error) result Lwt.t
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 ->
Tcpip.Ip.proto ->
int ->
Cstruct.t
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, [10.0.0.2]
).
Get the prefix associated with this interface. For IPv4, only one prefix can be set at a time, so the list will always be of length 1, e.g. [10.0.0.2/24]
.
val connect :
?no_init:bool ->
?cidr:Ipaddr.V4.Prefix.t ->
?gateway:Ipaddr.V4.t ->
?options:Dhcp_wire.dhcp_option list ->
?requests:Dhcp_wire.option_code list ->
Network.t ->
E.t ->
Arp.t ->
t Lwt.t
Connect to an ipv4 device using information from a DHCP lease. If cidr
is provided, no DHCP requests will be done, but instead a static IPv4 (Tcpip.Ip.S) stack will be used. If no_init
is provided and true
, nothing will be initialized (for dual IPv4 and IPv6 stack where only the IPv6 part should be used).