1 /*! \file socket-amiga-impl.h \n
2  *  \author Marco van den heuvel\n
3  *  \brief  Abstraction from network sockets.
4  *
5  * socket-amiga-impl.h - Abstraction from network sockets. Amiga implementation.
6  *
7  * Written by
8  *  Marco van den Heuvel <blackystardust68@yahoo.com>
9  *
10  * based on code from network.c written by
11  *  Andreas Matthies <andreas.matthies@gmx.net>
12  *
13  * This file is part of VICE, the Versatile Commodore Emulator.
14  * See README for copyright notice.
15  *
16  *  This program is free software; you can redistribute it and/or modify
17  *  it under the terms of the GNU General Public License as published by
18  *  the Free Software Foundation; either version 2 of the License, or
19  *  (at your option) any later version.
20  *
21  *  This program is distributed in the hope that it will be useful,
22  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  *  GNU General Public License for more details.
25  *
26  *  You should have received a copy of the GNU General Public License
27  *  along with this program; if not, write to the Free Software
28  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29  *  02111-1307  USA.
30  *
31  */
32 
33 #ifndef VICE_SOCKET_AMIGA_IMPL_H
34 #define VICE_SOCKET_AMIGA_IMPL_H
35 
36 #ifdef HAVE_NETWORK
37 
38 #include <assert.h>
39 #include <stdio.h>
40 
41 #ifdef HAVE_STRINGS_H
42 #include <strings.h>
43 #endif
44 
45 #ifndef AMIGA_OS4
46 # ifdef AMIGA_M68K
47 #  undef BYTE
48 #  undef WORD
49 #  include <utility/tagitem.h>
50 #  include <clib/exec_protos.h>
51 # endif
52 # ifdef AMIGA_AROS
53 #  undef WORD
54 #  undef BYTE
55 #  include <proto/exec.h>
56 # endif
57 # include <proto/socket.h>
58 #else
59 # define __USE_INLINE__
60 # include <proto/bsdsocket.h>
61 #endif
62 
63 #if !defined(AMIGA_AROS) && !defined(AMIGA_MORPHOS)
64 # define select(nfds, read_fds, write_fds, except_fds, timeout) \
65     WaitSelect(nfds, read_fds, write_fds, except_fds, timeout, NULL)
66 #endif
67 
68 #include <sys/types.h>
69 #include <sys/socket.h>
70 #include <netinet/in.h>
71 #include <arpa/inet.h>
72 #include <netdb.h>
73 
74 #ifdef HAVE_NETINET_TCP_H
75 #include <netinet/tcp.h>
76 #endif
77 
78 #include <sys/time.h>
79 
80 #if !defined(AMIGA_M68K) && !defined(AMIGA_AROS)
81 # include <unistd.h>
82 #endif
83 
84 typedef unsigned int SOCKET;
85 typedef struct timeval TIMEVAL;
86 
87 #ifdef AMIGA_OS4
88 # define closesocket close
89 #else
90 # define closesocket CloseSocket
91 #endif
92 
93 #ifndef INVALID_SOCKET
94 # define INVALID_SOCKET -1
95 #endif
96 
97 #define in_addr_t unsigned long
98 
99 #endif /* #ifdef HAVE_NETWORK */
100 
101 #endif /* #ifndef VICE_SOCKET_AMIGA_IMPL_H */
102