From d5c04534c1a04701493c28ff24d7040cc513515c Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Tue, 9 Nov 2010 16:11:07 +0100 Subject: Write documentation --- lib/kernel/doc/src/inet.xml | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index 2ae230152c..a22c0a8346 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -220,6 +220,69 @@ fe80::204:acff:fe17:bf38

Returns the local hostname. Will never fail.

+ + + getifaddrs() -> {ok,Iflist} | {error,posix} + Return a list of interfaces and their addresses + + Iflist = {Ifname,[Ifopt]} + Ifname = string() + Ifopt = {flag,[Flag]} | {addr,Addr} | {netmask,Netmask} + | {broadaddr,Broadaddr} | {dstaddr,Dstaddr} + | {hwaddr,Hwaddr} + Flag = up | broadcast | loopback | pointtopoint + | running | multicast + Addr = Netmask = Broadadddr = Dstaddr = ip_address() + Hwaddr = [byte()] + + + +

+ Returns a list of 2-tuples containing interface names and the + interface's addresses. Ifname is a Unicode string. + Hwaddr is hardware dependent, e.g on Ethernet interfaces + it is the 6-byte Ethernet address (MAC address (EUI-48 address)). +

+

+ The {addr,Addr}, {netmask,_} and {broadaddr,_} + tuples are repeated in the result list iff the interface has multiple + addresses. If you come across an interface that has + multiple {flag,_} or {hwaddr,_} tuples you have + a really strange interface or possibly a bug in this function. + The {flag,_} tuple is mandatory, all other optional. +

+

+ Do not rely too much on the order of Flag atoms or + Ifopt tuples. There are some rules, though: + + + Immediately after {addr,_} follows {netmask,_} + + + Immediately thereafter follows {broadaddr,_} if + the broadcast flag is not set and the + pointtopointflag is set. + + + Any {netmask,_}, {broadaddr,_} or + {dstaddr,_} tuples that follow an {addr,_} + tuple concerns that address. + + +

+

+ The {hwaddr,_} tuple is not returned on Solaris since the + hardware address historically belongs to the link layer and only + the superuser can read such addresses. +

+

+ On Windows, the data is fetched from quite different OS API + functions, so the Netmask and Broadaddr + values may be calculated, just as some Flag values. + You have been warned. Report flagrant bugs. +

+
+ getopts(Socket, Options) -> {ok, OptionValues} | {error, posix()} Get one or more options for a socket -- cgit v1.2.3