From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Tuexen Newsgroups: gmane.lisp.guile.devel Subject: Initial SCTP support for the upcoming 1.6.5 release Date: Tue, 10 Aug 2004 20:26:23 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (Apple Message framework v618) Content-Type: multipart/mixed; boundary=Apple-Mail-5-38549950 X-Trace: sea.gmane.org 1092162447 22130 80.91.224.253 (10 Aug 2004 18:27:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Aug 2004 18:27:27 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Aug 10 20:27:16 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BubL9-00015g-00 for ; Tue, 10 Aug 2004 20:27:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BubOy-0000jE-Cs for guile-devel@m.gmane.org; Tue, 10 Aug 2004 14:31:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BubOv-0000j9-9W for guile-devel@gnu.org; Tue, 10 Aug 2004 14:31:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BubOu-0000il-CQ for guile-devel@gnu.org; Tue, 10 Aug 2004 14:31:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BubOu-0000iZ-4m for guile-devel@gnu.org; Tue, 10 Aug 2004 14:31:08 -0400 Original-Received: from [193.175.24.27] (helo=ilsa.franken.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BubKg-00064A-KS for guile-devel@gnu.org; Tue, 10 Aug 2004 14:26:47 -0400 Original-Received: from [192.168.1.2] (p508A6418.dip.t-dialin.net [80.138.100.24]) by ilsa.franken.de (Postfix) with ESMTP id 23C89245C9 for ; Tue, 10 Aug 2004 20:26:42 +0200 (CEST) (KNF account authenticated via SMTP-AUTH) Original-To: guile-devel@gnu.org X-Mailer: Apple Mail (2.618) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3936 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3936 --Apple-Mail-5-38549950 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Dear all, it would be very helpful for me (and some others) if the 1.6.5 release could have some support for SCTP. To see what kind of change this requires I'm appending the diff files for libguile/socket.[ch]. What are the changes (for socket.h)? - add to prototypes for sctp-recvmsg and sctp-sendmsg. These changes are #ifdefed. What are the changes (for socket.c)? - include if available. #ifdefed. - add two line of code to initialize socket structures to zero. (If you do not like these two changes, take them out. They helped for some SCTP implementations not doing this in the kernel. At least one of them is fixed now). - add sctp-recvmsg and sctp-sendmsg wrapper functions. These are #ifdefed. - add some constants, if they are available. #ifdefed. What is still missing (configure.in)? - A check for the existence of netinet/sctp.h. If yes, define HAVE_NETINET_SCTP_H - A check if sctp_sendmsg is contained in libsctp. If yes, define HAVE_SCTP_SENDMSG an add libsctp to the list of libraries to be used. - A check if sctp_recvmsg is contained in libsctp. If yes, define HAVE_SCTP_RECVMSG an add libsctp to the list of libraries to be used. (libsctp is located on some platforms in /usr/lib, /usr/local/lib and /usr/local/v6/lib) This can be done by adding some lines to configure.in. I will test the configure.in changes and send a patch for configure.in later this week. Please let me know if these patches can be included in the upcoming 1.6.5 release. Thank you very much. Best regards Michael --Apple-Mail-5-38549950 Content-Transfer-Encoding: quoted-printable Content-Type: application/octet-stream; x-unix-mode=0644; name="socket.c.diff" Content-Disposition: attachment; filename=socket.c.diff ---=20guile-core-20040808/libguile/socket.c=09Fri=20Mar=2015=2010:23:19=20= 2002=0A+++=20guile-core-mod/libguile/socket.c=09Tue=20Aug=2010=20= 20:23:56=202004=0A@@=20-71,6=20+71,9=20@@=0A=20#include=20=0A= =20#include=20=0A=20#include=20=0A+#ifdef=20= HAVE_NETINET_SCTP_H=0A+#include=20=0A+#endif=0A=20#endif=0A= =20=0A=20#if=20defined=20(HAVE_UNIX_DOMAIN_SOCKETS)=20&&=20!defined=20= (SUN_LEN)=0A@@=20-706,6=20+709,7=20@@=0A=20=09=20=20scm_memory_error=20= (proc);=0A=20=09/*=204.4BSD-style=20interface=20includes=20sin_len=20= member=20and=20defines=20SIN_LEN,=0A=20=09=20=20=204.3BSD=20=20does=20= not.=20=20*/=0A+=09memset((void=20*)soka,=200,=20sizeof(struct=20= sockaddr_in));=0A=20#ifdef=20SIN_LEN=0A=20=09soka->sin_len=20=3D=20= sizeof=20(struct=20sockaddr_in);=0A=20#endif=0A@@=20-742,6=20+746,7=20@@=0A= =20=09soka=20=3D=20(struct=20sockaddr_in6=20*)=20malloc=20(sizeof=20= (struct=20sockaddr_in6));=0A=20=09if=20(!soka)=0A=20=09=20=20= scm_memory_error=20(proc);=0A+=09memset((void=20*)soka,=200,=20= sizeof(struct=20sockaddr_in6));=0A=20#ifdef=20SIN_LEN6=0A=20=09= soka->sin6_len=20=3D=20sizeof=20(struct=20sockaddr_in6);=0A=20#endif=0A= @@=20-1202,6=20+1207,72=20@@=0A=20}=0A=20#undef=20FUNC_NAME=0A=20=0A= +#ifdef=20HAVE_SCTP_RECVMSG=0A+=0A+SCM_DEFINE=20(scm_sctp_recvmsg,=20= "sctp-recvmsg!",=202,=202,=200,=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (SCM=20sock,=20SCM=20str,=20SCM=20start,=20SCM=20end),=0A+=09=20=20=20=20= "Return=20data=20from=20the=20socket=20port=20@var{sock}=20and=20also\n"=0A= +=09=20=20=20=20"information=20about=20where=20the=20data=20was=20= received=20from.\n"=0A+=09=20=20=20=20"@var{sock}=20must=20already=20be=20= bound=20to=20the=20address=20from=20which\n"=0A+=09=20=20=20=20"data=20= is=20to=20be=20received.=20=20@code{str},=20is=20a=20string=20into=20= which=20the\n"=0A+=09=20=20=20=20"data=20will=20be=20written.=20=20The=20= size=20of=20@var{str}=20limits=20the=20amount\n"=0A+=09=20=20=20=20"of=20= data=20which=20can=20be=20received:=20in=20the=20case=20of=20packet=20= protocols,\n"=0A+=09=20=20=20=20"if=20a=20packet=20larger=20than=20this=20= limit=20is=20encountered=20then=20some\n"=0A+=09=20=20=20=20"data=20will=20= be=20irrevocably=20lost.\n\n"=0A+=09=20=20=20=20"The=20value=20returned=20= is=20a=20list=20containing:\n"=0A+=09=20=20=20=20"-=20the=20number=20of=20= bytes=20read=20from=20the=20socket\n"=0A+=09=20=20=20=20"-=20an=20= address=20object=20in=20the=20same=20form=20as=20returned=20by=20= @code{accept}\n"=0A+=09=20=20=20=20"-=20the=20flags=20returned=20by=20= the=20sctp_recvmsg=20call\n"=0A+=09=20=20=20=20"-=20a=20list=20= containing=20the=20SID,=20SSN,=20PPID,=20TSN=20and=20CUM_TSN\n"=0A+=09=20= =20=20=20"The=20@var{start}=20and=20@var{end}=20arguments=20specify=20a=20= substring=20of\n"=0A+=09=20=20=20=20"@var{str}=20to=20which=20the=20data=20= should=20be=20written.\n\n"=0A+=09=20=20=20=20"Note=20that=20the=20data=20= is=20read=20directly=20from=20the=20socket=20file\n"=0A+=09=20=20=20=20= "descriptor:=20any=20unread=20buffered=20port=20data=20is=20ignored.")=0A= +#define=20FUNC_NAME=20s_scm_sctp_recvmsg=0A+{=0A+=20=20int=20rv;=0A+=20=20= int=20fd;=0A+=20=20int=20flg;=0A+=20=20char=20*buf;=0A+=20=20int=20= offset;=0A+=20=20int=20cend;=0A+=20=20SCM=20address,=20s_sinfo;=0A+=20=20= int=20addr_size=20=3D=20MAX_ADDR_SIZE;=0A+=20=20char=20= max_addr[MAX_ADDR_SIZE];=0A+=20=20struct=20sockaddr=20*addr=20=3D=20= (struct=20sockaddr=20*)=20max_addr;=0A+=20=20struct=20sctp_sndrcvinfo=20= sinfo;=0A+=20=20=0A+=20=20SCM_VALIDATE_OPFPORT=20(1,=20sock);=0A+=20=20= fd=20=3D=20SCM_FPORT_FDES=20(sock);=0A+=20=20= SCM_VALIDATE_SUBSTRING_SPEC_COPY=20(2,=20str,=20buf,=203,=20start,=20= offset,=0A+=09=09=09=09=20=20=20=204,=20end,=20cend);=0A+=0A+=20=20= addr->sa_family=20=3D=20AF_UNSPEC;=0A+=20=20flg=20=3D=200;=0A+=20=20= SCM_SYSCALL=20(rv=20=3D=20sctp_recvmsg=20(fd,=20buf=20+=20offset,=0A+=09=09= =09=20=20=20=20=20=20=20=20=20=20cend=20-=20offset,=0A+=09=09=09=20=20=20= =20=20=20=20=20=20=20addr,=20&addr_size,=0A+=09=09=09=20=20=20=20=20=20=20= =20=20=20&sinfo,=0A+=09=09=09=20=20=20=20=20=20=20=20=20=20&flg));=0A+=20= =20if=20(rv=20=3D=3D=20-1)=0A+=20=20=20=20SCM_SYSERROR;=0A+=20=20if=20= (addr->sa_family=20!=3D=20AF_UNSPEC)=0A+=20=20=20=20address=20=3D=20= scm_addr_vector=20(addr,=20FUNC_NAME);=0A+=20=20else=0A+=20=20=20=20= address=20=3D=20SCM_BOOL_F;=0A+=0A+=20=20s_sinfo=20=3D=20= scm_list_5(scm_ushort2num(sinfo.sinfo_stream),=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= scm_ushort2num(sinfo.sinfo_ssn),=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20scm_uint2num(ntohl(sinfo.sinfo_ppid)),=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= scm_uint2num(sinfo.sinfo_tsn),=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20scm_uint2num(sinfo.sinfo_cumtsn));=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0A+=20=20= return=20scm_list_4=20(SCM_MAKINUM=20(rv),=20address,=20SCM_MAKINUM=20= (flg),=20s_sinfo);=20=0A+}=0A+#undef=20FUNC_NAME=0A+=0A+#endif=0A+=0A=20= SCM_DEFINE=20(scm_sendto,=20"sendto",=204,=200,=201,=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20(SCM=20sock,=20SCM=20message,=20SCM=20fam,=20SCM=20= address,=20SCM=20args_and_flags),=0A=20=09=20=20=20=20"Transmit=20the=20= string=20@var{message}=20on=20the=20socket=20port\n"=0A@@=20-1257,7=20= +1328,70=20@@=0A=20=20=20return=20SCM_MAKINUM=20(rv);=0A=20}=0A=20#undef=20= FUNC_NAME=0A-=0C=0A+=0A+#ifdef=20HAVE_SCTP_SENDMSG=0A+=0CSCM_DEFINE=20= (scm_sctp_sendmsg,=20"sctp-sendmsg",=208,=200,=201,=0A+=20=20=20=20=20=20= =20=20=20=20=20=20(SCM=20sock,=20SCM=20message,=20SCM=20ppid,=20SCM=20= stream_no,=20SCM=20ttl,=20SCM=20context,=20SCM=20fam,=20SCM=20address,=20= SCM=20args_and_flags),=0A+=09=20=20=20=20"Transmit=20the=20string=20= @var{message}=20on=20the=20socket=20port\n"=0A+=09=20=20=20=20= "@var{sock}.=20=20The\n"=0A+=09=20=20=20=20"parameters=20@var{ppid},=20= @var{stream_no},=20@var{ttl}=20and=20=20@var{context}\n"=0A+=09=20=20=20=20= "are=20the=20corresponding=20SCTP=20parameters.=20The\n"=0A+=09=20=20=20=20= "destination=20address=20is=20specified=20using=20the=20@var{fam},\n"=0A= +=09=20=20=20=20"@var{address}=20and\n"=0A+=09=20=20=20=20= "@var{args_and_flags}=20arguments,=20in=20a=20similar=20way=20to=20= the\n"=0A+=09=20=20=20=20"@code{connect}=20procedure.=20=20= @var{args_and_flags}=20contains\n"=0A+=09=20=20=20=20"the=20usual=20= connection=20arguments=20optionally=20followed=20by\n"=0A+=09=20=20=20=20= "a=20flags=20argument,=20which=20is=20a=20value=20or\n"=0A+=09=20=20=20=20= "bitwise=20OR=20of=20MSG_UNORDERED,=20MSG_ABORT,=20MSG_EOF=20etc.\n\n"=0A= +=09=20=20=20=20"The=20value=20returned=20is=20the=20number=20of=20bytes=20= transmitted\n"=0A+=09=20=20=20=20"Note=20that=20the=20data=20is=20= written=20directly=20to=20the=20socket\n"=0A+=09=20=20=20=20"file=20= descriptor:\n"=0A+=09=20=20=20=20"any=20unflushed=20buffered=20port=20= data=20is=20ignored.")=0A+#define=20FUNC_NAME=20s_scm_sctp_sendmsg=0A+{=0A= +=20=20int=20rv;=0A+=20=20int=20fd;=0A+=20=20int=20flg;=0A+=20=20struct=20= sockaddr=20*soka;=0A+=20=20int=20size;=0A+=20=20uint16_t=20c_stream_no;=0A= +=20=20uint32_t=20c_ppid,=20c_ttl,=20c_context;=0A+=0A+=20=20sock=20=3D=20= SCM_COERCE_OUTPORT=20(sock);=0A+=20=20SCM_VALIDATE_FPORT=20(1,=20sock);=0A= +=20=20SCM_VALIDATE_STRING=20(2,=20message);=0A+=20=20c_ppid=20=20=20=20=20= =20=3D=20htonl(SCM_NUM2ULONG(3,=20ppid));=0A+=20=20c_stream_no=20=3D=20= SCM_NUM2USHORT(4,=20stream_no);=0A+=20=20c_ttl=20=20=20=20=20=20=20=3D=20= SCM_NUM2ULONG(5,=20ttl);=0A+=20=20c_context=20=20=20=3D=20= SCM_NUM2ULONG(6,=20context);=0A+=20=20SCM_VALIDATE_INUM=20(7,=20fam);=0A= +=20=20fd=20=3D=20SCM_FPORT_FDES=20(sock);=0A+=20=20soka=20=3D=20= scm_fill_sockaddr=20(SCM_INUM=20(fam),=20address,=20&args_and_flags,=20= 8,=20FUNC_NAME,=20&size);=0A+=20=20if=20(SCM_NULLP=20(args_and_flags))=0A= +=20=20=20=20flg=20=3D=200;=0A+=20=20else=20{=0A+=20=20=20=20=20=20= SCM_VALIDATE_CONS=20(9,args_and_flags);=0A+=20=20=20=20=20=20flg=20=3D=20= SCM_NUM2ULONG=20(9,=20SCM_CAR=20(args_and_flags));=0A+=20=20=20=20}=0A+=0A= +=20=20SCM_SYSCALL=20(rv=20=3D=20sctp_sendmsg=20(fd,=20=20= SCM_STRING_CHARS=20(message),=20SCM_STRING_LENGTH=20(message),=0A+=09=09=09= =20=20=20=20=20=20=20=20=20=20soka,=20size,=0A+=09=09=09=09=20=20c_ppid,=0A= +=09=09=09=09=20=20flg,=0A+=09=09=09=09=20=20c_stream_no,=0A+=09=09=09=09= =20=20c_ttl,=0A+=09=09=09=09=20=20c_context));=0A+=20=20if=20(rv=20=3D=3D=20= -1)=20{=0A+=20=20=20=20=20=20int=20save_errno=20=3D=20errno;=0A+=20=20=20= =20=20=20free=20(soka);=0A+=20=20=20=20=20=20errno=20=3D=20save_errno;=0A= +=20=20=20=20=20=20SCM_SYSERROR;=0A+=20=20}=0A+=20=20free=20(soka);=0A+=20= =20return=20SCM_MAKINUM=20(rv);=0A+}=0A+#undef=20FUNC_NAME=0A+=0C#endif=0A= =20=0A=20=0A=20void=0A@@=20-1311,10=20+1445,26=20@@=0A=20#ifdef=20= SOCK_DGRAM=0A=20=20=20scm_c_define=20("SOCK_DGRAM",=20SCM_MAKINUM=20= (SOCK_DGRAM));=0A=20#endif=0A+#ifdef=20SOCK_SEQPACKET=0A+=20=20= scm_c_define=20("SOCK_SEQPACKET",=20SCM_MAKINUM=20(SOCK_SEQPACKET));=0A= +#endif=0A=20#ifdef=20SOCK_RAW=0A=20=20=20scm_c_define=20("SOCK_RAW",=20= SCM_MAKINUM=20(SOCK_RAW));=0A=20#endif=0A=20=0A+=20=20/*=20protocol=20= numbers=20*/=0A+#ifdef=20IPPROTO_SCTP=0A+=20=20scm_c_define=20= ("IPPROTO_SCTP",=20SCM_MAKINUM=20(IPPROTO_SCTP));=0A+#endif=0A+=0A= +#ifdef=20IPPROTO_TCP=0A+=20=20scm_c_define=20("IPPROTO_TCP",=20= SCM_MAKINUM=20(IPPROTO_TCP));=0A+#endif=0A+=0A+#ifdef=20IPPROTO_UDP=0A+=20= =20scm_c_define=20("IPPROTO_UDP",=20SCM_MAKINUM=20(IPPROTO_UDP));=0A= +#endif=0A+=0A=20=20=20/*=20setsockopt=20level.=20=20*/=0A=20#ifdef=20= SOL_SOCKET=0A=20=20=20scm_c_define=20("SOL_SOCKET",=20SCM_MAKINUM=20= (SOL_SOCKET));=0A@@=20-1382,6=20+1532,30=20@@=0A=20#endif=0A=20#ifdef=20= MSG_DONTROUTE=0A=20=20=20scm_c_define=20("MSG_DONTROUTE",=20SCM_MAKINUM=20= (MSG_DONTROUTE));=0A+#endif=0A+#ifdef=20MSG_UNORDERED=0A+=20=20= scm_c_define=20("MSG_UNORDERED",=20SCM_MAKINUM=20(MSG_UNORDERED));=0A= +#endif=0A+#ifdef=20MSG_ADDR_OVER=0A+=20=20scm_c_define=20= ("MSG_ADDR_OVER",=20SCM_MAKINUM=20(MSG_ADDR_OVER));=0A+#endif=0A+#ifdef=20= MSG_ABORT=0A+=20=20scm_c_define("MSG_ABORT",=20SCM_MAKINUM=20= (MSG_ABORT));=0A+#endif=0A+#ifdef=20MSG_EOF=0A+=20=20scm_c_define=20= ("MSG_EOF",=20SCM_MAKINUM=20(MSG_EOF));=0A+#endif=0A+#ifdef=20MSG_EOR=0A= +=20=20scm_c_define=20("MSG_EOR",=20SCM_MAKINUM=20(MSG_EOR));=0A+#endif=0A= +#ifdef=20MSG_NOTIFICATION=0A+=20=20scm_c_define=20("MSG_NOTIFICATION",=20= SCM_MAKINUM=20(MSG_NOTIFICATION));=0A+#endif=0A+#ifdef=20MSG_PR_SCTP_TTL=0A= +=20=20scm_c_define=20("MSG_PR_SCTP_TTL",=20SCM_MAKINUM=20= (MSG_PR_SCTP_TTL));=0A+#endif=0A+#ifdef=20MSG_PR_SCTP_BUF=0A+=20=20= scm_c_define=20("MSG_PR_SCTP_BUF",=20SCM_MAKINUM=20(MSG_PR_SCTP_BUF));=0A= =20#endif=0A=20=0A=20=20=20scm_add_feature=20("socket");=0A= --Apple-Mail-5-38549950 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="socket.h.diff" Content-Disposition: attachment; filename=socket.h.diff --- guile-core-20040808/libguile/socket.h Sun Apr 22 18:05:21 2001 +++ guile-core-mod/libguile/socket.h Tue Aug 10 19:28:49 2004 @@ -74,7 +74,13 @@ extern SCM scm_recv (SCM sockfd, SCM buff_or_size, SCM flags); extern SCM scm_send (SCM sockfd, SCM message, SCM flags); extern SCM scm_recvfrom (SCM sockfd, SCM buff_or_size, SCM flags, SCM offset, SCM length); +#ifdef HAVE_SCTP_RECVMSG +extern SCM scm_sctp_recvmsg (SCM sockfd, SCM buff_or_size, SCM offset, SCM length); +#endif extern SCM scm_sendto (SCM sockfd, SCM message, SCM fam, SCM address, SCM args_and_flags); +#ifdef HAVE_SCTP_SENDMSG +extern SCM scm_sctp_sendmsg (SCM sockfd, SCM message, SCM ppid, SCM stream_no, SCM ttl, SCM context, SCM fam, SCM address, SCM args_and_flags); +#endif extern void scm_init_socket (void); #endif /* SCM_SOCKETH */ --Apple-Mail-5-38549950 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-5-38549950 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --Apple-Mail-5-38549950--