1 /* Copyright (C) 1996,1997 Free Software Foundation, Inc.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this software; see the file COPYING. If not, write to
15 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17 * As a special exception, the Free Software Foundation gives permission
18 * for additional uses of the text contained in its release of GUILE.
20 * The exception is that, if you link the GUILE library with other files
21 * to produce an executable, this does not by itself cause the
22 * resulting executable to be covered by the GNU General Public License.
23 * Your use of that executable is in no way restricted on account of
24 * linking the GUILE library code into it.
26 * This exception does not however invalidate any other reasons why
27 * the executable file might be covered by the GNU General Public License.
29 * This exception applies only to the code released by the
30 * Free Software Foundation under the name GUILE. If you copy
31 * code from other Free Software Foundation releases into a copy of
32 * GUILE, as the General Public License permits, the exception does
33 * not apply to the code that you add in this way. To avoid misleading
34 * anyone as to the status of such modified files, you must delete
35 * this exception notice from them.
37 * If you write modifications of your own for GUILE, it is your choice
38 * whether to permit this exception to apply to your modifications.
39 * If you do not wish that, delete this exception notice.
58 #include <sys/types.h>
59 #include <sys/socket.h>
61 #include <netinet/in.h>
63 #include <arpa/inet.h>
67 static SCM scm_sock_fd_to_port
SCM_P ((int fd
, char *proc
));
70 scm_sock_fd_to_port (fd
, proc
)
79 f
= fdopen (fd
, "r+");
82 SCM_SYSCALL (close (fd
));
87 struct scm_port_table
*pt
= scm_add_to_port_table (result
);
89 SCM_SETPTAB_ENTRY (result
, pt
);
91 SCM_SETCAR (result
, scm_tc16_fport
| scm_mode_bits ("r+0"));
92 SCM_SETSTREAM (result
, (SCM
)f
);
97 SCM_PROC (s_socket
, "socket", 3, 0, 0, scm_socket
);
100 scm_socket (family
, style
, proto
)
108 SCM_ASSERT (SCM_INUMP (family
), family
, SCM_ARG1
, s_socket
);
109 SCM_ASSERT (SCM_INUMP (style
), style
, SCM_ARG2
, s_socket
);
110 SCM_ASSERT (SCM_INUMP (proto
), proto
, SCM_ARG3
, s_socket
);
112 fd
= socket (SCM_INUM (family
), SCM_INUM (style
), SCM_INUM (proto
));
113 result
= scm_sock_fd_to_port (fd
, s_socket
);
120 SCM_PROC (s_socketpair
, "socketpair", 3, 0, 0, scm_socketpair
);
123 scm_socketpair (family
, style
, proto
)
133 SCM_ASSERT (SCM_INUMP (family
), family
, SCM_ARG1
, s_socketpair
);
134 SCM_ASSERT (SCM_INUMP (style
), style
, SCM_ARG2
, s_socketpair
);
135 SCM_ASSERT (SCM_INUMP (proto
), proto
, SCM_ARG3
, s_socketpair
);
137 fam
= SCM_INUM (family
);
140 if (socketpair (fam
, SCM_INUM (style
), SCM_INUM (proto
), fd
) == -1)
141 scm_syserror (s_socketpair
);
143 a
= scm_sock_fd_to_port (fd
[0], s_socketpair
);
144 b
= scm_sock_fd_to_port (fd
[1], s_socketpair
);
146 return scm_cons (a
, b
);
150 SCM_PROC (s_getsockopt
, "getsockopt", 3, 0, 0, scm_getsockopt
);
153 scm_getsockopt (sock
, level
, optname
)
160 #ifdef HAVE_STRUCT_LINGER
161 char optval
[sizeof (struct linger
)];
163 char optval
[sizeof (scm_sizet
)];
168 #ifdef HAVE_STRUCT_LINGER
169 optlen
= (int) sizeof (struct linger
);
171 optlen
= (int) sizeof (scm_sizet
);
174 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
,
176 SCM_ASSERT (SCM_INUMP (level
), level
, SCM_ARG2
, s_getsockopt
);
177 SCM_ASSERT (SCM_INUMP (optname
), optname
, SCM_ARG3
, s_getsockopt
);
179 fd
= fileno ((FILE *)SCM_STREAM (sock
));
180 ilevel
= SCM_INUM (level
);
181 ioptname
= SCM_INUM (optname
);
182 if (getsockopt (fd
, ilevel
, ioptname
, (void *) optval
, &optlen
) == -1)
183 scm_syserror (s_getsockopt
);
186 if (ilevel
== SOL_SOCKET
&& ioptname
== SO_LINGER
)
188 #ifdef HAVE_STRUCT_LINGER
189 struct linger
*ling
= (struct linger
*) optval
;
190 return scm_cons (SCM_MAKINUM (ling
->l_onoff
),
191 SCM_MAKINUM (ling
->l_linger
));
193 scm_sizet
*ling
= (scm_sizet
*) optval
;
194 return scm_cons (SCM_MAKINUM (*ling
),
200 if (ilevel
== SOL_SOCKET
&& ioptname
== SO_SNDBUF
)
202 scm_sizet
*bufsize
= (scm_sizet
*) optval
;
203 return SCM_MAKINUM (*bufsize
);
207 if (ilevel
== SOL_SOCKET
&& ioptname
== SO_RCVBUF
)
209 scm_sizet
*bufsize
= (scm_sizet
*) optval
;
210 return SCM_MAKINUM (*bufsize
);
213 return SCM_MAKINUM (*(int *) optval
);
216 SCM_PROC (s_setsockopt
, "setsockopt", 4, 0, 0, scm_setsockopt
);
219 scm_setsockopt (sock
, level
, optname
, value
)
227 #ifdef HAVE_STRUCT_LINGER
228 char optval
[sizeof (struct linger
)]; /* Biggest option :-( */
230 char optval
[sizeof (scm_sizet
)];
232 int ilevel
, ioptname
;
233 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
,
235 SCM_ASSERT (SCM_INUMP (level
), level
, SCM_ARG2
, s_setsockopt
);
236 SCM_ASSERT (SCM_INUMP (optname
), optname
, SCM_ARG3
, s_setsockopt
);
237 fd
= fileno ((FILE *)SCM_STREAM (sock
));
238 ilevel
= SCM_INUM (level
);
239 ioptname
= SCM_INUM (optname
);
242 else if (ilevel
== SOL_SOCKET
&& ioptname
== SO_LINGER
)
244 #ifdef HAVE_STRUCT_LINGER
246 SCM_ASSERT (SCM_NIMP (value
) && SCM_CONSP (value
)
247 && SCM_INUMP (SCM_CAR (value
))
248 && SCM_INUMP (SCM_CDR (value
)),
249 value
, SCM_ARG4
, s_setsockopt
);
250 ling
.l_onoff
= SCM_INUM (SCM_CAR (value
));
251 ling
.l_linger
= SCM_INUM (SCM_CDR (value
));
252 optlen
= (int) sizeof (struct linger
);
253 memcpy (optval
, (void *) &ling
, optlen
);
256 SCM_ASSERT (SCM_NIMP (value
) && SCM_CONSP (value
)
257 && SCM_INUMP (SCM_CAR (value
))
258 && SCM_INUMP (SCM_CDR (value
)),
259 value
, SCM_ARG4
, s_setsockopt
);
260 ling
= SCM_INUM (SCM_CAR (value
));
261 optlen
= (int) sizeof (scm_sizet
);
262 (*(scm_sizet
*) optval
) = (scm_sizet
) SCM_INUM (value
);
267 else if (ilevel
== SOL_SOCKET
&& ioptname
== SO_SNDBUF
)
269 SCM_ASSERT (SCM_INUMP (value
), value
, SCM_ARG4
, s_setsockopt
);
270 optlen
= (int) sizeof (scm_sizet
);
271 (*(scm_sizet
*) optval
) = (scm_sizet
) SCM_INUM (value
);
275 else if (ilevel
== SOL_SOCKET
&& ioptname
== SO_RCVBUF
)
277 SCM_ASSERT (SCM_INUMP (value
), value
, SCM_ARG4
, s_setsockopt
);
278 optlen
= (int) sizeof (scm_sizet
);
279 (*(scm_sizet
*) optval
) = (scm_sizet
) SCM_INUM (value
);
284 /* Most options just take an int. */
285 SCM_ASSERT (SCM_INUMP (value
), value
, SCM_ARG4
, s_setsockopt
);
286 optlen
= (int) sizeof (int);
287 (*(int *) optval
) = (int) SCM_INUM (value
);
289 if (setsockopt (fd
, ilevel
, ioptname
, (void *) optval
, optlen
) == -1)
290 scm_syserror (s_setsockopt
);
291 return SCM_UNSPECIFIED
;
294 SCM_PROC (s_shutdown
, "shutdown", 2, 0, 0, scm_shutdown
);
297 scm_shutdown (sock
, how
)
302 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
,
304 SCM_ASSERT (SCM_INUMP (how
) && 0 <= SCM_INUM (how
) && 2 >= SCM_INUM (how
),
305 how
, SCM_ARG2
, s_shutdown
);
306 fd
= fileno ((FILE *)SCM_STREAM (sock
));
307 if (shutdown (fd
, SCM_INUM (how
)) == -1)
308 scm_syserror (s_shutdown
);
309 return SCM_UNSPECIFIED
;
312 /* convert fam/address/args into a sockaddr of the appropriate type.
313 args is modified by removing the arguments actually used.
314 which_arg and proc are used when reporting errors:
315 which_arg is the position of address in the original argument list.
316 proc is the name of the original procedure.
317 size returns the size of the structure allocated. */
320 static struct sockaddr
* scm_fill_sockaddr
SCM_P ((int fam
, SCM address
, SCM
*args
, int which_arg
, char *proc
, scm_sizet
*size
));
322 static struct sockaddr
*
323 scm_fill_sockaddr (fam
, address
, args
, which_arg
, proc
, size
)
336 struct sockaddr_in
*soka
;
338 soka
= (struct sockaddr_in
*)
339 scm_must_malloc (sizeof (struct sockaddr_in
), proc
);
340 soka
->sin_family
= AF_INET
;
341 soka
->sin_addr
.s_addr
=
342 htonl (scm_num2ulong (address
, (char *) which_arg
, proc
));
343 SCM_ASSERT (SCM_NIMP (*args
) && SCM_CONSP (*args
), *args
,
344 which_arg
+ 1, proc
);
345 isport
= SCM_CAR (*args
);
346 *args
= SCM_CDR (*args
);
347 SCM_ASSERT (SCM_INUMP (isport
), isport
, which_arg
+ 1, proc
);
348 soka
->sin_port
= htons (SCM_INUM (isport
));
349 *size
= sizeof (struct sockaddr_in
);
350 return (struct sockaddr
*) soka
;
354 struct sockaddr_un
*soka
;
356 soka
= (struct sockaddr_un
*)
357 scm_must_malloc (sizeof (struct sockaddr_un
), proc
);
358 soka
->sun_family
= AF_UNIX
;
359 SCM_ASSERT (SCM_NIMP (address
) && SCM_STRINGP (address
), address
,
361 memcpy (soka
->sun_path
, SCM_CHARS (address
), 1 + SCM_LENGTH (address
));
362 *size
= sizeof (struct sockaddr_un
);
363 return (struct sockaddr
*) soka
;
366 scm_out_of_range (proc
, SCM_MAKINUM (fam
));
370 SCM_PROC (s_connect
, "connect", 3, 0, 1, scm_connect
);
373 scm_connect (sock
, fam
, address
, args
)
381 struct sockaddr
*soka
;
384 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_connect
);
385 SCM_ASSERT (SCM_INUMP (fam
), fam
, SCM_ARG2
, s_connect
);
386 fd
= fileno ((FILE *)SCM_STREAM (sock
));
388 soka
= scm_fill_sockaddr (SCM_INUM (fam
), address
, &args
, 3, s_connect
, &size
);
389 if (connect (fd
, soka
, size
) == -1)
390 scm_syserror (s_connect
);
391 scm_must_free ((char *) soka
);
393 return SCM_UNSPECIFIED
;
396 SCM_PROC (s_bind
, "bind", 3, 0, 1, scm_bind
);
399 scm_bind (sock
, fam
, address
, args
)
406 struct sockaddr
*soka
;
410 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_bind
);
411 SCM_ASSERT (SCM_INUMP (fam
), fam
, SCM_ARG2
, s_bind
);
412 soka
= scm_fill_sockaddr (SCM_INUM (fam
), address
, &args
, 3, s_bind
, &size
);
413 fd
= fileno ((FILE *)SCM_STREAM (sock
));
414 rv
= bind (fd
, soka
, size
);
416 scm_syserror (s_bind
);
417 return SCM_UNSPECIFIED
;
420 SCM_PROC (s_listen
, "listen", 2, 0, 0, scm_listen
);
423 scm_listen (sock
, backlog
)
428 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_listen
);
429 SCM_ASSERT (SCM_INUMP (backlog
), backlog
, SCM_ARG2
, s_listen
);
430 fd
= fileno ((FILE *)SCM_STREAM (sock
));
431 if (listen (fd
, SCM_INUM (backlog
)) == -1)
432 scm_syserror (s_listen
);
433 return SCM_UNSPECIFIED
;
436 /* Put the components of a sockaddr into a new SCM vector. */
438 static SCM scm_addr_vector
SCM_P ((struct sockaddr
*address
, char *proc
));
441 scm_addr_vector (address
, proc
)
442 struct sockaddr
*address
;
445 short int fam
= address
->sa_family
;
450 struct sockaddr_un
*nad
= (struct sockaddr_un
*) address
;
451 result
= scm_make_vector (SCM_MAKINUM (2), SCM_UNSPECIFIED
, SCM_BOOL_F
);
452 ve
= SCM_VELTS (result
);
453 ve
[0] = scm_ulong2num ((unsigned long) fam
);
454 ve
[1] = scm_makfromstr (nad
->sun_path
,
455 (scm_sizet
) strlen (nad
->sun_path
), 0);
457 else if (fam
== AF_INET
)
459 struct sockaddr_in
*nad
= (struct sockaddr_in
*) address
;
460 result
= scm_make_vector (SCM_MAKINUM (3), SCM_UNSPECIFIED
, SCM_BOOL_F
);
461 ve
= SCM_VELTS (result
);
462 ve
[0] = scm_ulong2num ((unsigned long) fam
);
463 ve
[1] = scm_ulong2num (ntohl (nad
->sin_addr
.s_addr
));
464 ve
[2] = scm_ulong2num ((unsigned long) ntohs (nad
->sin_port
));
467 scm_misc_error (proc
, "Unrecognised address family: %s",
468 scm_listify (SCM_MAKINUM (fam
), SCM_UNSPECIFIED
));
473 /* Allocate a buffer large enough to hold any sockaddr type. */
474 static char *scm_addr_buffer
;
475 static int scm_addr_buffer_size
;
477 static void scm_init_addr_buffer
SCM_P ((void));
480 scm_init_addr_buffer ()
482 scm_addr_buffer_size
= (int) sizeof (struct sockaddr_un
);
483 if (sizeof (struct sockaddr_in
) > scm_addr_buffer_size
)
484 scm_addr_buffer_size
= (int) sizeof (struct sockaddr_in
);
485 scm_addr_buffer
= scm_must_malloc (scm_addr_buffer_size
, "address buffer");
488 SCM_PROC (s_accept
, "accept", 1, 0, 0, scm_accept
);
500 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_accept
);
501 fd
= fileno ((FILE *)SCM_STREAM (sock
));
503 tmp_size
= scm_addr_buffer_size
;
504 newfd
= accept (fd
, (struct sockaddr
*) scm_addr_buffer
, &tmp_size
);
505 newsock
= scm_sock_fd_to_port (newfd
, s_accept
);
507 address
= scm_addr_vector ((struct sockaddr
*) scm_addr_buffer
, s_accept
);
509 address
= SCM_BOOL_F
;
512 return scm_cons (newsock
, address
);
515 SCM_PROC (s_getsockname
, "getsockname", 1, 0, 0, scm_getsockname
);
518 scm_getsockname (sock
)
524 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_getsockname
);
525 fd
= fileno ((FILE *)SCM_STREAM (sock
));
527 tmp_size
= scm_addr_buffer_size
;
528 if (getsockname (fd
, (struct sockaddr
*) scm_addr_buffer
, &tmp_size
) == -1)
529 scm_syserror (s_getsockname
);
531 result
= scm_addr_vector ((struct sockaddr
*) scm_addr_buffer
, s_getsockname
);
538 SCM_PROC (s_getpeername
, "getpeername", 1, 0, 0, scm_getpeername
);
541 scm_getpeername (sock
)
547 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_getpeername
);
548 fd
= fileno ((FILE *)SCM_STREAM (sock
));
550 tmp_size
= scm_addr_buffer_size
;
551 if (getpeername (fd
, (struct sockaddr
*) scm_addr_buffer
, &tmp_size
) == -1)
552 scm_syserror (s_getpeername
);
554 result
= scm_addr_vector ((struct sockaddr
*) scm_addr_buffer
, s_getpeername
);
561 SCM_PROC (s_recv
, "recv!", 2, 1, 0, scm_recv
);
564 scm_recv (sock
, buf
, flags
)
573 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_recv
);
574 SCM_ASSERT (SCM_NIMP (buf
) && SCM_STRINGP (buf
), buf
, SCM_ARG2
, s_recv
);
575 fd
= fileno ((FILE *)SCM_STREAM (sock
));
577 if (SCM_UNBNDP (flags
))
580 flg
= scm_num2ulong (flags
, (char *) SCM_ARG3
, s_recv
);
582 SCM_SYSCALL (rv
= recv (fd
, SCM_CHARS (buf
), SCM_LENGTH (buf
), flg
));
584 scm_syserror (s_recv
);
586 return SCM_MAKINUM (rv
);
589 SCM_PROC (s_send
, "send", 2, 1, 0, scm_send
);
592 scm_send (sock
, message
, flags
)
601 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_send
);
602 SCM_ASSERT (SCM_NIMP (message
) && SCM_STRINGP (message
), message
, SCM_ARG2
, s_send
);
603 fd
= fileno ((FILE *)SCM_STREAM (sock
));
605 if (SCM_UNBNDP (flags
))
608 flg
= scm_num2ulong (flags
, (char *) SCM_ARG3
, s_send
);
610 SCM_SYSCALL (rv
= send (fd
, SCM_CHARS (message
), SCM_LENGTH (message
), flg
));
612 scm_syserror (s_send
);
613 return SCM_MAKINUM (rv
);
616 SCM_PROC (s_recvfrom
, "recvfrom!", 2, 3, 0, scm_recvfrom
);
619 scm_recvfrom (sock
, buf
, flags
, start
, end
)
634 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
,
636 SCM_ASSERT (SCM_NIMP (buf
) && SCM_STRINGP (buf
), buf
, SCM_ARG2
, s_recvfrom
);
637 cend
= SCM_LENGTH (buf
);
639 if (SCM_UNBNDP (flags
))
643 flg
= scm_num2ulong (flags
, (char *) SCM_ARG3
, s_recvfrom
);
645 if (!SCM_UNBNDP (start
))
647 offset
= (int) scm_num2long (start
,
648 (char *) SCM_ARG4
, s_recvfrom
);
650 if (offset
< 0 || offset
>= cend
)
651 scm_out_of_range (s_recvfrom
, start
);
653 if (!SCM_UNBNDP (end
))
655 int tend
= (int) scm_num2long (end
,
656 (char *) SCM_ARG5
, s_recvfrom
);
658 if (tend
<= offset
|| tend
> cend
)
659 scm_out_of_range (s_recvfrom
, end
);
666 fd
= fileno ((FILE *)SCM_STREAM (sock
));
668 tmp_size
= scm_addr_buffer_size
;
669 SCM_SYSCALL (rv
= recvfrom (fd
, SCM_CHARS (buf
) + offset
,
671 (struct sockaddr
*) scm_addr_buffer
,
674 scm_syserror (s_recvfrom
);
676 address
= scm_addr_vector ((struct sockaddr
*) scm_addr_buffer
, s_recvfrom
);
678 address
= SCM_BOOL_F
;
680 return scm_cons (SCM_MAKINUM (rv
), address
);
683 SCM_PROC (s_sendto
, "sendto", 4, 0, 1, scm_sendto
);
686 scm_sendto (sock
, message
, fam
, address
, args_and_flags
)
696 struct sockaddr
*soka
;
699 SCM_ASSERT (SCM_NIMP (sock
) && SCM_FPORTP (sock
), sock
, SCM_ARG1
, s_sendto
);
700 SCM_ASSERT (SCM_NIMP (message
) && SCM_STRINGP (message
), message
, SCM_ARG2
, s_sendto
);
701 SCM_ASSERT (SCM_INUMP (fam
), fam
, SCM_ARG3
, s_sendto
);
702 fd
= fileno ((FILE *)SCM_STREAM (sock
));
704 soka
= scm_fill_sockaddr (SCM_INUM (fam
), address
, &args_and_flags
, 4,
706 if (SCM_NULLP (args_and_flags
))
710 SCM_ASSERT (SCM_NIMP (args_and_flags
) && SCM_CONSP (args_and_flags
),
711 args_and_flags
, SCM_ARG5
, s_sendto
);
712 flg
= scm_num2ulong (SCM_CAR (args_and_flags
), (char *) SCM_ARG5
, s_sendto
);
714 SCM_SYSCALL (rv
= sendto (fd
, SCM_CHARS (message
), SCM_LENGTH (message
), flg
,
717 scm_syserror (s_sendto
);
718 scm_must_free ((char *) soka
);
720 return SCM_MAKINUM (rv
);
728 /* protocol families. */
730 scm_sysintern ("AF_UNSPEC", SCM_MAKINUM (AF_UNSPEC
));
733 scm_sysintern ("AF_UNIX", SCM_MAKINUM (AF_UNIX
));
736 scm_sysintern ("AF_INET", SCM_MAKINUM (AF_INET
));
740 scm_sysintern ("PF_UNSPEC", SCM_MAKINUM (PF_UNSPEC
));
743 scm_sysintern ("PF_UNIX", SCM_MAKINUM (PF_UNIX
));
746 scm_sysintern ("PF_INET", SCM_MAKINUM (PF_INET
));
751 scm_sysintern ("SOCK_STREAM", SCM_MAKINUM (SOCK_STREAM
));
754 scm_sysintern ("SOCK_DGRAM", SCM_MAKINUM (SOCK_DGRAM
));
757 scm_sysintern ("SOCK_RAW", SCM_MAKINUM (SOCK_RAW
));
760 /* setsockopt level. */
762 scm_sysintern ("SOL_SOCKET", SCM_MAKINUM (SOL_SOCKET
));
765 scm_sysintern ("SOL_IP", SCM_MAKINUM (SOL_IP
));
768 scm_sysintern ("SOL_TCP", SCM_MAKINUM (SOL_TCP
));
771 scm_sysintern ("SOL_UDP", SCM_MAKINUM (SOL_UDP
));
774 /* setsockopt names. */
776 scm_sysintern ("SO_DEBUG", SCM_MAKINUM (SO_DEBUG
));
779 scm_sysintern ("SO_REUSEADDR", SCM_MAKINUM (SO_REUSEADDR
));
782 scm_sysintern ("SO_STYLE", SCM_MAKINUM (SO_STYLE
));
785 scm_sysintern ("SO_TYPE", SCM_MAKINUM (SO_TYPE
));
788 scm_sysintern ("SO_ERROR", SCM_MAKINUM (SO_ERROR
));
791 scm_sysintern ("SO_DONTROUTE", SCM_MAKINUM (SO_DONTROUTE
));
794 scm_sysintern ("SO_BROADCAST", SCM_MAKINUM (SO_BROADCAST
));
797 scm_sysintern ("SO_SNDBUF", SCM_MAKINUM (SO_SNDBUF
));
800 scm_sysintern ("SO_RCVBUF", SCM_MAKINUM (SO_RCVBUF
));
803 scm_sysintern ("SO_KEEPALIVE", SCM_MAKINUM (SO_KEEPALIVE
));
806 scm_sysintern ("SO_OOBINLINE", SCM_MAKINUM (SO_OOBINLINE
));
809 scm_sysintern ("SO_NO_CHECK", SCM_MAKINUM (SO_NO_CHECK
));
812 scm_sysintern ("SO_PRIORITY", SCM_MAKINUM (SO_PRIORITY
));
815 scm_sysintern ("SO_LINGER", SCM_MAKINUM (SO_LINGER
));
818 /* recv/send options. */
820 scm_sysintern ("MSG_OOB", SCM_MAKINUM (MSG_OOB
));
823 scm_sysintern ("MSG_PEEK", SCM_MAKINUM (MSG_PEEK
));
826 scm_sysintern ("MSG_DONTROUTE", SCM_MAKINUM (MSG_DONTROUTE
));
829 scm_add_feature ("socket");
830 scm_init_addr_buffer ();