9srv Manual Collection/plan9/ip(2) | 9srv Manual Collection/plan9/ip(2) |
---|
int eipfmt(Fmt*)
vlong parseip(uchar *ipaddr, char *str)
vlong parseipmask(uchar *ipaddr, char *str)
char* v4parseip(uchar *ipaddr, char *str)
ulong v4parsecidr(uchar *addr, uchar *mask, char *str)
int parseether(uchar *eaddr, char *str)
int myetheraddr(uchar *eaddr, char *dev)
int myipaddr(uchar *ipaddr, char *net)
void maskip(uchar *from, uchar *mask, uchar *to)
int equivip4(uchar *ipaddr1, uchar *ipaddr2)
int equivip6(uchar *ipaddr1, uchar *ipaddr2)
int ipcmp(uchar *ipaddr1, uchar *ipaddr2)
uchar* defmask(uchar *ipaddr)
int isv4(uchar *ipaddr)
void v4tov6(uchar *ipv6, uchar *ipv4)
void v6tov4(uchar *ipv4, uchar *ipv6)
ushort nhgets(void *p)
uint nhgetl(void *p)
uvlong nhgetv(void *p)
void hnputs(void *p, ushort v)
void hnputl(void *p, uint v)
void hnputv(void *p, uvlong v)
ushort ptclbsum(uchar *a, int n)
Ipifc* readipifc(char *net, Ipifc *ifc, int index)
uchar IPv4bcast[IPaddrlen];
uchar IPv4allsys[IPaddrlen];
uchar IPv4allrouter[IPaddrlen];
uchar IPallbits[IPaddrlen];
uchar IPnoaddr[IPaddrlen];
uchar v4prefix[IPaddrlen];
Eipfmt is a print(2) formatter for Ethernet (verb E) addresses, IP V6 (verb I) addresses, IP V4 (verb V) addresses, and IP V6 (verb M) masks.
Parseip converts a string pointed to by str to a 16-byte IP address starting at ipaddr. As a concession to backwards compatibility, if the string is a V4 address, the return value is an unsigned long integer containing the big-endian V4 address. If not, the return value is 6. Parseipmask converts a string pointed to by str to a 6-byte IP mask starting at ipaddr. It too returns an unsigned long big-endian V4 address or 6. Both routines return -1 on errors.
V4parseip converts a string pointed to by str to a 4-byte V4 IP address starting at ipaddr.
V4parsecidr converts a string of the form addr/mask, pointed to by str, to a 4-byte V4 IP address starting at ipaddr and a 4-byte V4 IP mask starting at mask.
Myipaddr returns the first valid IP address in the IP stack rooted at net.
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 dev/addr 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. Equivip4 operates on v4 addresses, equivip6 operates on v6 addresses. Ipcmp is a macro that compares V6 addresses per memcmp(2)).
Defmask returns the standard class A, B, or C mask for ipaddr.
Isv4 returns non-zero if the V6 address is in the V4 space, that is, if it starts with 0:0:0:0:0:0:FFFF. V4tov6 converts the 4-byte V4 address, v4ip, to a V6 address and puts the result in v6ip. V6tov4 converts the V6 address, v6ip, to a 4-byte V4 address and puts the result in v4ip.
Hnputs, hnputl and hnputv are used to store 16-bit, 32-bit, and 64-bit integers, respectively, into IP big-endian form. Nhgets, nhgetl and nhgetv convert big-endian 2, 4 and 8 byte quantities into integers (or uvlongs).
Pctlbsum returns the one's complement checksum used in IP protocols, typically invoked as
A number of standard IP addresses in V6 format are also defined. They are:
Readipifc returns information about a particular interface (index >= 0) or all IP interfaces (index < 0) configured under a mount point net, default /net. Each interface is described by one Ipifc structure which in turn points to a linked list of Iplifc structures describing the addresses assigned to this interface. If the list ifc is supplied, that list is freed. Thus, subsequent calls can be used to free the list returned by the previous call. Ipifc is:
Iplifc is:
Ipv6rp is:
Dev contains the first 64 bytes of the device configured with this interface. Net is ip&mask if the network is multipoint or the remote address if the network is point to point.
9srv Manual Collection/plan9/ip(2) | Rev: Sun Feb 02 22:33:04 GMT 2014 |