C# Class NetworkCommsDotNet.Tools.IPRange

A class that encapsulates an IPv4 or IPv6 range. Used for checking if an IPAddress is within an IPRange.
Afficher le fichier Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Private Properties

Свойство Type Description
IPRange System
RecursivePopulate void

Méthodes publiques

Méthode Description
AllAddressesBetween ( IPAddress firstAddress, IPAddress lastAddress ) : List

Returns all IPAddresses that are between the provided addresses

AllAddressesInRange ( ) : List

Returns a list of all IPAddresses in the specified range

Contains ( IEnumerable ranges, IPAddress ipAddress ) : bool

Returns true if the provided IPAddress is within one of the provided IPRanges, otherwise false

Contains ( IPAddress ipAddress ) : bool

Returns true if this IPRange contains the provided IPAddress

Contains ( byte ipAddressBytes ) : bool

Returns true if this IPRange contains the provided IPAddress bytes

Contains ( string ipAddressStr ) : bool

Returns true if this IPRange contains the provided IPAddress

IPRange ( IPAddress address, IPAddress subnetmask ) : System

Initialise an IPRange using the provided address and subnet mask.

IPRange ( string rangeCIDR ) : System

Initialise an IPRange using the provided CIDR notation.

IsAutoAssignedAddress ( IPAddress ipAddress ) : bool

Returns true if the provided IPAddress is within one of the autoassigned ip ranges, otherwise false

ToString ( ) : string

Returns a clean ToString of the IPRange

Private Methods

Méthode Description
IPRange ( ) : System
RecursivePopulate ( byte firstAddressBytes, byte lastAddressBytes, byte knownBytes, List result ) : void

Recursively populates the result list by looping over all address byte levels

Method Details

AllAddressesBetween() public static méthode

Returns all IPAddresses that are between the provided addresses
public static AllAddressesBetween ( IPAddress firstAddress, IPAddress lastAddress ) : List
firstAddress IPAddress
lastAddress IPAddress
Résultat List

AllAddressesInRange() public méthode

Returns a list of all IPAddresses in the specified range
public AllAddressesInRange ( ) : List
Résultat List

Contains() public static méthode

Returns true if the provided IPAddress is within one of the provided IPRanges, otherwise false
public static Contains ( IEnumerable ranges, IPAddress ipAddress ) : bool
ranges IEnumerable The ranges to search
ipAddress IPAddress The IPAddress to find in ranges
Résultat bool

Contains() public méthode

Returns true if this IPRange contains the provided IPAddress
public Contains ( IPAddress ipAddress ) : bool
ipAddress IPAddress The IPAddress to check
Résultat bool

Contains() public méthode

Returns true if this IPRange contains the provided IPAddress bytes
public Contains ( byte ipAddressBytes ) : bool
ipAddressBytes byte The IPAddress bytes to check
Résultat bool

Contains() public méthode

Returns true if this IPRange contains the provided IPAddress
public Contains ( string ipAddressStr ) : bool
ipAddressStr string The IPAddress to check
Résultat bool

IPRange() public méthode

Initialise an IPRange using the provided address and subnet mask.
public IPRange ( IPAddress address, IPAddress subnetmask ) : System
address IPAddress The address range to create
subnetmask IPAddress The subnet mask that specifies the network-identifying portion of the address
Résultat System

IPRange() public méthode

Initialise an IPRange using the provided CIDR notation.
public IPRange ( string rangeCIDR ) : System
rangeCIDR string IP range using CIDR notation, e.g. "192.168.1.0/24" contains 192.168.1.0 to 192.168.1.255
Résultat System

IsAutoAssignedAddress() public static méthode

Returns true if the provided IPAddress is within one of the autoassigned ip ranges, otherwise false
public static IsAutoAssignedAddress ( IPAddress ipAddress ) : bool
ipAddress IPAddress The IPAddress to find in ranges
Résultat bool

ToString() public méthode

Returns a clean ToString of the IPRange
public ToString ( ) : string
Résultat string