order.
/* -*-C-*-
-$Id: ntsock.c,v 1.3 1998/04/14 05:13:37 cph Exp $
+$Id: ntsock.c,v 1.4 1998/08/31 04:00:08 cph Exp $
Copyright (c) 1997-98 Massachusetts Institute of Technology
return ((entry == 0) ? (-1) : (entry -> s_port));
}
+unsigned long
+OS_get_service_by_number (const unsigned long port_number)
+{
+ return ((unsigned long) (htons ((unsigned short) port_number)));
+}
+
unsigned int
OS_host_address_length (void)
{
/* -*-C-*-
-$Id: os2sock.c,v 1.7 1998/08/31 03:57:49 cph Exp $
+$Id: os2sock.c,v 1.8 1998/08/31 04:00:04 cph Exp $
Copyright (c) 1990-98 Massachusetts Institute of Technology
return ((entry == 0) ? (-1) : (entry -> s_port));
}
-unsigned short
-OS_get_service_by_number (const unsigned short port_number)
+unsigned long
+OS_get_service_by_number (const unsigned long port_number)
{
- return (htons (port_number));
+ return ((unsigned long) (htons ((unsigned short) port_number)));
}
unsigned int
/* -*-C-*-
-$Id: pruxsock.c,v 1.14 1997/11/01 07:27:36 cph Exp $
+$Id: pruxsock.c,v 1.15 1998/08/31 04:00:22 cph Exp $
-Copyright (c) 1990-97 Massachusetts Institute of Technology
+Copyright (c) 1990-98 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
});
}
+DEFINE_PRIMITIVE ("GET-SERVICE-BY-NUMBER", Prim_get_service_by_number, 1, 1,
+ "Given PORT-NUMBER, return it in the network encoding.")
+{
+ PRIMITIVE_HEADER (1);
+ SOCKET_CODE
+ ({
+ PRIMITIVE_RETURN
+ (ulong_to_integer (OS_get_service_by_number (arg_ulong_integer (1))));
+ });
+}
+
DEFINE_PRIMITIVE ("HOST-ADDRESS-LENGTH", Prim_host_address_length, 0, 0,
"The length of a host address string, in characters.")
{
/* -*-C-*-
-$Id: uxsock.c,v 1.16 1997/11/01 07:26:30 cph Exp $
+$Id: uxsock.c,v 1.17 1998/08/31 04:00:13 cph Exp $
-Copyright (c) 1990-97 Massachusetts Institute of Technology
+Copyright (c) 1990-98 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
return ((entry == 0) ? (-1) : (entry -> s_port));
}
+unsigned long
+DEFUN (OS_get_service_by_number, (port_number),
+ CONST unsigned long port_number)
+{
+ return ((unsigned long) (htons ((unsigned short) port_number)));
+}
+
unsigned int
DEFUN_VOID (OS_host_address_length)
{
/* -*-C-*-
-$Id: uxsock.h,v 1.6 1997/11/01 07:19:26 cph Exp $
+$Id: uxsock.h,v 1.7 1998/08/31 04:00:26 cph Exp $
-Copyright (c) 1990-97 Massachusetts Institute of Technology
+Copyright (c) 1990-98 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#include "osio.h"
-extern Tchannel EXFUN (OS_open_tcp_stream_socket, (char * host, int port));
-extern int EXFUN
- (OS_get_service_by_name,
- (CONST char * service_name, CONST char * protocol_name));
+extern Tchannel EXFUN (OS_open_tcp_stream_socket, (char *, 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 * host_name));
+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 *));
#ifdef HAVE_UNIX_SOCKETS
-extern Tchannel EXFUN (OS_open_unix_stream_socket, (CONST char * filename));
+extern Tchannel EXFUN (OS_open_unix_stream_socket, (CONST char *));
#endif
-extern Tchannel EXFUN (OS_open_server_socket, (unsigned int port, int ArgNo));
-extern Tchannel EXFUN
- (OS_server_connection_accept,
- (Tchannel channel, char * peer_host, int * peer_port));
+extern Tchannel EXFUN (OS_open_server_socket, (unsigned int, int));
+extern Tchannel EXFUN (OS_server_connection_accept, (Tchannel, char *, int *));
#endif /* SCM_UXSOCK_H */