1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2007-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20%% SCTP protocol contribution by Leonid Timochouk and Serge Aleynikov. 21%% See also: $ERL_TOP/lib/kernel/AUTHORS 22%% 23 24%% 25%% SCTP-related records. 26%% 27 28%% sctp_initmsg: For creating a new association (send*) and 29%% SCTP_OPT_INITMSG setsockopt: 30-record(sctp_initmsg, 31 { 32 num_ostreams, % 0 Use endpoint default 33 max_instreams, % 0 Use endpoint default 34 max_attempts, % 0 Use endpoint default 35 max_init_timeo % 0 Use endpoint default 36 }). 37 38%% sctp_sndrcvinfo: Possible "flags": Atoms, as below. Used 39%% in "send*" and SCTP_OPT_DEFAULT_SEND_PARAM setsockopt: 40-record(sctp_sndrcvinfo, 41 { 42 stream, % 0 Streams numbered from 0 (XXX?) 43 ssn, % 0, Ignored for send 44 flags, % [unordered, 45 %% addr_over, 46 %% abort, 47 %% eof] 48 ppid, % 0, Passed to the remote end 49 context, % 0, Passed to the user on error 50 timetolive, % 0, In msec; 0 -> no expiration 51 tsn, % 0, Recv only: TSN of one of the chunks 52 cumtsn, % 0, Only for unordered recv 53 assoc_id % 0 IMPORTANT! 54 }). 55 56%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57%% 58%% SCTP Notification Events: 59%% 60 61%% sctp_assoc_change: Possible valid "state" values include: 62%% comm_up, comm_lost, restart, 63%% shutdown_comp, cant_assoc 64-record(sctp_assoc_change, 65 { 66 state = cant_assoc, 67 error = 0, 68 outbound_streams = 0, 69 inbound_streams = 0, 70 assoc_id = 0 71 }). 72 73%% sctp_paddr_change: Peer address is a list. Possible "state" values: 74%% addr_available, addr_unreachable, 75%% addr_removed, addr_added, 76%% addr_made_prim 77-record(sctp_paddr_change, 78 { 79 addr = [0,0,0,0], 80 state = addr_available, 81 error = 0, 82 assoc_id = 0 83 }). 84 85%% sctp_remote_error: Possible "data" elements are Error Causes (Atoms 86%% (extending the info provided by "error" field). 87-record(sctp_remote_error, 88 { 89 error = 0, 90 assoc_id = 0, 91 data = [] 92 }). 93 94%% sctp_send_failed: The "flags" is a Boolean specifying whether the 95%% data have actually been transmitted over the wire. 96%% "error" is similar to in #sctp_remote_error{} above. 97%% "info" is the orig "*sndrcvinfo", and "data" is 98%% the whole orig data chunk we attempted to send: 99-record(sctp_send_failed, 100 { 101 flags = false, 102 error = 0, 103 info = #sctp_sndrcvinfo{}, 104 assoc_id = 0, 105 data = <<>> 106 }). 107 108%% sctp_shutdown_event: In this case, shut-down occurs on a particular 109%% association, not on the whole socket. 110-record(sctp_shutdown_event, 111 { 112 assoc_id = 0 113 }). 114 115%% sctp_adaptation_event: "adaptation_ind" is opaque user-specified data: 116-record(sctp_adaptation_event, 117 { 118 adaptation_ind = 0, 119 assoc_id = 0 120 }). 121 122%% sctp_partial_delivery_event: XXX: Not clear whether it is delivered to 123%% the Sender or to the Recepient (probably the 124%% former). Currently, there is only 1 possible 125%% value for "indication": 126-record(sctp_pdapi_event, 127 { 128 indication = partial_delivery_aborted, 129 assoc_id = 0 130 }). 131 132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 133%% 134%% SCTP Socket Options: 135%% 136 137-record(sctp_rtoinfo, % For SCTP_OPT_RTOINFO 138 { 139 assoc_id, 140 initial, % 0 141 max, % 0 142 min % 0 143 }). 144 145-record(sctp_assocparams, % For SCTP_OPT_ASSOCINFO 146 { 147 assoc_id, 148 asocmaxrxt, % 0 149 number_peer_destinations, % 0 150 peer_rwnd, % 0 151 local_rwnd, % 0 152 cookie_life % 0 153 }). 154 155% #sctp_initmsg{} and #sctp_sndrcvinfo{}, declared above, can also be options. 156 157-record(sctp_prim, % For SCTP_OPT_SET_PRIMARY_ADDR and 158 { 159 assoc_id, 160 addr % When set: {IP, Port} 161 }). 162 163-record(sctp_setpeerprim, % For SCTP_OPT_SET_PEER_PRIMARY_ADDR 164 { 165 assoc_id, 166 addr % When set: { IP, Port} 167 }). 168 169-record(sctp_setadaptation, % For SCTP_OPT_ADAPTATION_LAYER 170 { 171 adaptation_ind % 0 172 }). 173 174-record(sctp_paddrparams, % For SCTP_OPT_PEER_ADDR_PARAMS 175 { 176 assoc_id, 177 address, % When set: {IP, Port} 178 hbinterval, % 0 179 pathmaxrxt, % 0 180 pathmtu, % 0 181 sackdelay, % 0 182 flags % [hb_enable, 183 %% hb_disable 184 %% hb_demand, 185 %% pmtud_enable, 186 %% pmtud_disable, 187 %% sackdelay_enable, 188 %% sackdelay_disable] 189 }). 190 191 192% SCTP events which will be subscribed by default upon opening the socket. 193% NB: "data_io_event" controls delivery of #sctp_sndrcvinfo{} ancilary 194% data, not events (which are normal data) in fact; it may be needed in 195% order to get the AssocID of data just received: 196% 197-record(sctp_event_subscribe, 198 { 199 data_io_event, % true, % Used by gen_sctp 200 association_event, % true, % Used by gen_sctp 201 address_event, % true, % Unlikely to happen... 202 send_failure_event, % true, % Delivered as an ERROR 203 peer_error_event, % true, % Delivered as an ERROR 204 shutdown_event, % true, % Used by gen_sctp 205 partial_delivery_event, % true, % Unlikely to happen... 206 adaptation_layer_event, % false % Probably not needed... 207 authentication_event % false % Not implemented yet... 208 }). 209 210-record(sctp_assoc_value, % For SCTP_OPT_DELAYED_ACK_TIME 211 { 212 assoc_id, 213 assoc_value % 0 214 }). 215 216 217 218% sctp_paddrinfo and sctp_status are records for read-only options: 219-record(sctp_paddrinfo, 220 { 221 assoc_id, 222 address, % When set: {IP, Port} 223 state, % 'inactive', Or 'active' 224 cwnd, % 0 225 srtt, % 0, 226 rto, % 0 227 mtu % 0 228 }). 229 230-record(sctp_status, 231 { 232 assoc_id, 233 state, % empty, 234 % Other possible states: 235 % closed, cookie_wait, 236 % cookie_echoed, established, 237 % shutdown_pending, shutdow_sent, 238 % shutdown_received, shutdown_ack_sent; 239 % NOT YET IMPLEMENTED: 240 % bound, listen 241 rwnd, % 0 242 unackdata, % 0, 243 penddata, % 0, 244 instrms, % 0, 245 outstrms, % 0, 246 fragmentation_point, % 0, 247 primary % When set: an #sctp_paddrinfo{} record 248 }). 249