From c6f772a04eafccf03d20b0bbda08c399b4640f38 Mon Sep 17 00:00:00 2001
From: Hans Bolinder
Date: Tue, 28 Jun 2011 14:00:10 +0200
Subject: Improve types and specifications of the inet modules
---
lib/kernel/doc/src/gen_sctp.xml | 144 +++++++++++++++++++---------------------
lib/kernel/doc/src/gen_tcp.xml | 23 +++----
lib/kernel/doc/src/gen_udp.xml | 21 +-----
lib/kernel/doc/src/inet.xml | 58 +++++-----------
4 files changed, 98 insertions(+), 148 deletions(-)
(limited to 'lib/kernel/doc')
diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml
index b761b6bd83..c0126ed8c1 100644
--- a/lib/kernel/doc/src/gen_sctp.xml
+++ b/lib/kernel/doc/src/gen_sctp.xml
@@ -63,7 +63,6 @@
- SCTP SOCKET OPTIONS
- SCTP EXAMPLES
- SEE ALSO
- - AUTHORS
@@ -80,36 +79,18 @@
-
-
-
-
-
- Represents an address of an SCTP socket.
- It is a tuple as explained in
- inet(3).
-
-
-
-
-
-
-
-
- See
- inet(3); POSIX Error Codes.
-
-
-
-
+
One of the
SCTP Socket Options.
-
-
+
+
+
+
+ sctp_socket()
Socket identifier returned from open/*.
@@ -175,8 +156,8 @@
#sctp_assoc_change{
state = atom(),
error = atom(),
- outbound_streams = int(),
- inbound_streams = int(),
+ outbound_streams = integer(),
+ inbound_streams = integer(),
assoc_id = assoc_id()
}
The number of outbound and inbound streams can be set by
@@ -300,6 +281,19 @@
The default IP and Port are any
and 0, meaning bind to all local addresses on any
one free port.
+
+ Other options are:
+
+ inet6
+ -
+
Set up the socket for IPv6.
+
+ inet
+ -
+
Set up the socket for IPv4. This is the default.
+
+
+
A default set of socket options
is used. In particular, the socket is opened in
binary and
@@ -350,7 +344,7 @@
#sctp_paddr_change{
addr = {ip_address(),port()},
state = atom(),
- error = int(),
+ error = integer(),
assoc_id = assoc_id()
}
Indicates change of the status of the peer's IP address given by
@@ -387,7 +381,7 @@
#sctp_send_failed{
flags = true | false,
- error = int(),
+ error = integer(),
info = #sctp_sndrcvinfo{},
assoc_id = assoc_id()
data = binary()
@@ -407,7 +401,7 @@
-
#sctp_adaptation_event{
- adaptation_ind = int(),
+ adaptation_ind = integer(),
assoc_id = assoc_id()
}
Delivered when a peer sends an Adaptation Layer Indication
@@ -505,7 +499,7 @@
- {buffer, int()}
+ {buffer, integer()}
-
Determines the size of the user-level software buffer used by
the SCTP driver. Not to be confused with sndbuf
@@ -515,7 +509,7 @@
In fact, the val(buffer) is automatically set to
the above maximum when sndbuf or recbuf values are set.
- {tos, int()}
+ {tos, integer()}
-
Sets the Type-Of-Service field on the IP datagrams being sent,
to the given value, which effectively determines a prioritization
@@ -523,7 +517,7 @@
are system-dependent. TODO: we do not provide
symbolic names for these values yet.
- {priority, int()}
+ {priority, integer()}
-
A protocol-independent equivalent of tos above. Setting
priority implies setting tos as well.
@@ -542,7 +536,7 @@
required for high-throughput servers).
- {linger, {true|false, int()}
+ {linger, {true|false, integer()}
-
Determines the timeout in seconds for flushing unsent data in the
gen_sctp:close/1 socket call. If the 1st component of the value
@@ -552,14 +546,14 @@
the flushing time-out in seconds.
- {sndbuf, int()}
+ {sndbuf, integer()}
-
The size, in bytes, of the *kernel* send buffer for this socket.
Sending errors would occur for datagrams larger than
val(sndbuf). Setting this option also adjusts
the size of the driver buffer (see buffer above).
- {recbuf, int()}
+ {recbuf, integer()}
-
The size, in bytes, of the *kernel* recv buffer for this socket.
Sending errors would occur for datagrams larger than
@@ -571,9 +565,9 @@
#sctp_rtoinfo{
assoc_id = assoc_id(),
- initial = int(),
- max = int(),
- min = int()
+ initial = integer(),
+ max = integer(),
+ min = integer()
}
Determines re-transmission time-out parameters, in milliseconds,
for the association(s) given by assoc_id.
@@ -586,11 +580,11 @@
#sctp_assocparams{
assoc_id = assoc_id(),
- asocmaxrxt = int(),
- number_peer_destinations = int(),
- peer_rwnd = int(),
- local_rwnd = int(),
- cookie_life = int()
+ asocmaxrxt = integer(),
+ number_peer_destinations = integer(),
+ peer_rwnd = integer(),
+ local_rwnd = integer(),
+ cookie_life = integer()
}
Determines association parameters for the association(s) given by
assoc_id. assoc_id = 0 (default) indicates
@@ -601,10 +595,10 @@
-
#sctp_initmsg{
- num_ostreams = int(),
- max_instreams = int(),
- max_attempts = int(),
- max_init_timeo = int()
+ num_ostreams = integer(),
+ max_instreams = integer(),
+ max_attempts = integer(),
+ max_init_timeo = integer()
}
Determines the default parameters which this socket attempts
to negotiate with its peer while establishing an association with it.
@@ -630,10 +624,11 @@
- {sctp_autoclose, int()|infinity}
+ {sctp_autoclose, integer() >= 0}
-
Determines the time (in seconds) after which an idle association is
- automatically closed.
+ automatically closed. 0 means that the association is
+ never automatically closed.
{sctp_nodelay, true|false}
-
@@ -655,7 +650,7 @@
Turns on|off automatic mapping of IPv4 addresses into IPv6 ones
(if the socket address family is AF_INET6).
- {sctp_maxseg, int()}
+ {sctp_maxseg, integer()}
-
Determines the maximum chunk size if message fragmentation is used.
If 0, the chunk size is limited by the Path MTU only.
@@ -693,7 +688,7 @@
#sctp_setadaptation{
- adaptation_ind = int()
+ adaptation_ind = integer()
}
When set, requests that the local endpoint uses the value given by
adaptation_ind as the Adaptation Indication parameter for
@@ -707,10 +702,10 @@
#sctp_paddrparams{
assoc_id = assoc_id(),
address = {IP, Port},
- hbinterval = int(),
- pathmaxrxt = int(),
- pathmtu = int(),
- sackdelay = int(),
+ hbinterval = integer(),
+ pathmaxrxt = integer(),
+ pathmtu = integer(),
+ sackdelay = integer(),
flags = list()
}
IP = ip_address()
@@ -771,14 +766,14 @@
#sctp_sndrcvinfo{
- stream = int(),
- ssn = int(),
+ stream = integer(),
+ ssn = integer(),
flags = list(),
- ppid = int(),
- context = int(),
- timetolive = int(),
- tsn = int(),
- cumtsn = int(),
+ ppid = integer(),
+ context = integer(),
+ timetolive = integer(),
+ tsn = integer(),
+ cumtsn = integer(),
assoc_id = assoc_id()
}
#sctp_sndrcvinfo{} is used both in this socket option, and as
@@ -853,7 +848,7 @@
#sctp_assoc_value{
assoc_id = assoc_id(),
- assoc_value = int()
+ assoc_value = integer()
}
Rarely used. Determines the ACK time
(given by assoc_value in milliseconds) for
@@ -866,12 +861,12 @@
#sctp_status{
assoc_id = assoc_id(),
state = atom(),
- rwnd = int(),
- unackdata = int(),
- penddata = int(),
- instrms = int(),
- outstrms = int(),
- fragmentation_point = int(),
+ rwnd = integer(),
+ unackdata = integer(),
+ penddata = integer(),
+ instrms = integer(),
+ outstrms = integer(),
+ fragmentation_point = integer(),
primary = #sctp_paddrinfo{}
}
This option is read-only. It determines the status of
@@ -946,10 +941,10 @@
assoc_id = assoc_id(),
address = {IP, Port},
state = inactive | active,
- cwnd = int(),
- srtt = int(),
- rto = int(),
- mtu = int()
+ cwnd = integer(),
+ srtt = integer(),
+ rto = integer(),
+ mtu = integer()
}
IP = ip_address()
Port = port_number()
@@ -1119,7 +1114,6 @@ client_loop(S, Peer1, Port1, AssocId1, Peer2, Port2, AssocId2) ->
gen_udp(3),
RFC2960 (Stream Control Transmission Protocol),
Sockets API Extensions for SCTP.
-
diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml
index ebd822359a..8a5d40bb16 100644
--- a/lib/kernel/doc/src/gen_tcp.xml
+++ b/lib/kernel/doc/src/gen_tcp.xml
@@ -65,25 +65,16 @@ do_recv(Sock, Bs) ->
-
+
-
-
- Represents an address of a TCP socket.
- It is a tuple as explained in
- inet(3).
-
+
-
+
-
-
- See
- inet(3); POSIX Error Codes.
-
+
socket()
@@ -122,7 +113,7 @@ do_recv(Sock, Bs) ->
-
Specify which local port number to use.
- {fd, int()}
+ {fd, integer() >= 0}
-
If a socket has somehow been connected without using
gen_tcp, use this option to pass the file
@@ -196,6 +187,10 @@ do_recv(Sock, Bs) ->
If the host has several network interfaces, this option
specifies which one to listen on.
+ {port, Port}
+ -
+
Specify which local port number to use.
+
{fd, Fd}
-
If a socket has somehow been connected without using
diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml
index c0e783f508..daa9b7d887 100644
--- a/lib/kernel/doc/src/gen_udp.xml
+++ b/lib/kernel/doc/src/gen_udp.xml
@@ -36,25 +36,10 @@
-
+
-
-
- Represents an address of a TCP socket.
- It is a tuple as explained in
- inet(3).
-
-
-
-
-
-
-
-
- See
- inet(3); POSIX Error Codes.
-
+
socket()
@@ -87,7 +72,7 @@
If the host has several network interfaces, this option
specifies which one to use.
- {fd, int()}
+ {fd, integer() >= 0}
-
If a socket has somehow been opened without using
gen_udp, use this option to pass the file
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index fd843b00d9..b36c28e027 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -104,6 +104,9 @@ fe80::204:acff:fe17:bf38
+
+
+
An atom which is named from the Posix error codes
@@ -119,7 +122,7 @@ fe80::204:acff:fe17:bf38
-
+
@@ -250,26 +253,15 @@ fe80::204:acff:fe17:bf38
- getopts(Socket, Options) -> {ok, OptionValues} | {error, posix()}
+
Get one or more options for a socket
-
- Socket = term()
- Options = [Opt | RawOptReq]
- Opt = atom()
- RawOptReq = {raw, Protocol, OptionNum, ValueSpec}
- Protocol = integer()
- OptionNum = integer()
- ValueSpec = ValueSize | ValueBin
- ValueSize = integer()
- ValueBin = binary()
- OptionValues = [{Opt, Val} | {raw, Protocol, OptionNum, ValueBin}]
-
+
Gets one or more options for a socket.
See setopts/2
for a list of available options.
- The number of elements in the returned OptionValues
+
The number of elements in the returned OptionValues
list does not necessarily correspond to the number of options
asked for. If the operating system fails to support an option,
it is simply left out in the returned list. An error tuple is only
@@ -277,12 +269,12 @@ fe80::204:acff:fe17:bf38
(i.e. the socket is closed or the buffer size in a raw request
is too large). This behavior is kept for backward
compatibility reasons.
- A RawOptReq can be used to get information about
+
A raw option request RawOptReq = {raw, Protocol, OptionNum, ValueSpec} can be used to get information about
socket options not (explicitly) supported by the emulator. The
use of raw socket options makes the code non portable, but
allows the Erlang programmer to take advantage of unusual features
present on the current platform.
- The RawOptReq consists of the tag raw followed
+
The RawOptReq consists of the tag raw followed
by the protocol level, the option number and either a binary
or the size, in bytes, of the
buffer in which the option value is to be stored. A binary
@@ -325,19 +317,14 @@ fe80::204:acff:fe17:bf38
- getstat(Socket)
- getstat(Socket, Options) -> {ok, OptionValues} | {error, posix()}
+
+
Get one or more statistic options for a socket
-
- Socket = term()
- Options = [Opt]
- OptionValues = [{Opt, Val}]
- Opt, Val -- see below
-
+
Gets one or more statistic options for a socket.
- getstat(Socket) is equivalent to
- getstat(Socket, [recv_avg, recv_cnt, recv_dvi, recv_max, recv_oct, send_avg, send_cnt, send_dvi, send_max, send_oct])
+ getstat(Socket) is equivalent to
+ getstat(Socket, [recv_avg, recv_cnt, recv_dvi, recv_max, recv_oct, send_avg, send_cnt, send_dvi, send_max, send_oct])
The following options are available:
recv_avg
@@ -394,12 +381,8 @@ fe80::204:acff:fe17:bf38
- port(Socket) -> {ok, Port} | {error, any()}
+
Return the local port number for a socket
-
- Socket = socket()
- Port = integer()
-
Returns the local port number for a socket.
@@ -412,16 +395,9 @@ fe80::204:acff:fe17:bf38
- setopts(Socket, Options) -> ok | {error, posix()}
+
Set one or more options for a socket
-
- Socket = term()
- Options = [{Opt, Val} | {raw, Protocol, Option, ValueBin}]
- Protocol = integer()
- OptionNum = integer()
- ValueBin = binary()
- Opt, Val -- see below
-
+
Sets one or more options for a socket. The following options
are available:
--
cgit v1.2.3