package charrua-client
DHCP client implementation
Install
Dune Dependency
Authors
Maintainers
Sources
charrua-2.0.0.tbz
sha256=ecacfd0f17bdf2ba261049d2b3cc03aa473eec4a9d77b0a83c0ce2c402c512bb
sha512=9f24a36f934824581d5af9886bdd22e82a1ba0ce174d752d43de9b527392140c19b65a93b18b3ca07c441f84315fefff7002a71eebf573ce1b747e74de861a9d
doc/src/charrua-client.mirage/dhcp_client_mirage.ml.html
Source file dhcp_client_mirage.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
let src = Logs.Src.create "dhcp_client_mirage" module Log = (val Logs.src_log src : Logs.LOG) let config_of_lease lease = let open Dhcp_wire in (* ipv4_config expects a single IP address and the information needed to construct a prefix. It can optionally use one router. *) let address = lease.yiaddr in match Dhcp_wire.find_subnet_mask lease.options with | None -> Log.info (fun f -> f "Lease obtained with no subnet mask; discarding it"); Log.debug (fun f -> f "Unusable lease: %a" Dhcp_wire.pp_pkt lease); None | Some subnet -> match Ipaddr.V4.Prefix.of_netmask ~netmask:subnet ~address with | Error `Msg msg -> Log.info (fun f -> f "Invalid address and netmask combination %s, discarding" msg); None | Ok network -> let valid_routers = Dhcp_wire.collect_routers lease.options in match valid_routers with | [] -> Some (network, None) | hd::_ -> Some (network, Some hd) module Make (Net : Mirage_net.S) = struct open Lwt.Infix type t = (Ipaddr.V4.Prefix.t * Ipaddr.V4.t option) Lwt_stream.t let connect ?(requests : Dhcp_wire.option_code list option) net = let module Lwt_client = Dhcp_client_lwt.Make(Net) in Lwt_client.connect ~renew:false ?requests net >>= fun lease_stream -> Lwt.return @@ Lwt_stream.filter_map config_of_lease lease_stream end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>