Module Eth.TRX

module TRX: sig .. end
An Ethernet TRX will convert from payload to Ethernet frames (resolving destinations using ARP), for a single Arp.HwProto.t.

type t = {
   src : Eth.Addr.t;
   gw : Eth.gw_addr option;
   proto : Arp.HwProto.t;
   mtu : int;
   mutable my_addresses : Bitstring.bitstring list;
   mutable emit : Bitstring.bitstring -> unit;
   mutable recv : Bitstring.bitstring -> unit;
   mutable promisc : Bitstring.bitstring -> unit;
   arp_cache : Eth.Addr.t option Tools.BitHash.t;
   delayed : Bitstring.bitstring Tools.BitHash.t;
}
type eth_trx = {
   trx : Tools.trx;
   set_promiscuous : (Bitstring.bitstring -> unit) -> unit;
   set_addresses : Bitstring.bitstring list -> unit;
   get_source : unit -> Eth.Addr.t;
   arp_set : Bitstring.bitstring -> Eth.Addr.t option -> unit;
}
val send : t -> Arp.HwProto.t -> Eth.Addr.t -> Tools.Payload.outer_t -> unit
Low level send fonction. Takes a Arp.HwProto.t since it's used both for the user payload protocol and ARP protocol.
val resolve_proto_addr : t ->
Bitstring.bitstring -> Bitstring.bitstring -> Bitstring.bitstring -> unit
type dst = 
| Delayed
| Dst of Eth.Addr.t
val arp_resolve_ipv4 : t ->
Bitstring.bitstring ->
Bitstring.bitstring -> Tools.BitHash.key -> dst
val dst_for : t -> Bitstring.bitstring -> dst Batteries.Option.Monad.m
val tx : t -> Bitstring.bitstring -> unit
Transmit function. tx t payload Will send the payload.
val rx : t -> string * int * int -> unit
Receive function, called to input an Ethernet frame into the TRX.
val make : ?mtu:int ->
Eth.Addr.t ->
?gw:Eth.gw_addr ->
?promisc:(Bitstring.bitstring -> unit) ->
Arp.HwProto.t -> Bitstring.bitstring list -> eth_trx
Creates an Eth.TRX.t.
mtu : the maximum transmit unit (ie. you won't be able to send longer payloads)
src : the source Eth.Addr.t
gw : an optional gateway
promisc : an optional function that will receive frames received but not destined to this TRX.
proto : the Arp.HwProto.t we want to transmit/receive.
my_addresses : a list of bitstrings that we consider to be our address (used for instance to reply to ARP queries)