package charrua-client
DHCP client implementation
Install
Dune Dependency
Authors
Maintainers
Sources
charrua-v1.5.0.tbz
sha256=4ce74a5e78402f3d645ddcb344aaa1348349a8d5a35b8b55112aff0cb84db8e1
sha512=ac6960de516642793b928224c95da997042d2907829496843481894b38804e3b465b5f9703bd8c02e5202059847ee5c16db6975c630b462448db511b39f34f87
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: %s" @@ Dhcp_wire.pkt_to_string 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(Random : Mirage_random.S)(Time : Mirage_time.S) (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(Random)(Time)(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)"
>