package ipaddr-cstruct

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Ipaddr_cstruct.V4Source

Ipv4 address conversions

Sourceval of_cstruct : Cstruct.t -> (Ipaddr.V4.t, [> `Msg of string ]) result

of_cstruct c parses the first 4 octets of c into an IPv4 address.

Sourceval of_cstruct_exn : Cstruct.t -> Ipaddr.V4.t

of_cstruct_exn parses the first 4 octets of c into an IPv4 address. Raises Ipaddr.Parse_failure on error.

Sourceval to_cstruct : ?allocator:(int -> Cstruct.t) -> Ipaddr.V4.t -> Cstruct.t

to_cstruct ipv4 is a cstruct of length 4 encoding ipv4. The cstruct is allocated using allocator. If allocator is not provided, Cstruct.create is used.

Sourceval write_cstruct_exn : Ipaddr.V4.t -> Cstruct.t -> unit

write_cstruct_exn ipv4 cs writes 4 bytes into cs representing the ipv4 address octets. Raises Ipaddr.Parse_error if cs is not at least 4 bytes long.

OCaml

Innovation. Community. Security.