Bug 807492 Part 11 - Support WebRTC on BSD in network modules rtp/udp r=jesup

This commit is contained in:
Landry Breuil 2013-06-13 08:54:56 +02:00
parent 6c71245af0
commit ea3378d097
4 changed files with 19 additions and 16 deletions

View File

@ -12,6 +12,7 @@
#include <algorithm>
#include <cassert>
#include <cstdlib> // for abs()
#include <cstring>
#include <iterator>

View File

@ -18,7 +18,7 @@
#include <Windows.h> // FILETIME
#include <WinSock.h> // timeval
#include <MMSystem.h> // timeGetTime
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
#include <sys/time.h> // gettimeofday
#include <time.h>
#endif
@ -156,7 +156,7 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) {
WindowsHelpTimer* _helpTimer;
};
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
// A clock reading times from the POSIX API.
class UnixSystemClock : public RtpRtcpClock {
@ -214,7 +214,7 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs,
frac = (WebRtc_UWord32)dtemp;
}
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
WebRtc_Word64 UnixSystemClock::GetTimeInMS() {
return TickTime::MillisecondTimestamp();
@ -253,7 +253,7 @@ static WindowsHelpTimer global_help_timer = {0, 0, {{ 0, 0}, 0}, 0};
RtpRtcpClock* GetSystemClock() {
#if defined(_WIN32)
return new WindowsSystemClock(&global_help_timer);
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
return new UnixSystemClock();
#else
return NULL;
@ -330,7 +330,7 @@ bool StringCompare(const char* str1, const char* str2,
const WebRtc_UWord32 length) {
return (_strnicmp(str1, str2, length) == 0) ? true : false;
}
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
bool StringCompare(const char* str1, const char* str2,
const WebRtc_UWord32 length) {
return (strncasecmp(str1, str2, length) == 0) ? true : false;

View File

@ -18,16 +18,16 @@
#if defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
#include <arpa/inet.h>
#include <ctype.h>
#include <fcntl.h>
#include <netdb.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef WEBRTC_IOS
@ -36,9 +36,11 @@
#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#if defined(WEBRTC_MAC)
#include <ifaddrs.h>
#include <machine/types.h>
#endif
#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
#include <ifaddrs.h>
#endif
#if defined(WEBRTC_LINUX)
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
@ -51,7 +53,7 @@
#include "typedefs.h"
#include "udp_socket_manager_wrapper.h"
#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
#define GetLastError() errno
#define IFRSIZE ((int)(size * sizeof (struct ifreq)))
@ -61,7 +63,7 @@
(int)(nlh)->nlmsg_len >= (int)sizeof(struct nlmsghdr) && \
(int)(nlh)->nlmsg_len <= (len))
#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
namespace webrtc {
@ -2371,7 +2373,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af,
const char* src,
void* dst)
{
#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
const WebRtc_Word32 result = inet_pton(af, src, dst);
return result > 0 ? 0 : -1;
@ -2493,7 +2495,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16])
"getaddrinfo failed to find address");
return -1;
#elif defined(WEBRTC_MAC)
#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
struct ifaddrs* ptrIfAddrs = NULL;
struct ifaddrs* ptrIfAddrsStart = NULL;
@ -2685,7 +2687,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP)
"gethostbyname failed, error:%d", error);
return -1;
}
#elif (defined(WEBRTC_MAC))
#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC))
char localname[255];
if (gethostname(localname, 255) != -1)
{
@ -2824,7 +2826,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address,
sourcePort = htons(source_port);
return 0;
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family;
const void* ptrNumericIP = NULL;

View File

@ -19,7 +19,7 @@
#if defined(_WIN32)
#include <Windows.h>
#include <mmsystem.h>
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
#include <string.h>
#include <sys/time.h>
#include <time.h>
@ -238,7 +238,7 @@ inline WebRtc_UWord32 RtpDumpImpl::GetTimeInMS() const
{
#if defined(_WIN32)
return timeGetTime();
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
struct timeval tv;
struct timezone tz;
unsigned long val;