OpenShot Audio Library | OpenShotAudio  0.3.0
juce_IPAddress.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
21 */
22 
23 namespace juce
24 {
25 
26 //==============================================================================
32 class JUCE_API IPAddress final
33 {
34 public:
35  //==============================================================================
37  static IPAddress any() noexcept;
38 
40  static IPAddress broadcast() noexcept;
41 
43  static IPAddress local (bool IPv6 = false) noexcept;
44 
45  //==============================================================================
47  static void findAllAddresses (Array<IPAddress>& results, bool includeIPv6 = false);
48 
50  static Array<IPAddress> getAllAddresses (bool includeIPv6 = false);
51 
58  static IPAddress getLocalAddress (bool includeIPv6 = false);
59 
60  //==============================================================================
62  IPAddress() noexcept;
63 
68  explicit IPAddress (const uint8* bytes, bool IPv6 = false) noexcept;
69 
73  explicit IPAddress (const uint16* bytes) noexcept;
74 
76  IPAddress (uint8 address1, uint8 address2, uint8 address3, uint8 address4) noexcept;
77 
79  IPAddress (uint16 address1, uint16 address2, uint16 address3, uint16 address4,
80  uint16 address5, uint16 address6, uint16 address7, uint16 address8) noexcept;
81 
85  explicit IPAddress (uint32 asNativeEndian32Bit) noexcept;
86 
88  explicit IPAddress (const String& address);
89 
91  bool isNull() const;
92 
93  //==============================================================================
95  String toString() const;
96 
102  int compare (const IPAddress&) const noexcept;
103 
104  bool operator== (const IPAddress&) const noexcept;
105  bool operator!= (const IPAddress&) const noexcept;
106  bool operator< (const IPAddress&) const noexcept;
107  bool operator> (const IPAddress&) const noexcept;
108  bool operator<= (const IPAddress&) const noexcept;
109  bool operator>= (const IPAddress&) const noexcept;
110 
111  //==============================================================================
113  uint8 address[16];
114 
115  bool isIPv6 = false;
116 
117  //==============================================================================
123  static String getFormattedAddress (const String& unformattedAddress);
124 
126  static bool isIPv4MappedAddress (const IPAddress& mappedAddress);
127 
131  static IPAddress convertIPv4MappedAddressToIPv4 (const IPAddress& mappedAddress);
132 
134  static IPAddress convertIPv4AddressToIPv4Mapped (const IPAddress& addressToMap);
135 
139  static IPAddress getInterfaceBroadcastAddress (const IPAddress& interfaceAddress);
140 };
141 
142 } // namespace juce