Imported most of the old libnet.so compatibility functions (from old/compat/libnet/compat.c).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19015 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-10-06 13:46:14 +00:00
parent e9828bbd25
commit 6a5dcb571c
2 changed files with 77 additions and 0 deletions

View File

@ -6,6 +6,7 @@ SharedLibrary libnetwork.so :
init.cpp
interfaces.cpp
socket.cpp
r5_compatibility.cpp
:
<libnetwork_dns>dns_dst.o
<libnetwork_dns>dns_inet.o

View File

@ -0,0 +1,76 @@
/*
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Philippe Houdoin
* Jérôme Duval, korli@users.berlios.de
* Axel Dörfler, axeld@pinc-software.de
*/
#include <SupportDefs.h>
#include <string.h>
#include <unistd.h>
struct net_settings;
int _netstat(int fd, char **output, int verbose);
int closesocket(int socket);
char *find_net_setting(net_settings* settings, const char* heading,
const char* name, char* value, unsigned numBytes);
status_t set_net_setting(net_settings* settings, const char* heading,
const char* name, const char* value);
int
_netstat(int fd, char **output, int verbose)
{
return ENOSYS;
}
int
closesocket(int socket)
{
return close(socket);
}
/* TODO: This is a terrible hack :(
* TODO: We should really get these settings values by parsing the real settings
*/
char *
find_net_setting(net_settings* settings, const char* heading,
const char* name, char* value, unsigned numBytes)
{
if (strcmp(heading, "GLOBAL") != 0)
return NULL;
if (!strcmp(name, "HOSTNAME"))
strlcpy(value, "hostname", numBytes);
else if (!strcmp(name, "USERNAME"))
strlcpy(value, "baron", numBytes);
else if (!strcmp(name, "PASSWORD"))
strlcpy(value, "password", numBytes);
else if (!strcmp(name, "FTP_ENABLED"))
strlcpy(value, "1", numBytes);
else if (!strcmp(name, "TELNETD_ENABLED"))
strlcpy(value, "1", numBytes);
else
return NULL;
return value;
}
status_t
set_net_setting(net_settings* settings, const char* heading,
const char* name, const char* value)
{
return B_UNSUPPORTED;
}