50 lines · 1.5 KB · Text
RawDownload
= ether: Ethernet address manipulation     include "ether.m";    ether := load Ether Ether->PATH;     Eaddrlen: con 6;     init:   fn();    parse:  fn(s: string): array of byte;    text:   fn(a: array of byte): string;    addressof:  fn(dev: string): array of byte;    eqaddr: fn(a, b: array of byte): int; Ether  provides  a  small  set  of  functions that manipulateEthernet MAC addresses, for the use of the  few  applicationssuch as bootpd(8) that must work with them. Init  must  be  called before using any other function in themodule. Parse takes a textual representation of a MAC  address  in  sand  returns its internal representation as an array of bytesof length Eaddrlen, the form used in packets read and writtenvia  ether(3).   S  is a string of twelve hexadecimal digits,corresponding to the six bytes of a MAC address.   Each  pairof  digits  can  optionally be separated by a colon.  If s isinvalid, parse returns nil. Text takes an array of bytes of length Eaddrlen  and  returnsits  textual  representation  (a string of twelve hexadecimaldigits).  It returns if the array is less than Eaddrlen,  butit ignores any bytes beyond that. Addressof  returns  the MAC address of the given Ether devicedev (eg, which it reads from dev/addr.  It  returns  nil  andsets  the  error  string  if  that  file does not exist or isinvalid. Eqaddr returns true iff a and b are the same address. == filesnet/etherN/addr       hardware address of Ether N == source/appl/lib/ether.b == see ALSOip(2), ether(3)