package mnet
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
An implementation of TCP (Transmission Control Protocol) in OCaml for Miou & Solo5
Install
dune-project
Dependency
Authors
Maintainers
Sources
mnet-0.0.4.tbz
sha256=154c3b18bbb019535a4f37d1fefa3c6131b636e53316a63b395d030b186f2a59
sha512=894d12ff3140b294de1129f76893b295e73093101edec137ba2b2106059081f94385e3e3420c48cde14df6aefbef333bec12f5772c1b85c7ecc73dcde9e5bb8c
doc/src/mnet.ipv4/routing.ml.html
Source file routing.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36type r = Mac of Macaddr.t | Arp of Ipaddr.V4.t let routing network gateway ~src ~dst = if Ipaddr.V4.Prefix.(mem dst loopback) || Ipaddr.V4.Prefix.(mem src loopback) then (* avoid packets to or from 127.0.0.0/8 *) Error `Loopback else if Ipaddr.V4.(compare broadcast) dst == 0 || Ipaddr.V4.(compare (Prefix.broadcast network)) dst == 0 then (* use broadcast mac *) Ok (Mac Macaddr.broadcast) else if Ipaddr.V4.is_multicast dst then (* filter multicast *) Ok (Mac (Ipaddr.V4.multicast_to_mac dst)) else if Ipaddr.V4.Prefix.mem dst network then (* direct to this network *) Ok (Arp dst) else (* send to gateway *) match gateway with | None -> Error `Gateway | Some gateway -> Ok (Arp gateway) let ( let* ) = Result.bind let destination_macaddr network gateway arp ~src ~dst = let* it = routing network gateway ~src ~dst in match it with Mac x -> Ok x | Arp ip -> ARPv4.query arp ip let destination_macaddr_without_interruption network gateway arp ~src ~dst = match routing network gateway ~src ~dst with | Error _ -> None | Ok (Mac x) -> Some x | Ok (Arp ip) -> ARPv4.ask arp ip
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>