package tcpip
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=86ba5d92f9078bddc65312f63b5f4ce34fd2570d765433b23a226ab84d75a9c0
sha512=a348a597cf4ba1e19f7fc97d6d1cb980711d09b6944efacba91d23daf419fc8cb8a83a2d263bcc7b96ff5d37ad5dbfa4a3879db9ac4c0b35528b80acb87cf8f7
doc/tcpip.ipv6/Ndpv6/index.html
Module Ndpv6
Source
val local :
handle_ra:bool ->
now:time ->
random:(int -> Cstruct.t) ->
Macaddr.t ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list
local ~handle_ra ~now ~random mac
is a pair ctx, outs
where ctx
is a local IPv6 context associated to the hardware address mac
. outs
is a list of ethif packets to be sent.
val add_ip :
now:time ->
context ->
prefix ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list
add_ip ~now ctx ip
is ctx', outs
where ctx'
is ctx
updated with a new local ip and outs
is a list of ethif packets to be sent.
configured_ips ctx
returns the list of local prefixes.
select_source ctx ip
returns the ip that should be put in the source field of a packet destined to ip
.
val handle :
now:time ->
random:(int -> Cstruct.t) ->
context ->
Cstruct.t ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list * event list
handle ~now ~random ctx buf
handles an incoming ipv6 packet. It returns ctx', bufs, evs
where ctx'
is the updated context, bufs
is a list of packets to be sent and evs
is a list of packets to be passed to the higher layers (udp, tcp, etc) for further processing.
val send :
now:time ->
context ->
?src:ipaddr ->
ipaddr ->
Tcpip.Ip.proto ->
int ->
(Cstruct.t -> Cstruct.t -> int) ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list
send ~now ctx ?src dst proto size fillf
starts route resolution and assembles an ipv6 packet of size
for sending with header and body passed to fillf
. It returns a pair ctx', dst_size_fills
where ctx'
is the updated context and dst, size, fillf
is a list of packets to be sent, specified by destination, their size, and fill function.
tick ~now ctx
should be called periodically (every 1s is good). It returns ctx', bufs
where ctx'
is the updated context and bufs
is a list of packets to be sent.
add_prefix ~now ctx pfx
adds a local prefix to ctx
.
get_prefix ctx
returns the list of local prefixes known to ctx
.
add_routers ~now ctx ips
adds a list of gateways to ctx
to be used for routing.