Location:
in_sock.h
Link against: insock.lib
TInetAddr
Supported from 5.0
TCP/IP address.
This class specialises the generic socket server address class
TSockAddr
for the TCP/IP protocol family. The class stores an IP
address as a TUint32
in its buffer after the generic data defined
by TSockAddr
. The protocol family field provided by the
TSockAddr
base class is always set to KAfInet
(TCP/IP).
|
Defined in TInetAddr
:
Address()
, Cast()
, CmpAddr()
, Input()
, IsBroadcast()
, IsClassA()
, IsClassB()
, IsClassC()
, IsMulticast()
, IsWildAddr()
, IsWildPort()
, Match()
, Net()
, NetBroadcast()
, NetMask()
, Output()
, SetAddress()
, SubNet()
, SubNetBroadcast()
, TInetAddr()
Inherited from TBuf8
:
operator=()
Inherited from TDes8
:
Append()
,
AppendFill()
,
AppendFormat()
,
AppendFormatList()
,
AppendJustify()
,
AppendNum()
,
AppendNumFixedWidth()
,
AppendNumFixedWidthUC()
,
AppendNumUC()
,
Capitalize()
,
Collate()
,
Copy()
,
CopyC()
,
CopyCP()
,
CopyF()
,
CopyLC()
,
CopyUC()
,
Delete()
,
Fill()
,
FillZ()
,
Fold()
,
Format()
,
FormatList()
,
Insert()
,
Justify()
,
LowerCase()
,
MaxLength()
,
MaxSize()
,
Num()
,
NumFixedWidth()
,
NumFixedWidthUC()
,
NumUC()
,
PtrZ()
,
Repeat()
,
Replace()
,
SetLength()
,
SetMax()
,
Swap()
,
Trim()
,
TrimAll()
,
TrimLeft()
,
TrimRight()
,
UpperCase()
,
Zero()
,
ZeroTerminate()
,
operator+=()
,
operator=
,
operator[]()
Inherited from TDesC8
:
Alloc()
,
AllocL()
,
AllocLC()
,
Compare()
,
CompareC()
,
CompareF()
,
Find()
,
FindC()
,
FindF()
,
Left()
,
Length()
,
Locate()
,
LocateF()
,
LocateReverse()
,
LocateReverseF()
,
MatchC()
,
MatchF()
,
Mid()
,
Ptr()
,
Right()
,
Size()
,
operator!=()
,
operator<()
,
operator<=()
,
operator==()
,
operator>()
,
operator>=()
Inherited from TSockAddr
:
CmpPort()
,
Family()
,
GetUserLen()
,
Port()
,
SetFamily()
,
SetPort()
,
SetUserLen()
,
UserPtr()
TInetAddr();
Constructs a basic TInetAddr
. The port is
initialised to 0, and the IP address to KInetAddrNone
.
TInetAddr(TUint aPort);
Constructs a TInetAddr
and initialises the port to
the specified value, and the IP address to KInetAddrNone
.
|
TInetAddr(TUint32 anAddr, TUint aPort);
Constructs a TInetAddr
and initialise the specified
port value to and the IP address to anAddr
.
|
TInetAddr(const TSockAddr& anAddr);
Constructs a TInetAddr
from another
TInetAddr
that has been downcast to a TSockAddr
. The
port and IP address values are copied from anAddr
.
|
void SetAddress(TUint32 anAddr);
Sets the IP address value. An IP address in dotted-decimal form can be
converted into a TUint32
by the INET_ADDR
macro.
|
TUint32 Address() const;
Gets the IP address value.
|
TBool CmpAddr(const TInetAddr& anAddr) const;
Tests the protocol family, IP address, and port values with those in
another TInetAddr
.
|
|
TBool Match(const TInetAddr aHost) const;
Tests the IP address value with that in another
TInetAddr
.
|
|
TBool Match(const TInetAddr aNet, const TInetAddr aMask) const;
Tests if another TInetAddr
is in the same subnet. The
function applies the subnet mask passed through aMask
to the IP
address and to the IP address in aNet
. If the resulting values are
the same, this indicates that the addresses are part of the same subnet,
andETrue
is returned.
|
|
TInt Input(const TDesC& aBuf);
Sets the IP address from a string containing a representation of an IP address, such as might be entered in a dialog. The string must contain an ASCII representation of one of the following:
8-bit decimal + ‘.’ + 8-bit decimal + ‘.’ + 8-bit decimal + ‘.’ + 8-bit decimal, e.g. ‘192.168.40.4’.
8-bit decimal + ‘.’ + 8-bit decimal + ‘.’ + 16-bit decimal
8-bit decimal + ‘.’ + 24-bit decimal
32-bit decimal
32-bit hexadecimal, e.g. 0xaabbccdd
|
|
void Output(TDes &aBuf) const;
Writes the IP address into a string in dotted-decimal form.
|
void NetMask(const TInetAddr& aAddr);
Sets the IP address to a mask suitable for extracting the network number
part of the IP address. The function tests whether the IP address
inaAddr
is a Class A, B, C, or other address. It then sets the IP
address to suitable mask values as follows:
Class A addresses: mask 255.0.0.0
Class B addresses: mask 255.255.0.0
Class C addresses: mask 255.255.255.0
other addresses: mask 255.255.255.255
|
void Net(const TInetAddr& aAddr);
Obtains a network mask corresponding to the class of the IP address,
using the NetMask()
function. It then applies this mask to the
current IP address.
|
void SubNet(const TInetAddr& aAddr, const TInetAddr& aMask);
Sets the IP address to the network number and subnet parts of the IP
address (that is, the original IP address with the host number part cleared).
This is obtained by applying the mask value in aMask
to the IP
address in aAddr
.
|
void NetBroadcast(const TInetAddr& aAddr);
Sets the IP address to be suitable for a network-directed broadcast address.
The function obtains a network mask corresponding to the class of the IP
address in aAddr
, using the NetMask()
function. It
then applies this mask to the current IP address to separate the network number
part of the address. The mask is then used again to set all host number bits to
1 (which signifies, broadcast to all hosts on the network).
|
void SubNetBroadcast(const TInetAddr& aAddr, const TInetAddr& aMask);
Sets the IP address to be suitable for a subnet-directed broadcast
address. To achieve this, the subnet mask value in aMask
is
applied to the IP address in aAddr
. The mask is then used again to
set all host number bits to 1 (which signifies, broadcast to all hosts on the
subnet).
|
TBool IsClassA();
Tests if the IP address is Class A.
|
TBool IsClassB();
Tests if the IP address is Class B.
|
TBool IsClassC();
Tests if the IP address is Class C.
|
TBool IsMulticast();
Tests if the IP address is Class D (multicast).
|
TBool IsBroadcast();
Tests if the IP address is a limited broadcast address (255.255.255.255).
|
TBool IsWildAddr();
Tests if the IP address is zero (0.0.0.0).
|
TBool IsWildPort();
Tests if the port is zero.
|
static TInetAddr& Cast(const TSockAddr& anAddr);
Casts a TSockAddr
to a TInetAddr
reference. The
cast is only safe if the object being referenced is actually
aTInetAddr
.
|
|
static TInetAddr& Cast(const TSockAddr* anAddr);
Casts a pointer to a TSockAddr
to a
TInetAddr
reference. The cast is only safe if the object to which
anAddr
points to is actually a TInetAddr
.
|
|