C# 클래스 SnmpSharpNet.IpAddress

상속: OctetString, IComparable, ICloneable
파일 보기 프로젝트 열기: griffina/SnmpSharpNet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
ClassA int
ClassB int
ClassC int
ClassD int
ClassE int
InvalidClass int

공개 메소드들

메소드 설명
BuildMaskFromBits ( int bits ) : IpAddress

Build a subnet mask from bit count value

Clone ( ) : Object

Clone current object.

CompareTo ( object obj ) : int

Compare value against IPAddress, byte array, UInt32, IpAddress of OctetString class value.

Equals ( object obj ) : bool

Compare 2 IpAddress objects.

GetBroadcastAddress ( IpAddress mask ) : IpAddress

Returns broadcast address for the objects IP and supplied subnet mask. Subnet mask validity is not confirmed before performing the new value calculation so you should make sure parameter is a valid subnet mask by using IpAddress.IsValidMask method. Broadcast address is calculated by changing every bit in the subnet mask that is set to value 0 into 1 in the address value.

GetClass ( ) : int

Return network class of the IP address

GetHashCode ( ) : int

Return hash representing the value of this object

GetMaskBits ( ) : int

Returns number of subnet bits in the mask. Subnet bits are bits set to value 0 in the subnet mask.

GetSubnetAddress ( IpAddress mask ) : IpAddress

Return subnet address of the IP address in this object and supplied subnet mask

Increment ( UInt32 count ) : IpAddress

Increment IP address contained in the object by specific number and return the result as a new class.

Invert ( ) : IpAddress

Inverts IP address value. All 0s are converted to 1s and 1s to 0s

IpAddress ( ) : System

Constructs a default object with a length of zero. See the super class constructor for more details.

IpAddress ( IpAddress second ) : System

Copy constructor. Constructs a duplicate object based on the passed application string object.

IpAddress ( OctetString second ) : System

Copy constructor.

IpAddress ( System inetAddr ) : System

Constructor

Construct the IpAddress class from supplied IPAddress value.

IpAddress ( UInt32 inetAddr ) : System

Constructor

Initialize IpAddress class with the IP address value represented as 32-bit unsigned integer value

IpAddress ( byte data ) : System

Constructs an Application String with the passed data. The data is managed by the base class.

IpAddress ( string inetAddr ) : System

Constructs the class and initializes the value to the supplied IP address. See comments in IpAddress.Set(string) method for details.

IsIP ( string val ) : bool

Check if supplied string contains a valid IP address. Valid IP address contains 3 full stops (".") and 4 numeric values in range 0 to 255.

Written to address slow performance of IPAddress.TryParse

IsValidMask ( ) : bool

Checks if the value of the object is a valid subnet mask. Subnet mask is a value of consecutive bits with value of 1. If a bit is found with a value of 0 followed (immediately or anywhere else before the end of the value) by a 1, then subnet mask value is not valid.

NetworkMask ( ) : IpAddress

Returns network mask for the class value

Each IpAddress belongs to one of the 5 classes, A, B, C, D or E. D network class are multicast addresses and E is experimental class. Because D and E are not "real" network classes and as such don't have a network mask, only classes A, B and C will return a valid subnet mask. Classes D and E will return a null reference.

ReverseByteOrder ( uint val ) : uint

Reverse int value byte order. Static function in IPAddress class doesn't work the way I expected it (didn't troubleshoot) so here is another implementation. Reversing byte order is needed because network encoded IP address is presented in big-endian format. Intel based computers encode values in little-endian form so to perform numerical operations on received IP address values you will need to convert them from big to little-endian format. By the same token, if you wish to transmit data using IP address value calculated on the local system, you will need to convert it to big-endian prior to transmission.

Set ( IPAddress ipaddr ) : void

Set class value from the IPAddress argument

Set ( String value ) : void

Sets the class value to the IP address parsed from the string parameter.

Class value will be set with the parsed dotted decimal IP address in the parameter or if string parameter does not represent an IP address, DNS resolution will be performed. Note: DNS resolution is performed using System.Net.Dns.GetHostEntry(string) and can result in a longer then expected delay in this function. In applications where responsiveness is important, name resolution should be performed using async methods available and result passed to this method.

