// ----------------------------------------------------------------------------- // CSdpConnectionField::IsValidAddress // Checks if the given address is valid // ----------------------------------------------------------------------------- // TInt CSdpConnectionField::IsValidAddress( const TInetAddr& aAddress, TInt aTTL, TUint aNumOfAddress ) const { TInt err( KErrSdpCodecConnectionField ); // 0 <= TTL <= 255 or KErrNotFound if not defined // Number of addresses > 0 if ( ( aTTL == KErrNotFound || ( aTTL >= 0 && aTTL <= 255 ) ) && aNumOfAddress > 0 ) { TBuf16 <KMaxAddressLength> output; aAddress.Output(output); // Address has to be either of type IP4 or IP6 // If IP4 and multicast then it must contain TTL attribute // If IP4 and unicast then it must NOT contain TTL and must have 1 address // If IP6 and multicast then it must NOT contain TTL // If IP6 and unicast then it must NOT contain TTL and must have 1 address if ( ( aAddress.Address() && ( ( aAddress.IsMulticast() && aTTL != KErrNotFound ) || ( aAddress.IsUnicast() && aTTL == KErrNotFound && aNumOfAddress == 1 ) ) ) || ( !aAddress.Address() && ( ( aAddress.IsMulticast() && aTTL == KErrNotFound ) || ( aAddress.IsUnicast() && aTTL == KErrNotFound && aNumOfAddress == 1 ) ) || ( aAddress.IsWildAddr() && ( output.Match(KWildAddr) == 0|| output.Match(KWildAddrIPv6) == 0 )) ) ) { err = KErrNone; } } return err; }