X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fwin32%2Fsilcwin32net.c;h=818945e0c0ec769a0cd9e6bf4f9b4d3c9d3c5ec9;hb=40f8443d8d3a6577336ee66d18e04d9ac4d956bb;hp=e8fcc26a2195ae834fb08658c390468e094f31b1;hpb=eccdff95fcc583ac52c47a720ae62dc97f22b7c1;p=silc.git diff --git a/lib/silcutil/win32/silcwin32net.c b/lib/silcutil/win32/silcwin32net.c index e8fcc26a..818945e0 100644 --- a/lib/silcutil/win32/silcwin32net.c +++ b/lib/silcutil/win32/silcwin32net.c @@ -4,12 +4,11 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2001 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,7 +18,9 @@ */ /* $Id$ */ -#include "silcincludes.h" +/* XXX IPv6 support missing */ + +#include "silc.h" #include "silcnet.h" /* This function creates server or daemon or listener or what ever. This @@ -28,7 +29,7 @@ If argument `ip_addr' is NULL `any' address will be used. Returns the created socket or -1 on error. */ -int silc_net_create_server(int port, char *ip_addr) +int silc_net_create_server(int port, const char *ip_addr) { SOCKET sock; int rval; @@ -222,7 +223,7 @@ void silc_net_close_connection(int sock) /* Converts the IP number string from numbers-and-dots notation to binary form. */ -bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len); +SilcBool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len) { unsigned long ret; @@ -231,25 +232,7 @@ bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len); if (bin_len < 4) return FALSE; - memcpy(bin, (unsigned char *)&tmp.s_addr, 4); - return ret != INADDR_NONE; -} - -/* Converts the IP number string from numbers-and-dots notation to - binary form in network byte order. */ - -bool silc_net_addr2bin_ne(const char *addr, unsigned char *bin, - uint32 bin_len) -{ - unsigned long ret; - - ret = inet_addr(addr); - - if (bin_len < 4) - return FALSE; - - SILC_PUT32_MSB(ret, bin); - + memcpy(bin, (unsigned char *)&ret, 4); return ret != INADDR_NONE; } @@ -263,7 +246,7 @@ int silc_net_set_socket_nonblock(int sock) /* Init Winsock2. */ -bool silc_net_win32_init(void) +SilcBool silc_net_win32_init(void) { int ret, sopt = SO_SYNCHRONOUS_NONALERT; WSADATA wdata;