[Top][All Lists]
[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: |
Fri, 20 Aug 2004 20:18:33 +0200 |
Hi Rob,
I got the external library from Marius compiled and
wrote sctp.scm such that the net_sctp_init can
be called and the constants can be accessed.
But I have two functions defined, one of them is defined
by
SCM_DEFINE (net_sctp_recvmsg, "sctp-recvmsg!", 2, 2, 0,
(SCM sock, SCM str, SCM start, SCM end),
"Return data from the socket port @var{sock} and also\n"
"information about where the data was received from.\n"
"@var{sock} must already be bound to the address from which\n"
"data is to be received. @code{str}, is a string into which the\n"
"data will be written. The size of @var{str} limits the amount\n"
"of data which can be received: in the case of packet protocols,\n"
"if a packet larger than this limit is encountered then some\n"
"data will be irrevocably lost.\n\n"
"The value returned is a list containing:\n"
"- the number of bytes read from the socket\n"
"- an address object in the same form as returned by
@code{accept}\n"
"- the flags returned by the sctp_recvmsg call\n"
"- a list containing the SID, SSN, PPID, TSN and CUM_TSN\n"
"The @var{start} and @var{end} arguments specify a substring of\n"
"@var{str} to which the data should be written.\n\n"
"Note that the data is read directly from the socket file\n"
"descriptor: any unread buffered port data is ignored.")
#define FUNC_NAME s_net_sctp_recvmsg
{
int rv;
....
return scm_list_4 (SCM_MAKINUM (rv), address, SCM_MAKINUM (flg),
s_sinfo);
}
#undef FUNC_NAME
How can I access this function from scheme?
Another question:
I need
ipv6_net_to_num
scm_addr_vector
scm_fill_sockaddr
which are declared static in socket.c. Can they made available and not
be declared static? If not, I need to define them again, which is not
very elegant.
And the last question:
Could the setsockopt and getsockopt functions be extended such that
they support an arbitrary length opt_value? This is the way they are
defined in C. What should the scheme type for the opt_value? A string?
Thank you very much for your help.
Best regards
Michael
On Aug 16, 2004, at 8:44 PM, Rob Browning wrote:
Michael Tuexen <address@hidden> writes:
I'm trying to build the SCTP support as a loadable module.
Is there any documentation available (or an example) where
I can figure out how I can solve the questions described
below.
I looked in the guile sources, but only found modules defined
in scheme...
In general, C-only modules are deprecated. The recommendation is that
you create a small .scm file for your module, and then have that load
your shared library and export your symbols, i.e.:
(define-module (pcre))
;; exports at end of file.
(let ((lib "libguile-pcre-v-1")
(init-func "libguile_pcre_init"))
(if (string=? (substring (version) 0 3) "1.4")
(dynamic-call init-func (dynamic-link lib))
(load-extension lib init-func)))
;; make any scheme side defines you that want to here.
;; export things here (though you could also do this above, or in
;; the define-module statement)
;; these exports will often be symbols that were defined during your
;; _init function above
(export PCRE_MAJOR)
(export PCRE_MINOR)
...
Now, presuming that your .scm file is in the %load-path (via
GUILE_LOAD_PATH, or whatever), and your shared library is in the
LD_LIBRARY_PATH (or default ld.so locations), then (use-modules
(pcre)) should work just fine.
--
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377
8C7E 73A4
- Re: Initial SCTP support for the upcoming 1.6.5 release, (continued)
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/24
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/14
- Re: Initial SCTP support for the upcoming 1.6.5 release, Kevin Ryde, 2004/08/15
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/16
- Re: Initial SCTP support for the upcoming 1.6.5 release, Kevin Ryde, 2004/08/17
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/19
- Re: Initial SCTP support for the upcoming 1.6.5 release, Kevin Ryde, 2004/08/19
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/20
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/16
- Re: Initial SCTP support for the upcoming 1.6.5 release, Rob Browning, 2004/08/16
- Re: Initial SCTP support for the upcoming 1.6.5 release,
Michael Tuexen <=
- Re: Initial SCTP support for the upcoming 1.6.5 release, Kevin Ryde, 2004/08/22
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/23
- Re: Initial SCTP support for the upcoming 1.6.5 release, Kevin Ryde, 2004/08/23
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/24
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/24
- Re: Initial SCTP support for the upcoming 1.6.5 release, Marius Vollmer, 2004/08/24
- Re: Initial SCTP support for the upcoming 1.6.5 release, Michael Tuexen, 2004/08/24