Procedure TIP._SetIP(
IP: LongInt);
Begin
_IP.L :=
IP;
End;
Function TIP._GetIP: LongInt;
Begin
Result := _IP.L;
End;
Procedure TIP._SetIPx(
Index: Integer; IPx: Byte);
Begin
_IP.B[3 -
Index] := IPx;
End;
Function TIP._GetIPx(
Index: Integer): Byte;
Begin
Result := _IP.B[3 -
Index];
End;
Class Operator TIP.Implicit(Value: LongInt): TIP;
Begin
Result._IP.L := Value;
End;
Class Operator TIP.Implicit(Value:
String): TIP;
Var i, i2, i3, i4: Integer;
Begin
i := 3;
Repeat
i2 := Pos('
.', Value) - 1;
If i2 < 0
Then i2 := 99;
Val(Copy(Value, 1, i2), i3, i4);
If i4 <> 0
Then i3 := 0;
Result._IP.B[i] := i3;
Delete(Value, 1, i2 + 1);
Dec(i);
Until i < 0;
End;
Class Operator TIP.Implicit(Rec: TIP): LongInt;
Begin
Result := Rec._IP.L;
End;
Class Operator TIP.Implicit(Rec: TIP):
String;
Var i: Integer;
S:
Array[0..3]
of String;
Begin
For i := 3
downto 0
do Str(Rec._IP.B[i], S[i]);
Result := S[3] + '
.' + S[2] + '
.' + S[1] + '
.' + S[0];
End;
Class Operator TIP.Equal(Left, Right: LongInt): Boolean;
Begin
Result := Left = Right;
End;
Class Operator TIP.NotEqual(Left, Right: LongInt): Boolean;
Begin
Result := Left <> Right;
End;
Class Operator TIP.LessThanOrEqual(Left, Right: LongInt): Boolean;
Begin
Result := ByteSwap(Left) <= ByteSwap(Right);
End;
Class Operator TIP.LessThan(Left, Right: LongInt): Boolean;
Begin
Result := ByteSwap(Left) < ByteSwap(Right);
End;
Class Operator TIP.GreaterThan(Left, Right: LongInt): Boolean;
Begin
Result := ByteSwap(Left) > ByteSwap(Right);
End;
Class Operator TIP.GreaterThanOrEqual(Left, Right: LongInt): Boolean;
Begin
Result := ByteSwap(Left) >= ByteSwap(Right);
End;
Function MAKEIPRANGE(Low, High: BYTE): DWORD;
Begin
Result := (LongInt(High)
shl 8)
or low;
End;
Function MAKEIPADDRESS(B1, B2, B3, B4: BYTE): DWORD;
Begin
Result := ((((((LongInt(B1)
shl 8)
or B2)
shl 8)
or B3)
shl 8)
or B4);
End;
Function FIRST_IPADDRESS(X: DWORD): BYTE;
Begin
Result := x
shr 24;
End;
Function SECOND_IPADDRESS(X: DWORD): BYTE;
Begin
Result := x
shr 16;
End;
Function THIRD_IPADDRESS(X: DWORD): BYTE;
Begin
Result := x
shr 8;
End;
Function FOURTH_IPADDRESS(X: DWORD): BYTE;
Begin
Result := x;
End;