Patch adding Wii support by tueidj, part 7: networking

This simply macro-defines various low-level networking functions.

git-svn-id: https://svn.eduke32.com/eduke32@2627 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-01 12:39:41 +00:00
parent 830f73a316
commit 4ec6ffcef8
2 changed files with 40 additions and 6 deletions

View file

@ -8,7 +8,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h>
#if defined(GEKKO)
# include <network.h>
#else
# include <netinet/in.h>
#endif
#include <unistd.h> #include <unistd.h>
typedef int ENetSocket; typedef int ENetSocket;

View file

@ -4,12 +4,40 @@
*/ */
#ifndef WIN32 #ifndef WIN32
#include <sys/types.h> #if defined(GEKKO)
#include <sys/socket.h> # include <network.h>
#include <sys/ioctl.h> # define gethostbyname net_gethostbyname
# define gethostbyaddr(...) (NULL)
# define bind net_bind
# define listen net_listen
# define socket net_socket
# define ioctl net_ioctl
# define connect net_connect
# define setsockopt net_setsockopt
# define accept net_accept
# define select net_select
struct msghdr {
void *msg_name; /* optional address */
socklen_t msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter/gather array */
size_t msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* ancillary data, see below */
socklen_t msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
};
# define sendmsg(...) (-1)
# define recvmsg(...) (-1)
# define SOMAXCONN 5
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/ioctl.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>