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