index.txt
IP(2) System Calls Manual IP(2) NAME eipconv, parseip, parseether, myipaddr, myetheraddr, maskip, equivip - Internet protocol SYNOPSIS #include <u.h> #include <libc.h> #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 manipu‐ late 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 ad‐ dresses is exactly 12 hexadecimal digits. Eipconv is a print(2) formatter for Ethernet (verb E) and Internet pro‐ tocol (verb I) 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 nega‐ tive number on errors. Parseether converts a string pointed to by str to a 6 byte Ethernet ad‐ dress 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 ar‐ guments are equal. SOURCE /sys/src/libip SEE ALSO print(2) IP(2)