IP(2X) IP(2X) NAME eipconv, parseip, parseether, myipaddr, myetheraddr, maskip, etherip, equivip - Internet protocol SYNOPSIS #include <ip.h> int eipconv(void *o, int f1, int f2, int f3, int chr) int parseip(uchar *ipaddr, char *str) int parseether(uchar *eaddr, char *str) int myipaddr(uchar *ipaddr, char *net) int myetheraddr(uchar *eaddr, char *net) void maskip(uchar *from, uchar *mask, uchar *to) int equivip(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 sepa- rated 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. Page 1 Plan 9 (printed 12/21/24) IP(2X) IP(2X) SEE ALSO print(2) Page 2 Plan 9 (printed 12/21/24)