aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet6_sctp.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2010-08-25 18:03:09 +0200
committerRaimo Niskanen <[email protected]>2010-08-31 16:15:49 +0200
commiteaf1d4c5850ee84427d70e3df42fe777d82249c2 (patch)
treecc668454d7fa9aa450c1451111a8921e068b79fe /lib/kernel/src/inet6_sctp.erl
parenteca2411eb67461bf3cda66d0f981b47698ab99f3 (diff)
downloadotp-eaf1d4c5850ee84427d70e3df42fe777d82249c2.tar.gz
otp-eaf1d4c5850ee84427d70e3df42fe777d82249c2.tar.bz2
otp-eaf1d4c5850ee84427d70e3df42fe777d82249c2.zip
Keep default #sctp_sndrcvinfo{} fields on gen_sctp:send/4
Diffstat (limited to 'lib/kernel/src/inet6_sctp.erl')
-rw-r--r--lib/kernel/src/inet6_sctp.erl21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/kernel/src/inet6_sctp.erl b/lib/kernel/src/inet6_sctp.erl
index 5c49c4fec3..6534af7c52 100644
--- a/lib/kernel/src/inet6_sctp.erl
+++ b/lib/kernel/src/inet6_sctp.erl
@@ -32,7 +32,7 @@
-define(FAMILY, inet6).
-export([getserv/1,getaddr/1,getaddr/2,translate_ip/1]).
--export([open/1,close/1,listen/2,connect/5,sendmsg/3,recv/2]).
+-export([open/1,close/1,listen/2,connect/5,sendmsg/3,send/4,recv/2]).
@@ -71,5 +71,24 @@ connect(S, Addr, Port, Opts, Timer) ->
sendmsg(S, SRI, Data) ->
prim_inet:sendmsg(S, SRI, Data).
+send(S, AssocId, Stream, Data) ->
+ case prim_inet:getopts(
+ S,
+ [{sctp_default_send_param,#sctp_sndrcvinfo{assoc_id=AssocId}}]) of
+ {ok,
+ [{sctp_default_send_param,
+ #sctp_sndrcvinfo{
+ flags=Flags, context=Context, ppid=PPID, timetolive=TTL}}]} ->
+ prim_inet:sendmsg(
+ S,
+ #sctp_sndrcvinfo{
+ flags=Flags, context=Context, ppid=PPID, timetolive=TTL,
+ assoc_id=AssocId, stream=Stream},
+ Data);
+ _ ->
+ prim_inet:sendmsg(
+ S, #sctp_sndrcvinfo{assoc_id=AssocId, stream=Stream}, Data)
+ end.
+
recv(S, Timeout) ->
prim_inet:recvfrom(S, 0, Timeout).