1af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org/*
2af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *
4af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  Use of this source code is governed by a BSD-style license
5af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  that can be found in the LICENSE file in the root of the source
6af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  tree. An additional intellectual property rights grant can be found
7af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  in the file PATENTS.  All contributing project authors may
8af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org */
10af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
11af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#ifndef WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_TRANSPORT_H_
12af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#define WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_TRANSPORT_H_
13af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
14af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#include "webrtc/common_types.h"
15af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#include "webrtc/typedefs.h"
16af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
17af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org/*
18af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  WARNING
19af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  This code is not use in production/testing and might have security issues
20af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  for example: http://code.google.com/p/webrtc/issues/detail?id=1028
21af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *
22af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org */
23af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
24af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#define SS_MAXSIZE 128
2591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org#define SS_ALIGNSIZE (sizeof (uint64_t))
2691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org#define SS_PAD1SIZE  (SS_ALIGNSIZE - sizeof(int16_t))
2791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org#define SS_PAD2SIZE  (SS_MAXSIZE - (sizeof(int16_t) + SS_PAD1SIZE +\
28af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                    SS_ALIGNSIZE))
29af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
30af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org// BSD requires use of HAVE_STRUCT_SOCKADDR_SA_LEN
31af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgnamespace webrtc {
32af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgnamespace test {
33af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
34af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgstruct SocketAddressIn {
35af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
36af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
3791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t      sin_length;
3891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t      sin_family;
39af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#else
4091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int16_t     sin_family;
41af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#endif
4291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint16_t    sin_port;
4391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint32_t    sin_addr;
4491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t      sin_zero[8];
45af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
46af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
47af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgstruct Version6InAddress {
48af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  union {
4991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    uint8_t     _s6_u8[16];
5091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    uint32_t    _s6_u32[4];
5191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    uint64_t    _s6_u64[2];
52af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  } Version6AddressUnion;
53af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
54af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
55af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgstruct SocketAddressInVersion6 {
56af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
57af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
5891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t      sin_length;
5991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t      sin_family;
60af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#else
6191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int16_t     sin_family;
62af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#endif
63af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // Transport layer port number.
6491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint16_t sin6_port;
65af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // IPv6 traffic class and flow info or ip4 address.
6691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint32_t sin6_flowinfo;
67af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // IPv6 address
68af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  struct Version6InAddress sin6_addr;
69af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // Set of interfaces for a scope.
7091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint32_t sin6_scope_id;
71af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
72af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
73af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgstruct SocketAddressStorage {
74af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  // sin_family should be either AF_INET (IPv4) or AF_INET6 (IPv6)
75af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
7691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t   sin_length;
7791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t   sin_family;
78af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#else
7991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int16_t  sin_family;
80af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#endif
8191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t   __ss_pad1[SS_PAD1SIZE];
8291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  uint64_t __ss_align;
8391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  int8_t   __ss_pad2[SS_PAD2SIZE];
84af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
85af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
86af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgstruct SocketAddress {
87af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  union {
88af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    struct SocketAddressIn _sockaddr_in;
89af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    struct SocketAddressInVersion6 _sockaddr_in6;
90af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    struct SocketAddressStorage _sockaddr_storage;
91af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  };
92af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
93af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
94af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org// Callback class that receives packets from UdpTransport.
95af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgclass UdpTransportData {
96af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org public:
97af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org  virtual ~UdpTransportData()  {};
98af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
9991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket,
10091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                 const int32_t rtpPacketLength,
101af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                 const char* fromIP,
10291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                 const uint16_t fromPort) = 0;
103af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
10491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org  virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
10591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                  const int32_t rtcpPacketLength,
106af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                  const char* fromIP,
10791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                  const uint16_t fromPort) = 0;
108af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
109af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
110af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgclass UdpTransport : public Transport {
111af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org public:
112af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    enum
113af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
114af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kIpAddressVersion6Length = 64,
115af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kIpAddressVersion4Length = 16
116af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    };
117af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    enum ErrorCode
118af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
119af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kNoSocketError            = 0,
120af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kFailedToBindPort         = 1,
121af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kIpAddressInvalid         = 2,
122af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kAddressInvalid           = 3,
123af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kSocketInvalid            = 4,
124af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kPortInvalid              = 5,
125af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kTosInvalid               = 6,
126af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kMulticastAddressInvalid  = 7,
127af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kQosError                 = 8,
128af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kSocketAlreadyInitialized = 9,
129af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kIpVersion6Error          = 10,
130af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        FILTER_ERROR              = 11,
131af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kStartReceiveError        = 12,
132af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kStopReceiveError         = 13,
133af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kCannotFindLocalIp        = 14,
134af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kTosError                 = 16,
135af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kNotInitialized           = 17,
136af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        kPcpError                 = 18
137af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    };
138af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
139af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Factory method. Constructor disabled.
14091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static UdpTransport* Create(const int32_t id, uint8_t& numSocketThreads);
141af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    static void Destroy(UdpTransport* module);
142af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
143af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Prepares the class for sending RTP packets to ipAddr:rtpPort and RTCP
144af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // packets to ipAddr:rtpPort+1 if rtcpPort is zero. Otherwise to
145af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // ipAddr:rtcpPort.
14691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t InitializeSendSockets(const char* ipAddr,
14791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                          const uint16_t rtpPort,
14891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                          const uint16_t rtcpPort = 0) = 0;
149af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
150af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Register packetCallback for receiving incoming packets. Set the local
151af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // RTP port to rtpPort. Bind local IP address to ipAddr. If ipAddr is NULL
152af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // bind to local IP ANY. Set the local rtcp port to rtcpPort or rtpPort + 1
153af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // if rtcpPort is 0.
15491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t InitializeReceiveSockets(
155af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        UdpTransportData* const packetCallback,
15691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        const uint16_t rtpPort,
157af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        const char* ipAddr = NULL,
158af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        const char* multicastIpAddr = NULL,
15991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        const uint16_t rtcpPort = 0) = 0;
160af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
161af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set local RTP port to rtpPort and RTCP port to rtcpPort or rtpPort + 1 if
162af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // rtcpPort is 0. These ports will be used for sending instead of the local
163af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // ports set by InitializeReceiveSockets(..).
16491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t InitializeSourcePorts(const uint16_t rtpPort,
16591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                          const uint16_t rtcpPort = 0) = 0;
166af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
167af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Retrieve local ports used for sending if other than the ports specified
168af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // by InitializeReceiveSockets(..). rtpPort is set to the RTP port.
169af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // rtcpPort is set to the RTCP port.
17091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SourcePorts(uint16_t& rtpPort,
17191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                uint16_t& rtcpPort) const = 0;
172af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
173af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set ipAddr to the IP address that is currently being listened on. rtpPort
174af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // to the RTP port listened to. rtcpPort to the RTCP port listened on.
175af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // multicastIpAddr to the multicast IP address group joined (the address
176af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // is NULL terminated).
17791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t ReceiveSocketInformation(
178af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        char ipAddr[kIpAddressVersion6Length],
17991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        uint16_t& rtpPort,
18091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        uint16_t& rtcpPort,
181af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        char multicastIpAddr[kIpAddressVersion6Length]) const = 0;
182af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
183af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set ipAddr to the IP address being sent from. rtpPort to the local RTP
184af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // port used for sending and rtcpPort to the local RTCP port used for
185af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // sending.
18691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendSocketInformation(char ipAddr[kIpAddressVersion6Length],
18791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                          uint16_t& rtpPort,
18891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                          uint16_t& rtcpPort) const = 0;
189af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
190af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Put the IP address, RTP port and RTCP port from the last received packet
191af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // into ipAddr, rtpPort and rtcpPort respectively.
19291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t RemoteSocketInformation(
193af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        char ipAddr[kIpAddressVersion6Length],
19491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        uint16_t& rtpPort,
19591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org        uint16_t& rtcpPort) const = 0;
196af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
197af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Enable/disable quality of service if QoS is true or false respectively.
198af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set the type of service to serviceType, max bitrate in kbit/s to
199af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // maxBitrate and override DSCP if overrideDSCP is not 0.
200af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: Must be called both InitializeSendSockets() and
201af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // InitializeReceiveSockets() has been called.
20291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetQoS(const bool QoS,
20391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                           const int32_t serviceType,
20491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                           const uint32_t maxBitrate = 0,
20591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                           const int32_t overrideDSCP = 0,
20691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                           const bool audio = false) = 0;
207af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
208af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set QoS to true if quality of service has been turned on. If QoS is true,
209af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // also set serviceType to type of service and overrideDSCP to override
210af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // DSCP.
21191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t QoS(bool& QoS,
21291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                        int32_t& serviceType,
21391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                        int32_t& overrideDSCP) const = 0;
214af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
215af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set type of service.
21691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetToS(const int32_t DSCP,
21791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                           const bool useSetSockOpt = false) = 0;
218af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
219af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Get type of service configuration.
22091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t ToS(int32_t& DSCP,
22191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                        bool& useSetSockOpt) const = 0;
222af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
223af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set Priority Code Point (IEEE 802.1Q)
224af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: for Linux this function will set the priority for the socket,
225af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // which then can be mapped to a PCP value with vconfig.
22691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetPCP(const int32_t PCP) = 0;
227af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
228af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Get Priority Code Point
22991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t PCP(int32_t& PCP) const = 0;
230af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
231af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Enable IPv6.
232af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API must be called before any call to
233af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // InitializeReceiveSockets() or InitializeSendSockets(). It is not
234af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // possible to go back to IPv4 (default) after this call.
23591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t EnableIpV6() = 0;
236af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
237af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true if IPv6 has been enabled.
238af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual bool IpV6Enabled() const = 0;
239af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
240af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Only allow packets received from filterIPAddress to be processed.
241af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: must be called after EnableIPv6(), if IPv6 is used.
24291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetFilterIP(
243af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        const char filterIPAddress[kIpAddressVersion6Length]) = 0;
244af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
245af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Write the filter IP address (if any) to filterIPAddress.
24691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t FilterIP(
247af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        char filterIPAddress[kIpAddressVersion6Length]) const = 0;
248af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
249af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Only allow RTP packets from rtpFilterPort and RTCP packets from
250af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // rtcpFilterPort be processed.
251af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: must be called after EnableIPv6(), if IPv6 is used.
25291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetFilterPorts(const uint16_t rtpFilterPort,
25391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                   const uint16_t rtcpFilterPort) = 0;
254af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
255af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set rtpFilterPort to the filter RTP port and rtcpFilterPort to the
256af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // filter RTCP port (if filtering based on port is enabled).
25791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t FilterPorts(uint16_t& rtpFilterPort,
25891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                uint16_t& rtcpFilterPort) const = 0;
259af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
260af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set the number of buffers that the socket implementation may use for
261af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // receiving packets to numberOfSocketBuffers. I.e. the number of packets
262af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // that can be received in parallell.
263af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API only has effect on Windows.
26491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t StartReceiving(const uint32_t numberOfSocketBuffers) = 0;
265af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
266af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Stop receive incoming packets.
26791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t StopReceiving() = 0;
268af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
269af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true incoming packets are received.
270af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual bool Receiving() const = 0;
271af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
272af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true if send sockets have been initialized.
273af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual bool SendSocketsInitialized() const = 0;
274af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
275af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true if local ports for sending has been set.
276af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual bool SourcePortsInitialized() const = 0;
277af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
278af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true if receive sockets have been initialized.
279af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual bool ReceiveSocketsInitialized() const = 0;
280af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
281af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Send data with size length to ip:portnr. The same port as the set
282af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // with InitializeSendSockets(..) is used if portnr is 0. The same IP
283af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // address as set with InitializeSendSockets(..) is used if ip is NULL.
284af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // If isRTCP is true the port used will be the RTCP port.
28591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendRaw(const int8_t* data,
28691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                            uint32_t length,
28791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                            int32_t isRTCP,
28891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                            uint16_t portnr = 0,
28991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                            const char* ip = NULL) = 0;
290af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
291af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Send RTP data with size length to the address specified by to.
29291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendRTPPacketTo(const int8_t* data,
29391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    uint32_t length,
29491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    const SocketAddress& to) = 0;
295af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
296af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
297af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Send RTCP data with size length to the address specified by to.
29891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendRTCPPacketTo(const int8_t* data,
29991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                     uint32_t length,
30091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                     const SocketAddress& to) = 0;
301af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
302af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Send RTP data with size length to ip:rtpPort where ip is the ip set by
303af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // the InitializeSendSockets(..) call.
30491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendRTPPacketTo(const int8_t* data,
30591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    uint32_t length,
30691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    uint16_t rtpPort) = 0;
307af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
308af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
309af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Send RTCP data with size length to ip:rtcpPort where ip is the ip set by
310af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // the InitializeSendSockets(..) call.
31191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SendRTCPPacketTo(const int8_t* data,
31291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                     uint32_t length,
31391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                     uint16_t rtcpPort) = 0;
314af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
315af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set the IP address to which packets are sent to ipaddr.
31691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetSendIP(
317af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        const char ipaddr[kIpAddressVersion6Length]) = 0;
318af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
319af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set the send RTP and RTCP port to rtpPort and rtcpPort respectively.
32091cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t SetSendPorts(const uint16_t rtpPort,
32191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                 const uint16_t rtcpPort = 0) = 0;
322af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
323af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Retreive the last registered error code.
324af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    virtual ErrorCode LastError() const = 0;
325af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
326af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Put the local IPv4 address in localIP.
327af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API is for IPv4 only.
32891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static int32_t LocalHostAddress(uint32_t& localIP);
329af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
330af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Put the local IP6 address in localIP.
331af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API is for IPv6 only.
33291cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static int32_t LocalHostAddressIPV6(char localIP[16]);
333af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
334af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return a copy of hostOrder (host order) in network order.
33591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static uint16_t Htons(uint16_t hostOrder);
336af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
337af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return a copy of hostOrder (host order) in network order.
33891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static uint32_t Htonl(uint32_t hostOrder);
339af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
340af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return IPv4 address in ip as 32 bit integer.
34191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static uint32_t InetAddrIPV4(const char* ip);
342af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
343af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Convert the character string src into a network address structure in
344af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // the af address family and put it in dst.
345af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: same functionality as inet_pton(..)
34691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static int32_t InetPresentationToNumeric(int32_t af,
34791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                             const char* src,
34891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                             void* dst);
349af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
350af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set ip and sourcePort according to address. As input parameter ipSize
351af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // is the length of ip. As output parameter it's the number of characters
352af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // written to ip (not counting the '\0' character).
353af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API is only implemented on Windows and Linux.
35491cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    static int32_t IPAddress(const SocketAddress& address,
35591cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                             char* ip,
35691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                             uint32_t& ipSize,
35791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                             uint16_t& sourcePort);
358af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
359af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Set ip and sourcePort according to address. As input parameter ipSize
360af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // is the length of ip. As output parameter it's the number of characters
361af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // written to ip (not counting the '\0' character).
362af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Note: this API is only implemented on Windows and Linux.
363af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Additional note: this API caches the address of the last call to it. If
364af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // address is likley to be the same for multiple calls it may be beneficial
365af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // to call this API instead of IPAddress().
36691cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    virtual int32_t IPAddressCached(const SocketAddress& address,
36791cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    char* ip,
36891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    uint32_t& ipSize,
36991cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org                                    uint16_t& sourcePort) = 0;
370af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
371af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // Return true if ipaddr is a valid IP address.
372af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // If ipV6 is false ipaddr is interpreted as an IPv4 address otherwise it
373af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    // is interptreted as IPv6.
374af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    static bool IsIpAddressValid(const char* ipaddr, const bool ipV6);
375af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org};
376af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
377af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}  // namespace test
378af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}  // namespace webrtc
379af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
380af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#endif  // WEBRTC_TEST_CHANNEL_TRANSPORT_UDP_TRANSPORT_H_
381