Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (2) — Plan9 1st Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

print(2)

IP(2)

NAME

eipconv, parseip, parseether, myipaddr, myetheraddr, maskip, equivip − Internet protocol

SYNOPSIS

­#include <u.h>
­#include <libc.h>
­#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 E) and Internet protocol (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 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. 

SOURCE

­/sys/src/libip

SEE ALSO

print(2)

Plan 9  —  April 04, 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026