From d96419ccd3bdf812de435ce73b4487beafe1711e Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 2 Jun 2001 01:25:00 +0000 Subject: [PATCH] Provide missing htonl calls. --- v7/src/microcode/ntsock.c | 27 +++++++++++++++++++++------ v7/src/microcode/os2sock.c | 6 +++--- v7/src/microcode/uxsock.c | 6 +++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/v7/src/microcode/ntsock.c b/v7/src/microcode/ntsock.c index f4116c8ee..20d2bdf3a 100644 --- a/v7/src/microcode/ntsock.c +++ b/v7/src/microcode/ntsock.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntsock.c,v 1.9 2001/06/02 01:05:09 cph Exp $ +$Id: ntsock.c,v 1.10 2001/06/02 01:25:00 cph Exp $ -Copyright (c) 1997-1999 Massachusetts Institute of Technology +Copyright (c) 1997-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. */ @@ -77,7 +78,7 @@ socket_close_on_abort (SOCKET s) } Tchannel -OS_open_tcp_stream_socket (char * host, int port) +OS_open_tcp_stream_socket (void * host, unsigned int port) { SOCKET s; struct sockaddr_in address; @@ -87,7 +88,7 @@ OS_open_tcp_stream_socket (char * host, int port) socket_close_on_abort (s); memset ((&address), 0, (sizeof (address))); (address . sin_family) = AF_INET; - memcpy ((& (address . sin_addr)), host, (sizeof (struct in_addr))); + memcpy ((& (address . sin_addr)), host, (sizeof (address . sin_addr))); (address . sin_port) = port; VOID_SOCKET_CALL (connect, (s, @@ -171,6 +172,18 @@ OS_get_host_by_address (const char * host_addr) return (result); } } + +void +OS_host_address_any (void * addr) +{ + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_ANY)); +} + +void +OS_host_address_loopback (void * addr) +{ + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_LOOPBACK)); +} Tchannel OS_create_tcp_server_socket (void) @@ -233,7 +246,9 @@ OS_server_connection_accept (Tchannel channel, transaction_begin (); socket_close_on_abort (s); if (peer_host != 0) - memcpy (peer_host, (& (address . sin_addr)), (sizeof (struct in_addr))); + memcpy (peer_host, + (& (address . sin_addr)), + (sizeof (address . sin_addr))); if (peer_port != 0) (*peer_port) = (address . sin_port); RETURN_SOCKET (s, NT_channel_class_tcp_stream_socket); diff --git a/v7/src/microcode/os2sock.c b/v7/src/microcode/os2sock.c index 31da53fbe..760059bf9 100644 --- a/v7/src/microcode/os2sock.c +++ b/v7/src/microcode/os2sock.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: os2sock.c,v 1.16 2001/06/02 01:05:12 cph Exp $ +$Id: os2sock.c,v 1.17 2001/06/02 01:22:47 cph Exp $ Copyright (c) 1990-2001 Massachusetts Institute of Technology @@ -199,13 +199,13 @@ OS_get_host_by_address (const char * host_addr) void OS_host_address_any (void * addr) { - (((struct in_addr *) addr) -> s_addr) = INADDR_ANY; + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_ANY)); } void OS_host_address_loopback (void * addr) { - (((struct in_addr *) addr) -> s_addr) = INADDR_LOOPBACK; + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_LOOPBACK)); } Tchannel diff --git a/v7/src/microcode/uxsock.c b/v7/src/microcode/uxsock.c index 30a36766c..edcaee61e 100644 --- a/v7/src/microcode/uxsock.c +++ b/v7/src/microcode/uxsock.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: uxsock.c,v 1.27 2001/06/02 01:05:19 cph Exp $ +$Id: uxsock.c,v 1.28 2001/06/02 01:21:58 cph Exp $ Copyright (c) 1990-2001 Massachusetts Institute of Technology @@ -200,13 +200,13 @@ 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; + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_ANY)); } void DEFUN (OS_host_address_loopback, (addr), PTR addr) { - (((struct in_addr *) addr) -> s_addr) = INADDR_LOOPBACK; + (((struct in_addr *) addr) -> s_addr) = (htonl (INADDR_LOOPBACK)); } #ifdef HAVE_UNIX_SOCKETS -- 2.25.1