From 5ed4bded021a460aeee8a4724f1c6b914860282f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 2 Jun 2001 01:05:22 +0000 Subject: [PATCH] Implement new primitives to allow finer control over how TCP server sockets are configured: HOST-ADDRESS-ANY HOST-ADDRESS-LOOPBACK CREATE_TCP_SERVER_SOCKET BIND-TCP-SERVER-SOCKET LISTEN-TCP-SERVER-SOCKET --- v7/src/microcode/ntsock.c | 43 +++++----- v7/src/microcode/os2sock.c | 63 ++++++++------ v7/src/microcode/pruxsock.c | 151 ++++++++++++++++------------------ v7/src/microcode/uxsock.c | 158 +++++++++++++----------------------- v7/src/microcode/uxsock.h | 24 ++++-- 5 files changed, 203 insertions(+), 236 deletions(-) diff --git a/v7/src/microcode/ntsock.c b/v7/src/microcode/ntsock.c index 74a8d4516..f4116c8ee 100644 --- a/v7/src/microcode/ntsock.c +++ b/v7/src/microcode/ntsock.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ntsock.c,v 1.8 1999/08/15 15:25:45 cph Exp $ +$Id: ntsock.c,v 1.9 2001/06/02 01:05:09 cph Exp $ Copyright (c) 1997-1999 Massachusetts Institute of Technology @@ -172,34 +172,37 @@ OS_get_host_by_address (const char * host_addr) } } -#ifndef SOCKET_LISTEN_BACKLOG -#define SOCKET_LISTEN_BACKLOG 5 -#endif - Tchannel -OS_open_server_socket (unsigned int port, int arg_number) +OS_create_tcp_server_socket (void) { SOCKET s; - struct sockaddr_in address; - { - unsigned int nb_port = (sizeof (((struct sockaddr_in *) 0) -> sin_port)); - if (((sizeof (unsigned int)) > nb_port) - && (port >= (1U << (CHAR_BIT * nb_port)))) - error_bad_range_arg (arg_number); - } - transaction_begin (); SOCKET_SOCKET_CALL (socket, (PF_INET, SOCK_STREAM, 0), s); - socket_close_on_abort (s); + RETURN_SOCKET (s, NT_channel_class_tcp_server_socket); +} + +void +OS_bind_tcp_server_socket (Tchannel channel, void * host, unsigned int port) +{ + struct sockaddr_in address; memset ((&address), 0, (sizeof (address))); (address . sin_family) = AF_INET; - (address . sin_addr . s_addr) = INADDR_ANY; + memcpy ((& (address . sin_addr)), host, (sizeof (address . sin_addr))); (address . sin_port) = port; VOID_SOCKET_CALL - (bind, (s, - ((struct sockaddr *) (& address)), + (bind, ((CHANNEL_SOCKET (channel)), + ((struct sockaddr *) (&address)), (sizeof (struct sockaddr_in)))); - VOID_SOCKET_CALL (listen, (s, SOCKET_LISTEN_BACKLOG)); - RETURN_SOCKET (s, NT_channel_class_tcp_server_socket); +} + +#ifndef SOCKET_LISTEN_BACKLOG +#define SOCKET_LISTEN_BACKLOG 5 +#endif + +void +OS_listen_tcp_server_socket (Tchannel channel) +{ + VOID_SOCKET_CALL + (listen, ((CHANNEL_SOCKET (channel)), SOCKET_LISTEN_BACKLOG)); } Tchannel diff --git a/v7/src/microcode/os2sock.c b/v7/src/microcode/os2sock.c index 6f691844b..31da53fbe 100644 --- a/v7/src/microcode/os2sock.c +++ b/v7/src/microcode/os2sock.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: os2sock.c,v 1.15 2000/12/05 21:23:46 cph Exp $ +$Id: os2sock.c,v 1.16 2001/06/02 01:05:12 cph Exp $ -Copyright (c) 1990-2000 Massachusetts Institute of Technology +Copyright (c) 1990-2001 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ /* This conditional encompasses the entire file. */ @@ -85,7 +86,7 @@ socket_close_on_abort (int s) } Tchannel -OS_open_tcp_stream_socket (char * host, int port) +OS_open_tcp_stream_socket (void * host, unsigned int port) { int s; struct sockaddr_in address; @@ -194,40 +195,54 @@ OS_get_host_by_address (const char * host_addr) return (result); } } - -#ifndef SOCKET_LISTEN_BACKLOG -#define SOCKET_LISTEN_BACKLOG 5 -#endif +void +OS_host_address_any (void * addr) +{ + (((struct in_addr *) addr) -> s_addr) = INADDR_ANY; +} + +void +OS_host_address_loopback (void * addr) +{ + (((struct in_addr *) addr) -> s_addr) = INADDR_LOOPBACK; +} + Tchannel -OS_open_server_socket (unsigned int port, int arg_number) +OS_create_tcp_server_socket (void) { int s; - struct sockaddr_in address; - { - unsigned int nb_port = (sizeof (((struct sockaddr_in *) 0) -> sin_port)); - if (((sizeof (unsigned int)) > nb_port) - && (port >= (1 << (CHAR_BIT * nb_port)))) - error_bad_range_arg (arg_number); - } - transaction_begin (); VALUE_SOCKET_CALL (socket, (PF_INET, SOCK_STREAM, 0), s); - socket_close_on_abort (s); + return (initialize_stream_socket (s, channel_type_tcp_server_socket)); +} + +void +OS_bind_tcp_server_socket (Tchannel channel, void * host, unsigned int port) +{ memset ((&address), 0, (sizeof (address))); (address . sin_family) = AF_INET; - (address . sin_addr . s_addr) = INADDR_ANY; + memcpy ((& (address . sin_addr)), host, (sizeof (address . sin_addr))); (address . sin_port) = port; VOID_SOCKET_CALL - (bind, (s, - ((struct sockaddr *) (& address)), + (bind, (((int) (CHANNEL_HANDLE (channel))), + ((struct sockaddr *) (&address)), (sizeof (struct sockaddr_in)))); - VOID_SOCKET_CALL (listen, (s, SOCKET_LISTEN_BACKLOG)); - return (initialize_stream_socket (s, channel_type_tcp_server_socket)); +} + +#ifndef SOCKET_LISTEN_BACKLOG +#define SOCKET_LISTEN_BACKLOG 5 +#endif + +void +OS_listen_tcp_server_socket (Tchannel channel) +{ + VOID_SOCKET_CALL + (listen, (((int) (CHANNEL_HANDLE (channel))), SOCKET_LISTEN_BACKLOG)); } Tchannel OS_server_connection_accept (Tchannel channel, - char * peer_host, int * peer_port) + void * peer_host, unsigned int * peer_port) { static struct sockaddr_in address; int s; diff --git a/v7/src/microcode/pruxsock.c b/v7/src/microcode/pruxsock.c index 25836edfd..836689741 100644 --- a/v7/src/microcode/pruxsock.c +++ b/v7/src/microcode/pruxsock.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: pruxsock.c,v 1.18 2000/12/05 21:23:48 cph Exp $ +$Id: pruxsock.c,v 1.19 2001/06/02 01:05:16 cph Exp $ -Copyright (c) 1990-2000 Massachusetts Institute of Technology +Copyright (c) 1990-2001 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ /* Primitives for socket control. */ @@ -50,6 +51,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "uxsock.h" #define SOCKET_CODE(code) code +static PTR +DEFUN (arg_host, (arg), unsigned int arg) +{ + CHECK_ARG (arg, STRING_P); + if ((STRING_LENGTH (ARG_REF (arg))) != (OS_host_address_length ())) + error_bad_range_arg (arg); + return (STRING_LOC ((ARG_REF (arg)), 0)); +} + +static Tchannel +DEFUN (arg_server_socket, (arg), unsigned int arg) +{ + Tchannel server_socket = (arg_nonnegative_integer (arg)); + if ((OS_channel_type (server_socket)) != channel_type_tcp_server_socket) + error_bad_range_arg (arg); + return (server_socket); +} + #else /* not HAVE_SOCKETS */ #define SOCKET_CODE(code) \ @@ -173,18 +192,27 @@ DEFINE_PRIMITIVE ("GET-HOST-BY-ADDRESS", Prim_get_host_by_address, 1, 1, 0) }); } -#ifdef HAVE_SOCKETS - -static char * -DEFUN (arg_host, (arg), unsigned int arg) +DEFINE_PRIMITIVE ("HOST-ADDRESS-ANY", Prim_host_address_any, 0, 0, 0) { - CHECK_ARG (arg, STRING_P); - if ((STRING_LENGTH (ARG_REF (arg))) != (OS_host_address_length ())) - error_bad_range_arg (arg); - return ((char *) (STRING_LOC ((ARG_REF (arg)), 0))); + PRIMITIVE_HEADER (0); + SOCKET_CODE + ({ + SCHEME_OBJECT result = (allocate_string (OS_host_address_length ())); + OS_host_address_any (STRING_LOC (result, 0)); + PRIMITIVE_RETURN (result); + }); } -#endif /* HAVE_SOCKETS */ +DEFINE_PRIMITIVE ("HOST-ADDRESS-LOOPBACK", Prim_host_address_loopback, 0, 0, 0) +{ + PRIMITIVE_HEADER (0); + SOCKET_CODE + ({ + SCHEME_OBJECT result = (allocate_string (OS_host_address_length ())); + OS_host_address_loopback (STRING_LOC (result, 0)); + PRIMITIVE_RETURN (result); + }); +} DEFINE_PRIMITIVE ("NEW-OPEN-TCP-STREAM-SOCKET", Prim_new_open_tcp_stream_socket, 3, 3, "Given HOST-ADDRESS and PORT-NUMBER, open a TCP stream socket.\n\ @@ -227,107 +255,68 @@ The opened socket is stored in the cdr of WEAK-PAIR.") CHECK_ARG (2, WEAK_PAIR_P); SOCKET_CODE ({ - SET_PAIR_CDR - ((ARG_REF (2)), - (long_to_integer - (OS_open_server_socket ((arg_nonnegative_integer (1)), 1)))); + Tchannel channel = (OS_create_tcp_server_socket ()); + PTR address = (OS_malloc (OS_host_address_length ())); + OS_host_address_any (address); + OS_bind_tcp_server_socket + (channel, address, (arg_nonnegative_integer (1))); + OS_free (address); + OS_listen_tcp_server_socket (channel); + SET_PAIR_CDR ((ARG_REF (2)), (long_to_integer (channel))); PRIMITIVE_RETURN (SHARP_T); }); } -#ifdef HAVE_SOCKETS - -static Tchannel -DEFUN (arg_server_socket, (arg), unsigned int arg) +DEFINE_PRIMITIVE ("CREATE_TCP_SERVER_SOCKET", Prim_create_tcp_server_socket, 0, 0, 0) { - Tchannel server_socket = (arg_nonnegative_integer (arg)); - if ((OS_channel_type (server_socket)) != channel_type_tcp_server_socket) - error_bad_range_arg (arg); - return (server_socket); -} - -#endif /* HAVE_SOCKETS */ - -DEFINE_PRIMITIVE ("NEW-TCP-SERVER-CONNECTION-ACCEPT", Prim_new_tcp_server_connection_accept, 3, 3, - "Poll SERVER-SOCKET for a connection.\n\ -If a connection is available, it is opened and #T is returned;\n\ -the opened socket is stored in the cdr of WEAK-PAIR.\n\ -Otherwise, if SERVER-SOCKET is non-blocking, returns #F.\n\ -Second argument PEER-ADDRESS, if not #F, must be a host address string.\n\ -It is filled with the peer's address if given.") -{ - PRIMITIVE_HEADER (3); - CHECK_ARG (3, WEAK_PAIR_P); + PRIMITIVE_HEADER (0); SOCKET_CODE ({ - Tchannel server_socket = (arg_server_socket (1)); - char * peer_host = (((ARG_REF (2)) == SHARP_F) ? 0 : (arg_host (2))); - Tchannel connection = - (OS_server_connection_accept (server_socket, peer_host, 0)); - if (connection == NO_CHANNEL) - PRIMITIVE_RETURN (SHARP_F); - SET_PAIR_CDR ((ARG_REF (3)), (long_to_integer (connection))); - PRIMITIVE_RETURN (SHARP_T); + PRIMITIVE_RETURN (long_to_integer (OS_create_tcp_server_socket ())); }); } - -/* Obsolete Primitives, for compatibility with old runtime systems. */ -DEFINE_PRIMITIVE ("OPEN-TCP-STREAM-SOCKET", Prim_open_tcp_stream_socket, 2, 2, - "Given HOST-ADDRESS and PORT-NUMBER, open and return a TCP stream socket.") +DEFINE_PRIMITIVE ("BIND-TCP-SERVER-SOCKET", Prim_bind_tcp_server_socket, 3, 3, 0) { - PRIMITIVE_HEADER (2); + PRIMITIVE_HEADER (3); SOCKET_CODE ({ - PRIMITIVE_RETURN - (long_to_integer - (OS_open_tcp_stream_socket ((arg_host (1)), - (arg_nonnegative_integer (2))))); + OS_bind_tcp_server_socket ((arg_server_socket (1)), + (arg_host (2)), + (arg_nonnegative_integer (3))); + PRIMITIVE_RETURN (UNSPECIFIC); }); } -DEFINE_PRIMITIVE ("OPEN-UNIX-STREAM-SOCKET", Prim_open_unix_stream_socket, 1, 1, - "Open the unix stream socket FILENAME.") -{ - PRIMITIVE_HEADER (1); -#ifdef HAVE_UNIX_SOCKETS - PRIMITIVE_RETURN - (long_to_integer (OS_open_unix_stream_socket (STRING_ARG (1)))); -#else - signal_error_from_primitive (ERR_UNIMPLEMENTED_PRIMITIVE); - PRIMITIVE_RETURN (UNSPECIFIC); -#endif -} - -DEFINE_PRIMITIVE ("OPEN-TCP-SERVER-SOCKET", Prim_open_tcp_server_socket, 1, 1, - "Given PORT-NUMBER, open and return a TCP server socket.") +DEFINE_PRIMITIVE ("LISTEN-TCP-SERVER-SOCKET", Prim_listen_tcp_server_socket, 1, 1, 0) { PRIMITIVE_HEADER (1); SOCKET_CODE ({ - PRIMITIVE_RETURN - (long_to_integer - (OS_open_server_socket ((arg_nonnegative_integer (1)), 1))); + OS_listen_tcp_server_socket (arg_server_socket (1)); + PRIMITIVE_RETURN (UNSPECIFIC); }); } -DEFINE_PRIMITIVE ("TCP-SERVER-CONNECTION-ACCEPT", Prim_tcp_server_connection_accept, 2, 2, +DEFINE_PRIMITIVE ("NEW-TCP-SERVER-CONNECTION-ACCEPT", Prim_new_tcp_server_connection_accept, 3, 3, "Poll SERVER-SOCKET for a connection.\n\ -If a connection is available, it is opened and returned.\n\ +If a connection is available, it is opened and #T is returned;\n\ +the opened socket is stored in the cdr of WEAK-PAIR.\n\ Otherwise, if SERVER-SOCKET is non-blocking, returns #F.\n\ Second argument PEER-ADDRESS, if not #F, must be a host address string.\n\ It is filled with the peer's address if given.") { - PRIMITIVE_HEADER (2); + PRIMITIVE_HEADER (3); + CHECK_ARG (3, WEAK_PAIR_P); SOCKET_CODE ({ Tchannel server_socket = (arg_server_socket (1)); - char * peer_host = (((ARG_REF (2)) == SHARP_F) ? 0 : (arg_host (2))); + PTR peer_host = (((ARG_REF (2)) == SHARP_F) ? 0 : (arg_host (2))); Tchannel connection = (OS_server_connection_accept (server_socket, peer_host, 0)); - PRIMITIVE_RETURN - ((connection == NO_CHANNEL) - ? SHARP_F - : (long_to_integer (connection))); + if (connection == NO_CHANNEL) + PRIMITIVE_RETURN (SHARP_F); + SET_PAIR_CDR ((ARG_REF (3)), (long_to_integer (connection))); + PRIMITIVE_RETURN (SHARP_T); }); } diff --git a/v7/src/microcode/uxsock.c b/v7/src/microcode/uxsock.c index aabf6f4e0..30a36766c 100644 --- a/v7/src/microcode/uxsock.c +++ b/v7/src/microcode/uxsock.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: uxsock.c,v 1.26 2000/12/05 21:23:49 cph Exp $ +$Id: uxsock.c,v 1.27 2001/06/02 01:05:19 cph Exp $ -Copyright (c) 1990-2000 Massachusetts Institute of Technology +Copyright (c) 1990-2001 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ #include "ux.h" @@ -32,7 +33,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. static void do_connect (int, struct sockaddr *, socklen_t); Tchannel -DEFUN (OS_open_tcp_stream_socket, (host, port), char * host AND int port) +DEFUN (OS_open_tcp_stream_socket, (host, port), + PTR host AND + unsigned int port) { int s; Tchannel channel; @@ -45,12 +48,7 @@ DEFUN (OS_open_tcp_stream_socket, (host, port), char * host AND int port) { struct sockaddr_in address; (address . sin_family) = AF_INET; - { - char * scan = ((char*) (& (address . sin_addr))); - char * end = (scan + (sizeof (address . sin_addr))); - while (scan < end) - (*scan++) = (*host++); - } + memcpy ((& (address . sin_addr)), host, (sizeof (address . sin_addr))); (address . sin_port) = port; do_connect (s, ((struct sockaddr *) (&address)), (sizeof (address))); } @@ -199,10 +197,22 @@ DEFUN (OS_get_host_by_address, (host_addr), CONST char * host_addr) } } +void +DEFUN (OS_host_address_any, (addr), PTR addr) +{ + (((struct in_addr *) addr) -> s_addr) = INADDR_ANY; +} + +void +DEFUN (OS_host_address_loopback, (addr), PTR addr) +{ + (((struct in_addr *) addr) -> s_addr) = INADDR_LOOPBACK; +} + +#ifdef HAVE_UNIX_SOCKETS Tchannel DEFUN (OS_open_unix_stream_socket, (filename), CONST char * filename) { -#ifdef HAVE_UNIX_SOCKETS int s; Tchannel channel; @@ -219,48 +229,51 @@ DEFUN (OS_open_unix_stream_socket, (filename), CONST char * filename) } transaction_commit (); return (channel); -#else /* not HAVE_UNIX_SOCKETS */ - error_unimplemented_primitive (); - return (NO_CHANNEL); -#endif /* not HAVE_UNIX_SOCKETS */ } +#endif /* HAVE_UNIX_SOCKETS */ -#ifndef SOCKET_LISTEN_BACKLOG -#define SOCKET_LISTEN_BACKLOG 1024 -#endif - Tchannel -DEFUN (OS_open_server_socket, (port, ArgNo), unsigned int port AND int ArgNo) +DEFUN_VOID (OS_create_tcp_server_socket) { int s; - - if (((sizeof (unsigned int)) > - (sizeof (((struct sockaddr_in *) 0)->sin_port))) && - (port >= (1 << (CHAR_BIT - * (sizeof (((struct sockaddr_in *) 0)->sin_port)))))) - error_bad_range_arg(ArgNo); STD_UINT_SYSTEM_CALL (syscall_socket, s, (UX_socket (AF_INET, SOCK_STREAM, 0))); - { - struct sockaddr_in address; - (address . sin_family) = AF_INET; - (address . sin_addr . s_addr) = INADDR_ANY; - (address . sin_port) = port; - STD_VOID_SYSTEM_CALL - (syscall_bind, (UX_bind (s, - ((struct sockaddr *) (& address)), - (sizeof (struct sockaddr_in))))); - } - STD_VOID_SYSTEM_CALL - (syscall_listen, (UX_listen (s, SOCKET_LISTEN_BACKLOG))); MAKE_CHANNEL (s, channel_type_tcp_server_socket, return); } +void +DEFUN (OS_bind_tcp_server_socket, (channel, host, port), + Tchannel channel AND + PTR host AND + unsigned int port) +{ + struct sockaddr_in address; + (address . sin_family) = AF_INET; + memcpy ((& (address . sin_addr)), host, (sizeof (address . sin_addr))); + (address . sin_port) = port; + STD_VOID_SYSTEM_CALL + (syscall_bind, (UX_bind ((CHANNEL_DESCRIPTOR (channel)), + ((struct sockaddr *) (&address)), + (sizeof (struct sockaddr_in))))); +} + +#ifndef SOCKET_LISTEN_BACKLOG +#define SOCKET_LISTEN_BACKLOG 1024 +#endif + +void +DEFUN (OS_listen_tcp_server_socket, (channel), Tchannel channel) +{ + STD_VOID_SYSTEM_CALL + (syscall_listen, + (UX_listen ((CHANNEL_DESCRIPTOR (channel)), SOCKET_LISTEN_BACKLOG))); +} + Tchannel DEFUN (OS_server_connection_accept, (channel, peer_host, peer_port), Tchannel channel AND - char * peer_host AND - int * peer_port) + PTR peer_host AND + unsigned int * peer_port) { static struct sockaddr_in address; int address_length = (sizeof (struct sockaddr_in)); @@ -287,71 +300,12 @@ DEFUN (OS_server_connection_accept, (channel, peer_host, peer_port), deliver_pending_interrupts (); } if (peer_host != 0) - { - char * scan = ((char *) (& (address . sin_addr))); - char * end = (scan + (sizeof (address . sin_addr))); - while (scan < end) - (*peer_host++) = (*scan++); - } + memcpy (peer_host, + (& (address . sin_addr)), + (sizeof (address . sin_addr))); if (peer_port != 0) (*peer_port) = (address . sin_port); MAKE_CHANNEL (s, channel_type_tcp_stream_socket, return); } - -#else /* not HAVE_SOCKETS */ - -Tchannel -DEFUN (OS_open_tcp_stream_socket, (host, port), char * host AND int port) -{ - error_unimplemented_primitive (); - return (NO_CHANNEL); -} - -int -DEFUN (OS_get_service_by_name, (service_name, protocol_name), - CONST char * service_name AND - CONST char * protocol_name) -{ - error_unimplemented_primitive (); - return (-1); -} - -unsigned int -DEFUN_VOID (OS_host_address_length) -{ - error_unimplemented_primitive (); - return (0); -} - -char ** -DEFUN (OS_get_host_by_name, (host_name), CONST char * host_name) -{ - error_unimplemented_primitive (); - return (0); -} - -Tchannel -DEFUN (OS_open_unix_stream_socket, (filename), CONST char * filename) -{ - error_unimplemented_primitive (); - return (NO_CHANNEL); -} - -Tchannel -DEFUN (OS_open_server_socket, (port, ArgNo), unsigned int port AND int ArgNo) -{ - error_unimplemented_primitive (); - return (NO_CHANNEL); -} - -Tchannel -DEFUN (OS_server_connection_accept, (channel, peer_host, peer_port), - Tchannel channel AND - char * peer_host AND - int * peer_port) -{ - error_unimplemented_primitive (); - return (NO_CHANNEL); -} #endif /* not HAVE_SOCKETS */ diff --git a/v7/src/microcode/uxsock.h b/v7/src/microcode/uxsock.h index 1b4f32065..45696ba33 100644 --- a/v7/src/microcode/uxsock.h +++ b/v7/src/microcode/uxsock.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: uxsock.h,v 1.9 1999/08/13 18:29:18 cph Exp $ +$Id: uxsock.h,v 1.10 2001/06/02 01:05:22 cph Exp $ -Copyright (c) 1990-1999 Massachusetts Institute of Technology +Copyright (c) 1990-2001 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ #ifndef SCM_UXSOCK_H @@ -24,20 +25,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "osio.h" -extern Tchannel EXFUN (OS_open_tcp_stream_socket, (char *, int)); +extern Tchannel EXFUN (OS_open_tcp_stream_socket, (PTR, unsigned int)); extern int EXFUN (OS_get_service_by_name, (CONST char *, CONST char *)); extern unsigned long EXFUN (OS_get_service_by_number, (CONST unsigned long)); extern unsigned int EXFUN (OS_host_address_length, (void)); extern char ** EXFUN (OS_get_host_by_name, (CONST char *)); -CONST char * EXFUN (OS_get_host_name, (void)); -CONST char * EXFUN (OS_canonical_host_name, (CONST char *)); -CONST char * EXFUN (OS_get_host_by_address, (CONST char *)); +extern CONST char * EXFUN (OS_get_host_name, (void)); +extern CONST char * EXFUN (OS_canonical_host_name, (CONST char *)); +extern CONST char * EXFUN (OS_get_host_by_address, (CONST char *)); +extern void EXFUN (OS_host_address_any, (PTR)); +extern void EXFUN (OS_host_address_loopback, (PTR)); #ifdef HAVE_UNIX_SOCKETS extern Tchannel EXFUN (OS_open_unix_stream_socket, (CONST char *)); #endif -extern Tchannel EXFUN (OS_open_server_socket, (unsigned int, int)); -extern Tchannel EXFUN (OS_server_connection_accept, (Tchannel, char *, int *)); +extern Tchannel EXFUN (OS_create_tcp_server_socket, (void)); +extern void EXFUN (OS_bind_tcp_server_socket, (Tchannel, PTR, unsigned int)); +extern void EXFUN (OS_listen_tcp_server_socket, (Tchannel)); +extern Tchannel EXFUN + (OS_server_connection_accept, (Tchannel, PTR, unsigned int *)); #endif /* SCM_UXSOCK_H */ -- 2.25.1