From: ludovic.courtes@laas.fr (Ludovic Courtès)
Cc: guile-user@gnu.org
Subject: Re: Socket API improvement, patch #6
Date: Thu, 27 Oct 2005 10:49:53 +0200 [thread overview]
Message-ID: <87fyqn1gzy.fsf@laas.fr> (raw)
In-Reply-To: <87zmovn4y5.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 27 Oct 2005 11:06:58 +1000")
Hi,
Kevin Ryde <user42@zip.com.au> 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
next prev parent reply other threads:[~2005-10-27 8:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-04 14:37 Exposing common type wrapping/unwrapping methods Ludovic Courtès
2005-05-24 17:53 ` Marius Vollmer
2005-06-14 16:38 ` Ludovic Courtès
2005-08-19 7:57 ` Ludovic Courtès
2005-08-20 6:01 ` Ken Raeburn
2005-08-20 12:40 ` Marius Vollmer
2005-08-20 13:53 ` Ken Raeburn
2005-09-04 22:17 ` Marius Vollmer
2005-09-07 4:17 ` Rob Browning
2005-09-04 22:09 ` Marius Vollmer
2005-09-07 9:49 ` Ludovic Courtès
2005-09-21 9:16 ` Ludovic Courtès
2005-09-22 0:14 ` Kevin Ryde
2005-09-22 13:46 ` Ludovic Courtès
2005-09-22 21:30 ` Kevin Ryde
2005-09-26 9:37 ` Ludovic Courtès
2005-09-28 21:30 ` Kevin Ryde
2005-10-04 14:08 ` Socket API improvement, patch #6 Ludovic Courtès
2005-10-17 10:55 ` Ludovic Courtès
2005-10-17 21:43 ` Kevin Ryde
2005-10-18 7:45 ` Ludovic Courtès
2005-10-18 20:17 ` Marius Vollmer
2005-10-24 11:35 ` Ludovic Courtès
2005-10-24 21:42 ` Kevin Ryde
2005-10-25 21:24 ` Marius Vollmer
2005-10-27 1:06 ` Kevin Ryde
2005-10-27 8:49 ` Ludovic Courtès [this message]
2005-10-28 23:00 ` Kevin Ryde
2005-10-29 17:45 ` Marius Vollmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fyqn1gzy.fsf@laas.fr \
--to=ludovic.courtes@laas.fr \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).