From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Socket API improvement, patch #6 Date: Thu, 27 Oct 2005 10:49:53 +0200 Organization: LAAS-CNRS Message-ID: <87fyqn1gzy.fsf@laas.fr> References: <87oecutxox.fsf@laas.fr> <87vf58cxxq.fsf@zagadka.de> <87k6kwopv5.fsf@laas.fr> <87fysk7ady.fsf@zagadka.de> <87mzmpmcm2.fsf@laas.fr> <87aci6u6f4.fsf@laas.fr> <87psr22c2p.fsf@zip.com.au> <87irwtqkop.fsf@laas.fr> <87slvog9sd.fsf@zip.com.au> <87wtkt9xyq.fsf_-_@laas.fr> <87hdbg4dl7.fsf@laas.fr> <87br1nakge.fsf@zip.com.au> <87hdbfnu9n.fsf@laas.fr> <87d5m2twaf.fsf@uni-dortmund.de> <878xwjb123.fsf@laas.fr> <874q76h9rh.fsf@zip.com.au> <87hdb5qogp.fsf@zagadka.de> <87zmovn4y5.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130409484 30036 80.91.229.2 (27 Oct 2005 10:38:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 27 Oct 2005 10:38:04 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Oct 27 12:38:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EV583-00009B-O2 for guile-user@m.gmane.org; Thu, 27 Oct 2005 12:37:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EV55P-00058U-QR for guile-user@m.gmane.org; Thu, 27 Oct 2005 06:34:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EV4HB-0007Dv-PO for guile-user@gnu.org; Thu, 27 Oct 2005 05:42:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EV4H6-0007By-RB for guile-user@gnu.org; Thu, 27 Oct 2005 05:42:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EV3Wn-0002tf-Vb for guile-user@gnu.org; Thu, 27 Oct 2005 04:54:33 -0400 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EV3Wo-0002gs-25 for guile-user@gnu.org; Thu, 27 Oct 2005 04:54:30 -0400 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id j9R8sEhN005453; Thu, 27 Oct 2005 10:54:19 +0200 (CEST) Original-To: Kevin Ryde X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 6 Brumaire an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Kevin Ryde , guile-user@gnu.org In-Reply-To: <87zmovn4y5.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 27 Oct 2005 11:06:58 +1000") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0.496 () MAILTO_TO_SPAM_ADDR X-Scanned-By: MIMEDefang at CNRS-LAAS X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:4899 Archived-At: Hi, Kevin Ryde writes: > Ok, we got there eventually. I checked it in, and I updated the docs > (have a read to see it they look right). Great, thanks! The doc looks good to me. I'd just suggest the following patch. It documents the wrapping/unwrapping C functions (since that was my original goal). Thanks, Ludovic. --- orig/doc/ref/posix.texi +++ mod/doc/ref/posix.texi @@ -2449,18 +2449,20 @@ @subsubsection Network Socket Address @cindex socket @cindex network socket +@cindex socket address -A socket address object identifies a socket endpoint for -communication. In the case of @code{AF_INET} for instance, the host -address is only the machine (or interface on the machine), a port -number is also needed to specify a particular open socket in a running +A @dfn{socket address} object identifies a socket endpoint for +communication. In the case of @code{AF_INET} for instance, the socket +address object comprises the machine (or interface on the machine) and +a port number needed to specify a particular open socket in a running client or server process. A socket address object can be created with, -@defun {Scheme Procedure} make-socket-address AF_INET ipv4addr port -@defunx {Scheme Procedure} make-socket-address AF_INET6 ipv6addr port [flowinfo [scopeid]] -@defunx {Scheme Procedure} make-socket-address AF_UNIX path +@deffn {Scheme Procedure} make-socket-address AF_INET ipv4addr port +@deffnx {Scheme Procedure} make-socket-address AF_INET6 ipv6addr port [flowinfo [scopeid]] +@deffnx {Scheme Procedure} make-socket-address AF_UNIX path +@deffnx {C Function} scm_make_socket_address family address args Return a new socket address object. The first argument is the address family, one of the @code{AF} constants, then the arguments vary according to the family. @@ -2473,7 +2475,7 @@ arguments may be given (both integers, default 0). For @code{AF_UNIX} the argument is a filename (a string). -@end defun +@end deffn @noindent The following functions access the fields of a socket address object, @@ -2508,6 +2510,34 @@ scope ID value. @end deffn +Guile also defines C functions to manipulate socket address objects +and to convert them from/to their C representation (a @code{struct +sockaddr} object) to/from their Scheme representation. + +@deftypefn {C Function} {struct sockaddr *}scm_c_make_socket_address (SCM family, SCM address, SCM args, size_t *address_size) +Return a newly-allocated @code{sockaddr} structure that reflects +@var{address}, an address of family @var{family}, with the +family-specific parameters @var{args} (see the description of +@var{make-socket-address} for details). On success, a non-@code{NULL} +pointer is returned and @var{address_size} is updated to the actual +size (in bytes) of the returned address. The returned structure must +eventually be freed using @code{free ()}. +@end deftypefn + +@deftypefn {C Function} SCM scm_from_sockaddr (const struct sockaddr *address, unsigned address_size) +Return the Scheme object representing @var{address}, a C socket +address object of size @var{address_size} bytes. +@end deftypefn + +@deftypefn {C Function} {struct sockaddr *}scm_to_sockaddr (SCM address, size_t *address_size) +Return a newly-allocated @code{sockaddr} structure that reflects +@var{address}, an address object returned by either +@code{scm_from_sockaddr ()} or @code{scm_make_socket_address ()}, into +its C representation. On success, a non-@code{NULL} pointer is +returned and @var{address_size} is updated to the actual size (in +bytes) of the returned address. The returned value must eventually be +freed using @code{free ()}. +@end deftypefn @node Network Sockets and Communication @subsubsection Network Sockets and Communication _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user