guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initial SCTP support for the upcoming 1.6.5 release


From: Michael Tuexen
Subject: Re: Initial SCTP support for the upcoming 1.6.5 release
Date: Tue, 24 Aug 2004 14:46:14 +0200

Dear all,

with the hints of Kevin I got my stuff working.

I need besides the static functions from socket.c the
SCM_SYSCALL stuff from libguile/_scm.h. This is file is
not installed. So is there a chance to move the SCM_SYSCALL
stuff from _scm.h to __scm.h? If not, I have to duplicate
the code, which is not a problem...

I have another question: How can I make the documentation included
in the SCM_DEFINE makro available from scheme. My C code contains

SCM_DEFINE (net_sctp_sendmsg, "sctp-sendmsg", 8, 0, 1,
(SCM sock, SCM message, SCM ppid, SCM stream_no, SCM ttl, SCM context, SCM fam, SCM address, SCM args_and_flags),
            "Transmit the string @var{message} on the socket port\n"
            "@var{sock}.  The\n"
"parameters @var{ppid}, @var{stream_no}, @var{ttl} and @var{context}\n"
            "are the corresponding SCTP parameters. The\n"
            "destination address is specified using the @var{fam},\n"
            "@var{address} and\n"
            "@var{args_and_flags} arguments, in a similar way to the\n"
            "@code{connect} procedure.  @var{args_and_flags} contains\n"
            "the usual connection arguments optionally followed by\n"
            "a flags argument, which is a value or\n"
            "bitwise OR of MSG_UNORDERED, MSG_ABORT, MSG_EOF etc.\n\n"
            "The value returned is the number of bytes transmitted\n"
            "Note that the data is written directly to the socket\n"
            "file descriptor:\n"
            "any unflushed buffered port data is ignored.")
#define FUNC_NAME s_net_sctp_sendmsg
{
  /* missing the code */
  return SCM_MAKINUM (rv);
}
#undef FUNC_NAME


but on the scheme side it is not available like the documentation
for the socket() call, which is defined in libguile/socket.c:

guile> (use-modules (net sctp))
guile> (help socket)
`socket' is a primitive procedure in the (guile) module.

 - Scheme Procedure: socket family style proto
     Return a new socket port of the type specified by FAMILY, STYLE
     and PROTO.  All three parameters are integers.  Supported values
     for FAMILY are `AF_UNIX', `AF_INET' and `AF_INET6'.  Typical
     values for STYLE are `SOCK_STREAM', `SOCK_DGRAM' and `SOCK_RAW'.

     PROTO can be obtained from a protocol name using `getprotobyname'.
     A value of zero specifies the default protocol, which is usually
     right.

     A single socket port cannot by used for communication until it has
     been connected to another socket.


guile> (help sctp-sendmsg)
No documentation found for:
(net sctp): sctp-sendmsg

Thank you very much for your help.

Best regards
Michael

On Aug 24, 2004, at 1:27 PM, Michael Tuexen wrote:

Kevin,

see my comments below.

Best regards
Michael

On Aug 24, 2004, at 2:57 AM, Kevin Ryde wrote:

Michael Tuexen <address@hidden> writes:

Since the set/getsockopt function does not reference any specific
structure
it would be a possibility of have it provided as generic as it is in C
and
I would write some scheme functions to transfer the SCTP specific data
into the generic one.

It's probably better to make replacement functions that do their
specifics then call the core.

(If there were many semi-independent modules going to do that then
some sort of hook arrangement would be better, but a replacement will
work initially at least.)
So I just define my own setsockopt and it will 'overwrite' the existing
one. That'll work. I was not sure if I can just define another function
with the same name and that will overwrite the existing one.

I have not found an example for C based modules for guile yet.

load-extension I think, per "A Sample Guile Extension" and "Putting
Extensions into Modules" in the manual.  More indexing in the manual
might help when looking for such stuff.
I was looking at

http://www.gnu.org/software/guile/docs/guile-ref/Dynamic- Libraries.html#Dynamic%20Libraries

under the title "Modules"
not at "A Whirlwind Tour" where I find under
http://www.gnu.org/software/guile/docs/guile-ref/A-Sample-Guile- Extension.html#A%20Sample%20Guile%20Extension
the Extension stuff... Thank you very much for the hint.


Everything distributed with guile is scheme based, I think.

Cf srfi/srfi-13 and 14, and guile-readline/ice-9/readline.scm.
Ahh. I have not found them. I was looking at ice-9...

Thank you very much for your help.




_______________________________________________
Guile-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/guile-devel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]