C# Class fCraft.IPAddressUtil

Provides utility methods for working with IP addresses and ranges.
Mostrar archivo Open project: fragmer/fCraft Class Usage Examples

Public Methods

Method Description
AsInt ( [ thisAddr ) : int

Represents an IPv4 address as a signed integer.

AsUInt ( [ thisAddr ) : uint

Represents an IPv4 address as an unsigned integer.

IsIP ( [ ipString ) : bool

Checks to see if the specified string is a valid IPv4 address.

IsLocal ( [ addr ) : bool

Checks whether an IP address may belong to LAN or localhost (192.168.0.0/16, 10.0.0.0/24, or 127.0.0.0/24).

Match ( [ thisAddr, uint otherAddr, uint mask ) : bool
NetMask ( byte range ) : uint

Creates an IPv4 mask for the given CIDR range.

Private Methods

Method Description
RangeMax ( [ thisAddr, byte range ) : IPAddress
RangeMin ( [ thisAddr, byte range ) : IPAddress

Method Details

AsInt() public static method

Represents an IPv4 address as a signed integer.
thisAddr is null.
public static AsInt ( [ thisAddr ) : int
thisAddr [
return int

AsUInt() public static method

Represents an IPv4 address as an unsigned integer.
thisAddr is null.
public static AsUInt ( [ thisAddr ) : uint
thisAddr [
return uint

IsIP() public static method

Checks to see if the specified string is a valid IPv4 address.
public static IsIP ( [ ipString ) : bool
ipString [ String representation of the IPv4 address.
return bool

IsLocal() public static method

Checks whether an IP address may belong to LAN or localhost (192.168.0.0/16, 10.0.0.0/24, or 127.0.0.0/24).
addr is null.
public static IsLocal ( [ addr ) : bool
addr [ IPv4 address to check.
return bool

Match() public static method

public static Match ( [ thisAddr, uint otherAddr, uint mask ) : bool
thisAddr [
otherAddr uint
mask uint
return bool

NetMask() public static method

Creates an IPv4 mask for the given CIDR range.
range is over 32
public static NetMask ( byte range ) : uint
range byte
return uint