class TInetAddr : public TSockAddr |
This class specialises the generic socket server address class TSockAddr for the TCP/IP protocol family. It represents an IP address and stores either an IPv4 or an IPv6 address in its buffer after the generic data defined by TSockAddr. The protocol family field provided by the TSockAddr base class can be set to KAfInet, KAfInet6 or KAFUnspec.
The address family defines the format of the stored address:
KAfInet is for plain 32 bits IPv4 address presented as SInetAddr structure.
KAfInet6 is for both IPv4 and IPv6 addresses (IPv4 addresses are in IPv4 mapped format). The content is presented as SInet6Addr structure, which includes the scope id and flow label, in addition to the 128 address bits.
KAFUnspec does not contain any addresses and works in most contexts as unspecified address, This is better than placing explicit IPv4 "0.0.0.0" or IPv6 "::", which in certain situations may limit the connections to either IPv4 or IPv6, but not both.
Any function which sets or changes the address bits, will always reset the scope id and flow label to 0 (the TInetAddr::Init is always called internally). These are reasonable defaults, and normal application user does not normally need to worry about flow label or scope id.
When address is returned from the stack, it will often be in KAfInet6 format, and may contain non-zero values for flow label and scope id fields. When copying addresses, the full TInetAddr (or at least SInet6Addr) should be copied to preserve these fields.
7.0 The IPv4 only portion is backward compatible with older versions. In 7.0s some functions have additional features.
Protected Member Functions | |
---|---|
SInetAddr * | Addr4Ptr() |
TInt | AddrLen() |
SInet6Addr * | AddrPtr() |
Private Member Functions | |
---|---|
TInt | Ipv4Input(const TDesC &) |
TInt | Ipv6Input(const TDesC &) |
Inherited Attributes | |
---|---|
TBuf8< KMaxSockAddrSize >::iBuf | |
TDes8::__DECLARE_TEST | |
TDes8::iMaxLength |
IMPORT_C | TInetAddr | ( | const TSockAddr & | aAddr | ) |
const TSockAddr & aAddr |
SInetAddr * | Addr4Ptr | ( | ) | const [protected, inline] |
Returns a pointer to KAfInet content format
TInt | AddrLen | ( | ) | [protected, static, inline] |
Returns the size of the KAfInet6 content format.
SInet6Addr * | AddrPtr | ( | ) | const [protected, inline] |
Returns a pointer to KAfInet6 content format.
TInetAddr & | Cast | ( | const TSockAddr & | aAddr | ) | [static, inline] |
const TSockAddr & aAddr | TSockAddr to cast |
TInetAddr & | Cast | ( | const TSockAddr * | aAddr | ) | [static, inline] |
const TSockAddr * aAddr | TSockAddr to cast |
IMPORT_C TBool | CmpAddr | ( | const TInetAddr & | aAddr | ) | const |
const TInetAddr & aAddr |
TBool | IsBroadcast | ( | ) | const [inline] |
Tests if the IP address is a limited broadcast address (255.255.255.255).
ETrue if the IPv4 address value is a limited broadcast address; otherwise, EFalse
TBool | IsClassA | ( | ) | const [inline] |
Tests if the IP address is Class A.
ETrue if the IPv4 address value is Class A; otherwise, EFalse
Works only for IPv4. It assumes the old IPv4 address classes (A, B, C). Applications using this function may not work properly in the current internet environment.
TBool | IsClassB | ( | ) | const [inline] |
Tests if the IP address is Class B.
ETrue if the IPv4 address value is Class B; otherwise. EFalse
Works only for IPv4. It assumes the old IPv4 address classes (A, B, C). Applications using this function may not work properly in the current internet environment.
TBool | IsClassC | ( | ) | const [inline] |
Tests if the IP address is Class C.
ETrue if the IPv4 address value is Class C; otherwise, EFalse
Works only for IPv4. It assumes the old IPv4 address classes (A, B, C). Applications using this function may not work properly in the current internet environment.
TBool | IsWildAddr | ( | ) | const [inline] |
Tests if the IP address is unspecified.
This is same as IsUnspecified()
ETrue if the IP address value is unspecified; otherwise, EFalse.
TBool | IsWildPort | ( | ) | const [inline] |
Tests if the port is zero.
ETrue if the port is zero; otherwise, EFalse.
IMPORT_C TBool | Match | ( | const TInetAddr & | aHost | ) | const |
const TInetAddr & aHost |
IMPORT_C TBool | Match | ( | const TInetAddr & | aNet, |
const TInetAddr & | aMask | |||
) | const |
IMPORT_C void | NetBroadcast | ( | const TInetAddr & | aAddr | ) |
const TInetAddr & aAddr |
IMPORT_C void | NetMask | ( | const TInetAddr & | aAddr | ) |
const TInetAddr & aAddr |
IMPORT_C void | SetAddress | ( | const TIp6Addr & | aAddr | ) |
const TIp6Addr & aAddr |