: AddLink \ item anchor --
Used when a new item in the chain already exists, e.g. it
has been ALLOCATE
d. The item is added to the chain. Note
that this word requires the link to be at offset 0 in the
item being added.
: link, \ var-addr -- ; lay a link in a chain whose head is at var-addr
Add a link to a chain anchored at address var-addr. The old contents of
var-addr are added to the dictionary as the new link, and the address
of the new link is placed at var-addr.
INTERPRETER only.
: AddEndLink \ item anchor --
Add an item (a structure) to the end of of the chain
anchored at anchor. The link field must be at offset 0
in item.
: DelLink \ item anchor -- ; remove item from chain
Delete/Remove an item from a chain achored at address anchor.
Note that this word requires the link to be at offset 0
in the item being removed.
: ExecChain \ anchor --
Execute the contents of a chain with the following structure:
link | xt | ...
Each word that is run has the stack effect
link -- link
Where link is the address of the link field in the structure. Thus, data that follows the xt can easily be accessed.
: ShowPacket \ *pbuf -- ; display the packet
A diagnostic.
: >inet_aton \ caddr len -- ipaddr
Convert a dotted Internet address string, e.g. 192.168.0.1,
into an IPv4 address. If the string cannot be
converted, INADDR_NONE
(-1) is returned.
: (>inet_digit) \ n -- n>>8
Perform number conversion of the low byte, and shift n
right by 8 bits.
: >inet_ntoa \ ipaddr -- c-addr len
Convert an IP address into a text string c-addr/len
in dotted quad notation aaa.bbb.ccc.ddd (the standard
text form).
: .IPaddress \ ipaddr --
Display a v4 IP address in dotted quad notation. Now obsolete.
: .IPv4 \ ipaddr --
Display a v4 IP address ipaddr in dotted quad notation.
: .IPnet \ addr --
Display the v4 IP address stored in network order at addr.
: .IPloc \ addr --
Display the v4 IP address stored in native/local order at addr.
: ?free \ addr|0 --
Perform FREE DROP
if the input is non-zero.
: CopyEthAdd \ src dest -- ; copy ethernet address
Copy an Ethernet address. This is an ugly bit of code
which is faster than using ETHER_ADDRESS_LEN CMOVE
with most VFX compilers. If your CPU does not support
W@
and W!
as machine instructions, a simple
CMOVE
version may be faster.
: [sm \ -- 0
Starts the definition of a state machine's states.
: smState \ n -- n+1
Defines the next state as an EQU
and increments the state number.
: sm] \ n --
Finishes the state machine and defines an equate of the number of states.
: $>maca \ caddr len dest -- flag ; 0=good
Convert an Ethernet MAC address string into six bytes at
dest. If the string cannot be converted, flag is
returned non-zero. The string caddr/len is in the form:
aa-bb-cc-dd-ee-ff
where the number base is hexadecimal.