Set ( UInt32 ipvalue ) : void

Set class value from 32-bit unsigned integer value representation of the IP address value

ToString ( ) : System.String

Returns the application string as a dotted decimal represented IP address.

ToUInt32 ( ) : UInt32

Network byte order IP address

Convert internal byte array representation of the IP address into a network byte order (most significant byte first) unsigned integer value. To use the returned value in mathematical operations, you will need to change it to host byte order on little endian systems (all i386 compatible systems). To do that, call static method IpAddress.ReverseByteOrder().

decode ( byte buffer, int offset ) : int

Decode ASN.1 encoded IP address value.

메소드 상세

BuildMaskFromBits() 공개 정적인 메소드

Build a subnet mask from bit count value
public static BuildMaskFromBits ( int bits ) : IpAddress
bits int Number of subnet mask bits
리턴 IpAddress

Clone() 공개 메소드

Clone current object.
public Clone ( ) : Object
리턴 System.Object

CompareTo() 공개 메소드

Compare value against IPAddress, byte array, UInt32, IpAddress of OctetString class value.
public CompareTo ( object obj ) : int
obj object Type: or byte or or or
리턴 int

Equals() 공개 메소드

Compare 2 IpAddress objects.
public Equals ( object obj ) : bool
obj object object to compare against
리턴 bool

GetBroadcastAddress() 공개 메소드

Returns broadcast address for the objects IP and supplied subnet mask. Subnet mask validity is not confirmed before performing the new value calculation so you should make sure parameter is a valid subnet mask by using IpAddress.IsValidMask method. Broadcast address is calculated by changing every bit in the subnet mask that is set to value 0 into 1 in the address value.
public GetBroadcastAddress ( IpAddress mask ) : IpAddress
mask IpAddress Subnet mask to apply to the object
리턴 IpAddress

GetClass() 공개 메소드

Return network class of the IP address
public GetClass ( ) : int
리턴 int

GetHashCode() 공개 메소드

Return hash representing the value of this object
public GetHashCode ( ) : int
리턴 int

GetMaskBits() 공개 메소드

Returns number of subnet bits in the mask. Subnet bits are bits set to value 0 in the subnet mask.
public GetMaskBits ( ) : int
리턴 int

GetSubnetAddress() 공개 메소드

Return subnet address of the IP address in this object and supplied subnet mask
public GetSubnetAddress ( IpAddress mask ) : IpAddress
mask IpAddress Subnet mask
리턴 IpAddress

Increment() 공개 메소드

Increment IP address contained in the object by specific number and return the result as a new class.
public Increment ( UInt32 count ) : IpAddress
count System.UInt32 Number to increment IP address with
리턴 IpAddress

Invert() 공개 메소드

Inverts IP address value. All 0s are converted to 1s and 1s to 0s
public Invert ( ) : IpAddress
리턴 IpAddress

IpAddress() 공개 메소드

Constructs a default object with a length of zero. See the super class constructor for more details.
public IpAddress ( ) : System
리턴 System

IpAddress() 공개 메소드

Copy constructor. Constructs a duplicate object based on the passed application string object.
IpAddress argument is null
public IpAddress ( IpAddress second ) : System
second IpAddress The object to copy.
리턴 System

IpAddress() 공개 메소드

Copy constructor.
public IpAddress ( OctetString second ) : System
second OctetString The object to copy
리턴 System

IpAddress() 공개 메소드

Constructor
Construct the IpAddress class from supplied IPAddress value.
public IpAddress ( System inetAddr ) : System
inetAddr System IP Address to use to initialize the object.
리턴 System

IpAddress() 공개 메소드

Constructor
Initialize IpAddress class with the IP address value represented as 32-bit unsigned integer value
public IpAddress ( UInt32 inetAddr ) : System
inetAddr System.UInt32 32-bit unsigned integer representation of an IP Address
리턴 System

IpAddress() 공개 메소드

Constructs an Application String with the passed data. The data is managed by the base class.
public IpAddress ( byte data ) : System
data byte The application string to manage (UTF-8) ///
리턴 System

IpAddress() 공개 메소드

Constructs the class and initializes the value to the supplied IP address. See comments in IpAddress.Set(string) method for details.
public IpAddress ( string inetAddr ) : System
inetAddr string IP address encoded as a string or host name
리턴 System

