00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AVFORMAT_NETWORK_H
00022 #define AVFORMAT_NETWORK_H
00023
00024 #include "config.h"
00025
00026 #if HAVE_WINSOCK2_H
00027 #include <winsock2.h>
00028 #include <ws2tcpip.h>
00029
00030 #define ff_neterrno() WSAGetLastError()
00031 #define FF_NETERROR(err) WSA##err
00032 #define WSAEAGAIN WSAEWOULDBLOCK
00033 #else
00034 #include <sys/types.h>
00035 #include <sys/socket.h>
00036 #include <netinet/in.h>
00037 #include <netdb.h>
00038
00039 #define ff_neterrno() errno
00040 #define FF_NETERROR(err) err
00041 #endif
00042
00043 #if HAVE_ARPA_INET_H
00044 #include <arpa/inet.h>
00045 #endif
00046
00047 int ff_socket_nonblock(int socket, int enable);
00048
00049 static inline int ff_network_init(void)
00050 {
00051 #if HAVE_WINSOCK2_H
00052 WSADATA wsaData;
00053 if (WSAStartup(MAKEWORD(1,1), &wsaData))
00054 return 0;
00055 #endif
00056 return 1;
00057 }
00058
00059 static inline void ff_network_close(void)
00060 {
00061 #if HAVE_WINSOCK2_H
00062 WSACleanup();
00063 #endif
00064 }
00065
00066 #if !HAVE_INET_ATON
00067
00068 int inet_aton (const char * str, struct in_addr * add);
00069 #endif
00070
00071 #endif