ether(3)

SYNOPSIS

ether.src addr

ether.dst addr

popen ether id interface [promisc [filter]]

pclose ether id

pinit ether pkt [maxlength [length]]

pfree pkt

pget ether pkt field-name

pset ether pkt field-name value

plist pkt ether

id.send pkt

id.recv pkt [timeout]

DESCRIPTION

The ether protocol provides access to raw ethernet frames and the link layer protocol.

ether.src address
    Set the default source address to be used when packets are pinit'ed.

ether.dst address
    Set the default destination address to be used when packets are pinit'ed.

popen ether id interface promisc [filter]
    Open a network interface named interface and attach it to the indicated communications end-point. If the optional filter is present, it is a BPF-syntax filter expression which limits which packets are seen by the "recv" primitive for this end-point. Normally all packets are seen. The packet filter currently compiles to a user-mode BPF filter, on systems which don't support BPF kernel filters. If the filter cannot be parsed, an error is returned.

pclose ether id
    Close a previously popen'ed ethernet end-point.

pinit ether pkt [maxlength [length]]
    Initialize an ethernet packet variable. The source and destination addresses are initialized at creation to the default values. Those values must be set with ether.src and ether.dst commands. For more information on the maxlength and length parameters, see the psh(1) manual page.

pfree pkt
    Free the indicated packet buffer named pkt.

pget pkt ether field-name
    Fetch the indicated field field-name from the indicated packet pkt. The valid fields are the following: src, dst, type.

pset pkt ether field-name value
    Set the indicated field field-name from the indicated packet pkt to the value value. Similar to above. The symbollic names "ip", "arp", and "ipv6" are recognized for the ether-type field, or it can be specified by an integer.

plist pkt ether
    Summarize a ether packet.

id.send pkt
    Send the ethernet packet indicated.

id.recv pkt [timeout]
    Receive the next packet from the end-point indicated. If a value for timeout is specified, the receive operation will wait for no more than timeout milliseconds for a packet to arrive. If a packet is received, the string "packet" is returned, otherwise the string "timeout" is returned for a timeout.

FILES

/opt/psh/lib/ether
    Dynamically linked library protocol for ether.

SEE ALSO
xpsh(1), psh(1), protolib(3).

BUGS
There really should only be a single link-layer protocol, and the underlying mechanism, libpcap, supports this but it is not currently exposed to the user.