package macaddr
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=5a66291bf710b45f7e9550ecd562227af519d5fefe899da1b9fb1d0f51c735ea
sha512=c0c564529bceeb1263a6200f5f86c53ee38874a7cd3ba6dd4b435cb87e0247ba85b0ee46ab5f517ef81aa05f4187d2ba20d10013d3faa2763b64daf85046ae96
doc/macaddr/Macaddr/index.html
Module Macaddr
Source
A library for manipulation of MAC address representations.
v5.4.0 - homepage
Parse_error (err,packet)
is raised when parsing of the MAC address syntax fails. err
contains a human-readable error and packet
is the original octet list that failed to parse.
Type of the hardware address (MAC) of an ethernet interface.
Functions converting MAC addresses to/from octets/string
of_octets_exn buf
is the hardware address extracted from buf
. Raises Parse_error
if buf
has not length 6.
Same as of_octets_exn
but returns a result type instead of raising an exception.
of_string_exn mac_string
is the human-readable hardware address represented by mac_string
. Raises Parse_error
if mac_string
is not a valid representation of a MAC address.
Same as of_string_exn
but returns a result type instead of raising an exception.
to_octets mac_addr
is a string of size 6 encoding mac_addr
as a sequence of bytes.
to_string ?(sep=':') mac_addr
is the sep
-separated string representation of mac_addr
, i.e. xx:xx:xx:xx:xx:xx
.
pp f mac_addr
outputs a human-readable representation of mac_addr
to the formatter f
.
make_local bytegen
creates a unicast, locally administered MAC address given a function mapping octet offset to octet value.
is_local macaddr
is the predicate on the locally administered bit of macaddr
.
is_unicast macaddr
the is the predicate on the unicast bit of macaddr
.
include Map.OrderedType with type t := t
A total ordering function over the keys. This is a two-argument function f
such that f e1 e2
is zero if the keys e1
and e2
are equal, f e1 e2
is strictly negative if e1
is smaller than e2
, and f e1 e2
is strictly positive if e1
is greater than e2
. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare
.