aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/include
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/kernel/include
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/kernel/include')
-rw-r--r--lib/kernel/include/file.hrl70
-rw-r--r--lib/kernel/include/inet.hrl36
-rw-r--r--lib/kernel/include/inet_sctp.hrl247
3 files changed, 353 insertions, 0 deletions
diff --git a/lib/kernel/include/file.hrl b/lib/kernel/include/file.hrl
new file mode 100644
index 0000000000..c1de4d764d
--- /dev/null
+++ b/lib/kernel/include/file.hrl
@@ -0,0 +1,70 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-ifndef(FILE_HRL_).
+-define(FILE_HRL_, 1).
+%%--------------------------------------------------------------------------
+
+%%-type namelist() :: [char() | atom() | namelist()].
+-type namelist() :: [_]. %% XXX: GROSS OVERAPPROXIMATION -- FIX ME
+-type name() :: string() | atom() | namelist().
+-type posix() :: atom().
+
+-type date() :: {pos_integer(), pos_integer(), pos_integer()}.
+-type time() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}.
+-type date_time() :: {date(), time()}.
+
+%%--------------------------------------------------------------------------
+
+-record(file_info,
+ {size :: non_neg_integer(), % Size of file in bytes.
+ type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink',
+ access :: 'read' | 'write' | 'read_write' | 'none',
+ atime :: date_time(), % The local time the file was last read:
+ % {{Year, Mon, Day}, {Hour, Min, Sec}}.
+ mtime :: date_time(), % The local time the file was last written.
+ ctime :: date_time(), % The interpretation of this time field
+ % is dependent on operating system.
+ % On Unix it is the last time the file or
+ % or the inode was changed. On Windows,
+ % it is the creation time.
+ mode :: integer(), % File permissions. On Windows,
+ % the owner permissions will be
+ % duplicated for group and user.
+ links :: non_neg_integer(), % Number of links to the file (1 if the
+ % filesystem doesn't support links).
+ major_device :: integer(), % Identifies the file system (Unix),
+ % or the drive number (A: = 0, B: = 1)
+ % (Windows).
+ %% The following are Unix specific.
+ %% They are set to zero on other operating systems.
+ minor_device :: integer(), % Only valid for devices.
+ inode :: integer(), % Inode number for file.
+ uid :: integer(), % User id for owner.
+ gid :: integer()}). % Group id for owner.
+
+
+-record(file_descriptor,
+ {module :: module(), % Module that handles this kind of file
+ data :: term()}). % Module dependent data
+
+-type fd() :: pid() | #file_descriptor{}.
+
+%%--------------------------------------------------------------------------
+-endif.
diff --git a/lib/kernel/include/inet.hrl b/lib/kernel/include/inet.hrl
new file mode 100644
index 0000000000..929b2ee294
--- /dev/null
+++ b/lib/kernel/include/inet.hrl
@@ -0,0 +1,36 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%% This record is returned by inet:gethostbyaddr/2 and inet:gethostbyname/2.
+
+
+-type hostname() :: atom() | string().
+-type ip4_address() :: {0..255,0..255,0..255,0..255}.
+-type ip6_address() :: {0..65535,0..65535,0..65535,0..65535,
+ 0..65535,0..65535,0..65535,0..65535}.
+-type ip_address() :: ip4_address() | ip6_address().
+-type ip_port() :: 0..65535.
+
+-record(hostent,
+ {
+ h_name :: hostname(), %% offical name of host
+ h_aliases = [] :: [hostname()], %% alias list
+ h_addrtype :: 'inet' | 'inet6', %% host address type
+ h_length :: non_neg_integer(), %% length of address
+ h_addr_list = [] :: [ip_address()] %% list of addresses from name server
+ }).
diff --git a/lib/kernel/include/inet_sctp.hrl b/lib/kernel/include/inet_sctp.hrl
new file mode 100644
index 0000000000..169ba013aa
--- /dev/null
+++ b/lib/kernel/include/inet_sctp.hrl
@@ -0,0 +1,247 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%% SCTP protocol contribution by Leonid Timochouk and Serge Aleynikov.
+%% See also: $ERL_TOP/lib/kernel/AUTHORS
+%%
+
+%%
+%% SCTP-related records.
+%%
+
+%% sctp_initmsg: For creating a new association (send*) and
+%% SCTP_OPT_INITMSG setsockopt:
+-record(sctp_initmsg,
+ {
+ num_ostreams, % 0 Use endpoint default
+ max_instreams, % 0 Use endpoint default
+ max_attempts, % 0 Use endpoint default
+ max_init_timeo % 0 Use endpoint default
+ }).
+
+%% sctp_sndrcvinfo: Possible "flags": Atoms, as below. Used
+%% in "send*" and SCTP_OPT_DEFAULT_SEND_PARAM setsockopt:
+-record(sctp_sndrcvinfo,
+ {
+ stream, % 0 Streams numbered from 0 (XXX?)
+ ssn, % 0, Ignored for send
+ flags, % [unordered,
+ %% addr_over,
+ %% abort,
+ %% eof]
+ ppid, % 0, Passed to the remote end
+ context, % 0, Passed to the user on error
+ timetolive, % 0, In msec; 0 -> no expiration
+ tsn, % 0, Recv only: TSN of one of the chunks
+ cumtsn, % 0, Only for unordered recv
+ assoc_id % 0 IMPORTANT!
+ }).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% SCTP Notification Events:
+%%
+
+%% sctp_assoc_change: Possible valid "state" values include:
+%% comm_up, comm_lost, restart,
+%% shutdown_comp, cant_assoc
+-record(sctp_assoc_change,
+ {
+ state = cant_assoc,
+ error = 0,
+ outbound_streams = 0,
+ inbound_streams = 0,
+ assoc_id = 0
+ }).
+
+%% sctp_paddr_change: Peer address is a list. Possible "state" values:
+%% addr_available, addr_unreachable,
+%% addr_removed, addr_added,
+%% addr_made_prim
+-record(sctp_paddr_change,
+ {
+ addr = [0,0,0,0],
+ state = addr_available,
+ error = 0,
+ assoc_id = 0
+ }).
+
+%% sctp_remote_error: Possible "data" elements are Error Causes (Atoms
+%% (extending the info provided by "error" field).
+-record(sctp_remote_error,
+ {
+ error = 0,
+ assoc_id = 0,
+ data = []
+ }).
+
+%% sctp_send_failed: The "flags" is a Boolean specifying whether the
+%% data have actually been transmitted over the wire.
+%% "error" is similar to in #sctp_remote_error{} above.
+%% "info" is the orig "*sndrcvinfo", and "data" is
+%% the whole orig data chunk we attempted to send:
+-record(sctp_send_failed,
+ {
+ flags = false,
+ error = 0,
+ info = #sctp_sndrcvinfo{},
+ assoc_id = 0,
+ data = <<>>
+ }).
+
+%% sctp_shutdown_event: In this case, shut-down occurs on a particular
+%% association, not on the whole socket.
+-record(sctp_shutdown_event,
+ {
+ assoc_id = 0
+ }).
+
+%% sctp_adaptation_event: "adaptation_ind" is opaque user-specified data:
+-record(sctp_adaptation_event,
+ {
+ adaptation_ind = 0,
+ assoc_id = 0
+ }).
+
+%% sctp_partial_delivery_event: XXX: Not clear whether it is delivered to
+%% the Sender or to the Recepient (probably the
+%% former). Currently, there is only 1 possible
+%% value for "indication":
+-record(sctp_pdapi_event,
+ {
+ indication = partial_delivery_aborted,
+ assoc_id = 0
+ }).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% SCTP Socket Options:
+%%
+
+-record(sctp_rtoinfo, % For SCTP_OPT_RTOINFO
+ {
+ assoc_id,
+ initial, % 0
+ max, % 0
+ min % 0
+ }).
+
+-record(sctp_assocparams, % For SCTP_OPT_ASSOCINFO
+ {
+ assoc_id,
+ asocmaxrxt, % 0
+ number_peer_destinations, % 0
+ peer_rwnd, % 0
+ local_rwnd, % 0
+ cookie_life % 0
+ }).
+
+% #sctp_initmsg{} and #sctp_sndrcvinfo{}, declared above, can also be options.
+
+-record(sctp_prim, % For SCTP_OPT_SET_PRIMARY_ADDR and
+ {
+ assoc_id,
+ addr % When set: {IP, Port}
+ }).
+
+-record(sctp_setpeerprim, % For SCTP_OPT_SET_PEER_PRIMARY_ADDR
+ {
+ assoc_id,
+ addr % When set: { IP, Port}
+ }).
+
+-record(sctp_setadaptation, % For SCTP_OPT_ADAPTATION_LAYER
+ {
+ adaptation_ind % 0
+ }).
+
+-record(sctp_paddrparams, % For SCTP_OPT_PEER_ADDR_PARAMS
+ {
+ assoc_id,
+ address, % When set: {IP, Port}
+ hbinterval, % 0
+ pathmaxrxt, % 0
+ pathmtu, % 0
+ sackdelay, % 0
+ flags % [hb_enable,
+ %% hb_disable
+ %% hb_demand,
+ %% pmtud_enable,
+ %% pmtud_disable,
+ %% sackdelay_enable,
+ %% sackdelay_disable]
+ }).
+
+
+% SCTP events which will be subscribed by default upon opening the socket.
+% NB: "data_io_event" controls delivery of #sctp_sndrcvinfo{} ancilary
+% data, not events (which are normal data) in fact; it may be needed in
+% order to get the AssocID of data just received:
+%
+-record(sctp_event_subscribe,
+ {
+ data_io_event, % true, % Used by gen_sctp
+ association_event, % true, % Used by gen_sctp
+ address_event, % true, % Unlikely to happen...
+ send_failure_event, % true, % Delivered as an ERROR
+ peer_error_event, % true, % Delivered as an ERROR
+ shutdown_event, % true, % Used by gen_sctp
+ partial_delivery_event, % true, % Unlikely to happen...
+ adaptation_layer_event, % false % Probably not needed...
+ authentication_event % false % Not implemented yet...
+ }).
+
+-record(sctp_assoc_value, % For SCTP_OPT_DELAYED_ACK_TIME
+ {
+ assoc_id,
+ assoc_value % 0
+ }).
+
+
+
+% sctp_paddrinfo and sctp_status are records for read-only options:
+-record(sctp_paddrinfo,
+ {
+ assoc_id,
+ address, % When set: {IP, Port}
+ state, % 'inactive', Or 'active'
+ cwnd, % 0
+ srtt, % 0,
+ rto, % 0
+ mtu % 0
+ }).
+
+-record(sctp_status,
+ {
+ assoc_id,
+ state, % empty,
+ % Other possible states:
+ % closed, cookie_wait,
+ % cookie_echoed, established,
+ % shutdown_pending, shutdow_sent,
+ % shutdown_received, shutdown_ack_sent;
+ % NOT YET IMPLEMENTED:
+ % bound, listen
+ rwnd, % 0
+ unackdata, % 0,
+ penddata, % 0,
+ instrms, % 0,
+ outstrms, % 0,
+ fragmentation_point, % 0,
+ primary % When set: an #sctp_paddrinfo{} record
+ }).