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: Re: Initial SCTP support for the upcoming 1.6.5 release Date: Fri, 20 Aug 2004 20:18:33 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <58846D32-F2D5-11D8-9904-000D932C78D8@lurchi.franken.de> References: <28C61BE4-EB92-11D8-9129-000D932C78D8@lurchi.franken.de> <02FA4EE0-EFA6-11D8-B63D-000D932C78D8@lurchi.franken.de> <87ekm67wis.fsf@trouble.defaultvalue.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1093025961 5613 80.91.224.253 (20 Aug 2004 18:19:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Aug 2004 18:19:21 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Aug 20 20:19:09 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 1ByDyn-0007UN-00 for ; Fri, 20 Aug 2004 20:19:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ByE36-0001Wa-UE for guile-devel@m.gmane.org; Fri, 20 Aug 2004 14:23:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1ByE33-0001W7-Tc for guile-devel@gnu.org; Fri, 20 Aug 2004 14:23:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1ByE31-0001Vr-PN for guile-devel@gnu.org; Fri, 20 Aug 2004 14:23:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ByE30-0001Ve-CB for guile-devel@gnu.org; Fri, 20 Aug 2004 14:23:30 -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 1ByDyQ-00067T-Kv for guile-devel@gnu.org; Fri, 20 Aug 2004 14:18:47 -0400 Original-Received: from [192.168.1.219] (pD9FF1AA8.dip.t-dialin.net [217.255.26.168]) by ilsa.franken.de (Postfix) with ESMTP id EBE6E245C7; Fri, 20 Aug 2004 20:18:43 +0200 (CEST) (KNF account authenticated via SMTP-AUTH) In-Reply-To: <87ekm67wis.fsf@trouble.defaultvalue.org> Original-To: Rob Browning X-Mailer: Apple Mail (2.619) 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:3995 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3995 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 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 > _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel