00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00037 #ifndef RTPIPV6ADDRESS_H
00038
00039 #define RTPIPV6ADDRESS_H
00040
00041 #include "rtpconfig.h"
00042
00043 #ifdef RTP_SUPPORT_IPV6
00044
00045 #include "rtpaddress.h"
00046 #include "rtptypes.h"
00047 #if ! (defined(WIN32) || defined(_WIN32_WCE))
00048 #include <netinet/in.h>
00049 #endif // WIN32
00050
00058 class RTPIPv6Address : public RTPAddress
00059 {
00060 public:
00062 RTPIPv6Address():RTPAddress(IPv6Address) { for (int i = 0 ; i < 16 ; i++) ip.s6_addr[i] = 0; port = 0; }
00063
00066 RTPIPv6Address(const uint8_t ip[16],uint16_t port = 0):RTPAddress(IPv6Address) { SetIP(ip); RTPIPv6Address::port = port; }
00067
00070 RTPIPv6Address(in6_addr ip,uint16_t port = 0):RTPAddress(IPv6Address) { RTPIPv6Address::ip = ip; RTPIPv6Address::port = port; }
00071 ~RTPIPv6Address() { }
00072
00074 void SetIP(in6_addr ip) { RTPIPv6Address::ip = ip; }
00075
00077 void SetIP(const uint8_t ip[16]) { for (int i = 0 ; i < 16 ; i++) RTPIPv6Address::ip.s6_addr[i] = ip[i]; }
00078
00080 void SetPort(uint16_t port) { RTPIPv6Address::port = port; }
00081
00083 void GetIP(uint8_t ip[16]) const { for (int i = 0 ; i < 16 ; i++) ip[i] = RTPIPv6Address::ip.s6_addr[i]; }
00084
00086 in6_addr GetIP() const { return ip; }
00087
00089 uint16_t GetPort() const { return port; }
00090
00091 RTPAddress *CreateCopy(RTPMemoryManager *mgr) const;
00092 bool IsSameAddress(const RTPAddress *addr) const;
00093 bool IsFromSameHost(const RTPAddress *addr) const;
00094 #ifdef RTPDEBUG
00095 std::string GetAddressString() const;
00096 #endif // RTPDEBUG
00097 private:
00098 in6_addr ip;
00099 uint16_t port;
00100 };
00101
00102 #endif // RTP_SUPPORT_IPV6
00103
00104 #endif // RTPIPV6ADDRESS_H
00105