IsIP() 공개 정적인 메소드

Check if supplied string contains a valid IP address. Valid IP address contains 3 full stops (".") and 4 numeric values in range 0 to 255.
Written to address slow performance of IPAddress.TryParse
public static IsIP ( string val ) : bool
val string String value
리턴 bool

IsValidMask() 공개 메소드

Checks if the value of the object is a valid subnet mask. Subnet mask is a value of consecutive bits with value of 1. If a bit is found with a value of 0 followed (immediately or anywhere else before the end of the value) by a 1, then subnet mask value is not valid.
public IsValidMask ( ) : bool
리턴 bool

NetworkMask() 공개 메소드

Returns network mask for the class value
Each IpAddress belongs to one of the 5 classes, A, B, C, D or E. D network class are multicast addresses and E is experimental class. Because D and E are not "real" network classes and as such don't have a network mask, only classes A, B and C will return a valid subnet mask. Classes D and E will return a null reference.
public NetworkMask ( ) : IpAddress
리턴 IpAddress

ReverseByteOrder() 공개 정적인 메소드

Reverse int value byte order. Static function in IPAddress class doesn't work the way I expected it (didn't troubleshoot) so here is another implementation. Reversing byte order is needed because network encoded IP address is presented in big-endian format. Intel based computers encode values in little-endian form so to perform numerical operations on received IP address values you will need to convert them from big to little-endian format. By the same token, if you wish to transmit data using IP address value calculated on the local system, you will need to convert it to big-endian prior to transmission.
public static ReverseByteOrder ( uint val ) : uint
val uint Integer value to reverse
리턴 uint

Set() 공개 메소드

Set class value from the IPAddress argument
public Set ( IPAddress ipaddr ) : void
ipaddr System.Net.IPAddress Type: class instance
리턴 void

Set() 공개 메소드

Sets the class value to the IP address parsed from the string parameter.
Class value will be set with the parsed dotted decimal IP address in the parameter or if string parameter does not represent an IP address, DNS resolution will be performed. Note: DNS resolution is performed using System.Net.Dns.GetHostEntry(string) and can result in a longer then expected delay in this function. In applications where responsiveness is important, name resolution should be performed using async methods available and result passed to this method.
Thrown when DNS resolution of the parameter value has failed.
public Set ( String value ) : void
value String IP address encoded as a string or host name
리턴 void

Set() 공개 메소드

Set class value from 32-bit unsigned integer value representation of the IP address value
public Set ( UInt32 ipvalue ) : void
ipvalue System.UInt32 IP address value as 32-bit unsigned integer value
리턴 void

ToString() 공개 메소드

Returns the application string as a dotted decimal represented IP address.
public ToString ( ) : System.String
리턴 System.String

ToUInt32() 공개 메소드

Network byte order IP address
Convert internal byte array representation of the IP address into a network byte order (most significant byte first) unsigned integer value. To use the returned value in mathematical operations, you will need to change it to host byte order on little endian systems (all i386 compatible systems). To do that, call static method IpAddress.ReverseByteOrder().
public ToUInt32 ( ) : UInt32
리턴 System.UInt32

decode() 공개 메소드

Decode ASN.1 encoded IP address value.
Parsed data length is not 4 bytes long Parsed data is not in IpAddress format
public decode ( byte buffer, int offset ) : int
buffer byte BER encoded data buffer
offset int Offset in the array to start parsing from
리턴 int

프로퍼티 상세

ClassA 공개적으로 정적으로 프로퍼티

Class A IP address
public static int ClassA
리턴 int

ClassB 공개적으로 정적으로 프로퍼티

Class B IP address
public static int ClassB
리턴 int

ClassC 공개적으로 정적으로 프로퍼티

Class C IP address
public static int ClassC
리턴 int

ClassD 공개적으로 정적으로 프로퍼티

Class D IP address
public static int ClassD
리턴 int

ClassE 공개적으로 정적으로 프로퍼티

Class E IP address
public static int ClassE
리턴 int

InvalidClass 공개적으로 정적으로 프로퍼티

Invalid IP address class
public static int InvalidClass
리턴 int