Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / netwerk / base / IPv4Parser.h
blob0325d07d2eedc7acfe904b8a261ecbfe15bb4cff
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_net_IPv4Parser_h
7 #define mozilla_net_IPv4Parser_h
9 #include "nsString.h"
11 namespace mozilla::net::IPv4Parser {
13 bool EndsInANumber(const nsCString& input);
14 nsresult NormalizeIPv4(const nsACString& host, nsCString& result);
16 nsresult ParseIPv4Number(const nsACString& input, int32_t base,
17 uint32_t& number, uint32_t maxNumber);
18 int32_t ValidateIPv4Number(const nsACString& host, int32_t bases[4],
19 int32_t dotIndex[3], bool& onlyBase10,
20 int32_t length, bool trailingDot);
22 bool ContainsOnlyAsciiDigits(const nsDependentCSubstring& input);
23 bool ContainsOnlyAsciiHexDigits(const nsDependentCSubstring& input);
24 nsresult ParseIPv4Number10(const nsACString& input, uint32_t& number,
25 uint32_t maxNumber);
26 } // namespace mozilla::net::IPv4Parser
28 #endif // mozilla_net_IPv4Parser_h