4 Copyright 2012 Stephan Veigl <veigl@gmx.net>
6 This file is part of simavr.
8 simavr is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 simavr is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with simavr. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __SIM_NETWORK_H__
23 #define __SIM_NETWORK_H__
37 #define send(sockfd, buf, len, flags) \
38 (ssize_t)send( (sockfd), (const char *)(buf), (len), (flags))
39 #define setsockopt(sockfd, level, optname, optval, optlen) \
40 setsockopt( (sockfd), (level), (optname), (void *)(optval), (optlen))
41 #define recv(sockfd, buf, len, flags) \
42 (ssize_t)recv( (sockfd), (char *)(buf), (len), (flags))
43 #define sleep(x) Sleep((x)*1000)
45 static inline int network_init()
47 // Windows requires WinSock to be init before use
49 if ( WSAStartup( MAKEWORD( 2, 2 ), &wsaData ) )
55 static inline void network_release()
65 #include <netinet/in.h>
66 #include <netinet/tcp.h>
67 #include <arpa/inet.h>
68 #include <sys/socket.h>
72 static inline int network_init()
78 static inline void network_release()
89 #endif /*__SIM_NETWORK_H__*/