From: Ronnie Sahlberg Date: Sat, 13 Apr 2013 00:38:44 +0000 (-0700) Subject: AROS more stuff. The listservers example now compiles and links X-Git-Tag: upstream/1.9.6^2~229 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f69bd55482d0b53bd968ec24961e484b8c060f5c;p=deb_libnfs.git AROS more stuff. The listservers example now compiles and links it sends packets to the host but something is still not working. --- diff --git a/Makefile.AROS b/aros/Makefile.AROS old mode 100644 new mode 100755 similarity index 86% rename from Makefile.AROS rename to aros/Makefile.AROS index fb0c988..54f7249 --- a/Makefile.AROS +++ b/aros/Makefile.AROS @@ -1,6 +1,6 @@ AR=ar CC=gcc -CFLAGS=-g -O0 -DAROS=1 -D_U_=" " -I. -Iinclude -Iinclude/nfsc -Iaros -Infs -Imount +CFLAGS=-g -O0 -DAROS=1 -D_U_=" " -DHAVE_SOCKADDR_LEN -I. -Iinclude -Iinclude/nfsc -Iaros -Infs -Imount OBJS=lib/init.o lib/libnfs.o lib/libnfs-sync.o lib/libnfs-zdr.o lib/pdu.o lib/socket.o OBJS+=mount/mount.o mount/libnfs-raw-mount.o diff --git a/aros/aros_compat.c b/aros/aros_compat.c index 202f614..02c0954 100644 --- a/aros/aros_compat.c +++ b/aros/aros_compat.c @@ -1,32 +1,71 @@ -/* - Copyright (C) 2013 by Ronnie Sahlberg - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, see . -*/ #ifdef AROS #include #include -#include +#include #include #include +#include +#include #include "aros_compat.h" #undef poll -/* unix device major/minor numbers dont make much sense on amiga */ +int aros_getnameinfo(const struct sockaddr *sa, socklen_t salen, +char *host, size_t hostlen, +char *serv, size_t servlen, int flags) +{ + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + + if (host) { + snprintf(host, hostlen, Inet_NtoA(sin->sin_addr.s_addr)); + } + + return 0; +} + +int aros_getaddrinfo(const char *node, const char*service, +const struct addrinfo *hints, +struct addrinfo **res) +{ + struct sockaddr_in *sin; + + sin = malloc(sizeof(struct sockaddr_in)); + sin->sin_len = sizeof(struct sockaddr_in); + sin->sin_family=AF_INET; + + /* Some error checking would be nice */ + sin->sin_addr.s_addr = inet_addr(node); + + sin->sin_port=0; + if (service) { + sin->sin_port=atoi(service); + } + + *res = malloc(sizeof(struct addrinfo)); + + (*res)->ai_family = AF_INET; + (*res)->ai_addrlen = sizeof(struct sockaddr_in); + (*res)->ai_addr = (struct sockaddr *)sin; + + return 0; +} + +void aros_freeaddrinfo(struct addrinfo *res) +{ + free(res->ai_addr); + free(res); +} + +int aros_inet_pton(int af, char *src, void *dst) +{ + printf("No inet_pton yet"); + exit(10); +} + + +/* unix device numbers dont really make much sense on aros ... */ int major(int i) { return 1; @@ -41,7 +80,7 @@ struct Library * SocketBase = NULL; void aros_init_socket(void) { if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) { - printf("No TCP/IP stack available.\n"); + printf("NoTCP/IP Stack available"); exit(10); } } @@ -107,3 +146,4 @@ int aros_poll(struct pollfd *fds, unsigned int nfds, int timo) } #endif + diff --git a/aros/aros_compat.h b/aros/aros_compat.h index d5b2d73..528fdf7 100644 --- a/aros/aros_compat.h +++ b/aros/aros_compat.h @@ -10,6 +10,11 @@ #define ioctl IoctlSocket #define close CloseSocket +#define inet_pton aros_inet_pton +#define freeaddrinfo aros_freeaddrinfo +#define getnameinfo aros_getnameinfo +#define getaddrinfo aros_getaddrinfo + extern struct Library * SocketBase; void aros_init_socket(void);