package ethernet

  1. Overview
  2. Docs

Module Ethernet.PacketSource

Sourcetype proto = [
  1. | `ARP
  2. | `IPv4
  3. | `IPv6
]

Ethernet protocols.

Sourceval pp_proto : proto Fmt.t

pp_proto ppf proto pretty-prints the ethernet protocol proto on ppf.

Sourcetype t = {
  1. source : Macaddr.t;
  2. destination : Macaddr.t;
  3. ethertype : proto;
}

The type of an Ethernet packet.

Sourceval sizeof_ethernet : int

sizeof_ethernet is the byte size of the ethernet header.

Sourceval of_cstruct : Cstruct.t -> (t * Cstruct.t, string) result

of_cstruct buffer attempts to decode the buffer as ethernet packet. It may result an error if the buffer is too small, or the protocol is not supported.

Sourceval into_cstruct : t -> Cstruct.t -> (unit, string) result

into_cstruct t cs attempts to encode the ethernet packet t into the buffer cs (at offset 0). This may fail if the buffer is not big enough.

Sourceval make_cstruct : t -> Cstruct.t

make_cstruct t encodes the ethernet packet t into a freshly allocated buffer.

OCaml

Innovation. Community. Security.