IP(2X)
NAME
eipconv, parseip, parseether, myipaddr, myetheraddr, maskip, etherip, equivip − Internet protocol
SYNOPSIS
#include <ip.h>
inteipconv(void ∗o, int f1, int f2, int f3, int chr)
intparseip(uchar ∗ipaddr, char ∗str)
intparseether(uchar ∗eaddr, char ∗str)
intmyipaddr(uchar ∗ipaddr, char ∗net)
intmyetheraddr(uchar ∗eaddr, char ∗net)
voidmaskip(uchar ∗from, uchar ∗mask, uchar ∗to)
intequivip(uchar ∗ipaddr1, uchar ∗ipaddr2)
DESCRIPTION
These routines are used by Internet Protocol (IP) programs to manipulate IP and Ethernet addresses. IP addresses are stored as a string of 4 unsigned chars, Ethernet addresses as 6 unsigned chars. The string representation of IP addresses is (up to) 4 decimal integers from 0 to 255 separated by periods. The string representation of Ethernet addresses is exactly 12 hexadecimal digits.
Eipconv is a print(2) formatter for Ethernet (verb I) and Internet protocol (verb E) addresses.
Parseip converts a string pointed to by str to a 4-byte IP address starting at ipaddr. Myipaddr reads the IP address string from file /net/1/local and parses it into ipaddr. Both routines return a negative number on errors.
Parseether converts a string pointed to by str to a 6 byte Ethernet address starting at eaddr. Myetheraddr reads the Ethernet address string from file net/1/stats and parses it into eaddr. Both routines return a negative number on errors.
Maskip places the bit-wise AND of the IP addresses pointed to by its first two arguments into the buffer pointed to by the third.
Equivip returns non-zero if the IP addresses pointed to by its two arguments are equal.
SEE ALSO
Plan 9 — January 03, 1993