tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

IPv4Parser.h (1183B)


      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/. */
      5 
      6 #ifndef mozilla_net_IPv4Parser_h
      7 #define mozilla_net_IPv4Parser_h
      8 
      9 #include "nsString.h"
     10 
     11 namespace mozilla::net::IPv4Parser {
     12 
     13 bool EndsInANumber(const nsCString& input);
     14 nsresult NormalizeIPv4(const nsACString& host, nsCString& result);
     15 
     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);
     21 
     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
     27 
     28 #endif  // mozilla_net_IPv4Parser_h