37 return(&linked_version);
45 #ifndef __USE_W32_SOCKETS
49 #ifndef __USE_W32_SOCKETS
89 #ifdef __USE_W32_SOCKETS
91 WORD version_wanted = MAKEWORD(1,1);
94 if ( WSAStartup(version_wanted, &wsaData) != 0 ) {
101 handler = signal(SIGPIPE, SIG_IGN);
102 if ( handler != SIG_DFL ) {
103 signal(SIGPIPE, handler);
116 #ifdef __USE_W32_SOCKETS
119 if ( WSAGetLastError() == WSAEINPROGRESS ) {
121 WSACancelBlockingCall();
129 handler = signal(SIGPIPE, SIG_DFL);
130 if ( handler != SIG_IGN ) {
131 signal(SIGPIPE, handler);
143 if ( host ==
NULL ) {
146 address->
host = inet_addr(host);
150 hp = gethostbyname(host);
152 memcpy(&address->
host,hp->h_addr,hp->h_length);
178 hp = gethostbyaddr((
const char *)&ip->
host,
sizeof(ip->
host), AF_INET);
183 in.s_addr = ip->
host;
184 return inet_ntoa(in);
192 #ifndef _SIZEOF_ADDR_IFREQ
193 #define _SIZEOF_ADDR_IFREQ sizeof
199 struct sockaddr_in *sock_addr;
201 sock = socket(AF_INET, SOCK_DGRAM, 0);
206 conf.ifc_len =
sizeof(
data);
207 conf.ifc_buf = (caddr_t) data;
208 if ( ioctl(sock, SIOCGIFCONF, &conf) < 0 ) {
213 ifr = (
struct ifreq*)data;
214 while ((
char*)ifr < data+conf.ifc_len) {
215 if (ifr->ifr_addr.sa_family == AF_INET) {
216 if (count < maxcount) {
217 sock_addr = (
struct sockaddr_in*)&ifr->ifr_addr;
218 addresses[count].
host = sock_addr->sin_addr.s_addr;
219 addresses[count].
port = sock_addr->sin_port;
223 ifr = (
struct ifreq*)((
char*)ifr + _SIZEOF_ADDR_IFREQ(*ifr));
226 #elif defined(__WIN32__)
227 PIP_ADAPTER_INFO pAdapterInfo;
228 PIP_ADAPTER_INFO pAdapter;
231 ULONG ulOutBufLen =
sizeof (IP_ADAPTER_INFO);
233 pAdapterInfo = (IP_ADAPTER_INFO *)
malloc(
sizeof (IP_ADAPTER_INFO));
234 if (pAdapterInfo ==
NULL) {
238 if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == ERROR_BUFFER_OVERFLOW) {
239 pAdapterInfo = (IP_ADAPTER_INFO *)
realloc(pAdapterInfo, ulOutBufLen);
240 if (pAdapterInfo ==
NULL) {
243 dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen);
246 if (dwRetVal == NO_ERROR) {
247 for (pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) {
248 for (pAddress = &pAdapterInfo->IpAddressList; pAddress; pAddress = pAddress->Next) {
249 if (count < maxcount) {
250 addresses[
count].
host = inet_addr(pAddress->IpAddress.String);
262 #if !defined(WITHOUT_SDL) && !SDL_DATA_ALIGNED
264 #undef SDLNet_Write16
265 #undef SDLNet_Write32
static int SDLNet_started
DECLSPEC void SDLCALL SDLNet_SetError(const char *fmt,...)
#define SDLNet_Write16(value, areap)
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
DECLSPEC int SDLCALL SDLNet_Init(void)
int SDLNet_GetLastError(void)
#define SDLNet_Write32(value, areap)
#define SDL_NET_VERSION(X)
DECLSPEC const char *SDLCALL SDL_GetError(void)
static char errorbuf[1024]
DECLSPEC const SDLNet_version *SDLCALL SDLNet_Linked_Version(void)
uint32_t Uint32
An unsigned 32-bit integer type.
Information the version of SDL in use.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLuint64EXT address
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
#define SDLNet_Read32(areap)
DECLSPEC const char *SDLCALL SDLNet_ResolveIP(const IPaddress *ip)
DECLSPEC void SDLCALL SDLNet_Quit(void)
DECLSPEC int SDLCALL SDLNet_GetLocalAddresses(IPaddress *addresses, int maxcount)
DECLSPEC int SDLCALL SDLNet_ResolveHost(IPaddress *address, const char *host, Uint16 port)
EGLSurface EGLint void ** value
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
uint16_t Uint16
An unsigned 16-bit integer type.
void SDLNet_SetLastError(int err)
#define SDLNet_Read16(areap)
DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap)
DECLSPEC const char *SDLCALL SDLNet_GetError(void)