S60 3rd Edition API Reference: sdpconnectionfield.h Source File

sdpconnectionfield.h

Go to the documentation of this file.
00001 /*
00002 * =============================================================================
00003 *  Name          : SdpConnectionField.h
00004 *  Part of       : SDP Codec
00005 *  Interface     : SDK API, SDP Codec API
00006 *  Description   : 
00007 *  Version       : 1.0
00008 *
00009 *  Copyright (c) 2003 Nokia Corporation. 
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation. All rights are reserved. Copying, 
00013 *  including reproducing, storing, adapting or translating, any 
00014 *  or all of this material requires the prior written consent of 
00015 *  Nokia Corporation. This material also contains confidential 
00016 *  information which may not be disclosed to others without the 
00017 *  prior written consent of Nokia Corporation. 
00018 * =============================================================================
00019 */
00020 
00021 #ifndef CSDPCONNECTIONFIELD_H
00022 #define CSDPCONNECTIONFIELD_H
00023 
00024 //  INCLUDES
00025 #include <e32base.h>
00026 #include <in_sock.h>
00027 #include <stringpool.h>
00028 #include "_sdpdefs.h"
00029 
00030 // CONSTANTS
00031 const TUint KDefaultNumOfAddress = 1;
00032 
00033 // FORWARD DECLARATIONS
00034 class RReadStream;
00035 class RWriteStream;
00036 
00037 // CLASS DECLARATION
00052 class CSdpConnectionField : public CBase
00053         {
00054     public: // Constructors and destructor
00055 
00063                 IMPORT_C static CSdpConnectionField* DecodeL( const TDesC8& aText );
00064 
00073                 IMPORT_C static CSdpConnectionField* DecodeLC( const TDesC8& aText );
00074 
00088                 IMPORT_C static CSdpConnectionField* NewL(            
00089             const TInetAddr& aAddress,
00090             TInt aTTL = KErrNotFound, 
00091             TUint aNumOfAddress = KDefaultNumOfAddress );
00092 
00104                 IMPORT_C static CSdpConnectionField* NewL(
00105                         RStringF aNetType, 
00106                         RStringF aAddressType, 
00107                         const TDesC8& aAddress );
00108 
00122                 IMPORT_C static CSdpConnectionField* NewLC(       
00123             const TInetAddr& aAddress, 
00124             TInt aTTL = KErrNotFound,
00125             TUint aNumOfAddress = KDefaultNumOfAddress );
00126 
00139                 IMPORT_C static CSdpConnectionField* NewLC(
00140             RStringF aNetType, RStringF aAddressType, const TDesC8& aAddress );
00141 
00145                 IMPORT_C ~CSdpConnectionField();
00146 
00147     public: // New functions
00148 
00156                 IMPORT_C void EncodeL( RWriteStream& aStream ) const;
00157 
00163                 IMPORT_C CSdpConnectionField* CloneL() const;
00164 
00171                 IMPORT_C TBool operator== ( const CSdpConnectionField& aObj ) const;
00172 
00179                 IMPORT_C RStringF NetType() const;
00180 
00187                 IMPORT_C RStringF AddressType() const;
00188 
00197                 IMPORT_C const TInetAddr* InetAddress() const;
00198 
00204                 IMPORT_C const TDesC8& Address() const;
00205 
00219                 IMPORT_C void SetInetAddressL( const TInetAddr& aValue, 
00220                                    TInt aTTL = KErrNotFound,
00221                                    TUint aNumOfAddress = KDefaultNumOfAddress);
00222 
00232                 IMPORT_C void SetAddressL( RStringF aNetType, 
00233                                                                    RStringF aAddressType, 
00234                                                                    const TDesC8& aAddress );
00235 
00241         IMPORT_C TInt TTLValue() const;
00242 
00250         IMPORT_C void SetTTLL( TInt aTTL );
00251 
00259         IMPORT_C TInt NumOfAddress() const;
00260          
00267         IMPORT_C void SetNumOfAddressL( TUint aNumOfAddress );
00268 
00269     public:     // Internal to codec
00270 
00276                 void ExternalizeL( RWriteStream& aStream ) const;
00277 
00284                 static CSdpConnectionField* InternalizeL( RReadStream& aStream );
00285 
00286     private:    // Internal
00287 
00291         CSdpConnectionField();
00292 
00299         void ConstructL( const TDesC8& aText );
00300         
00308         void ConstructL( const TInetAddr& aAddress,
00309                          TInt aTTL, TUint aNumOfAddress );
00310 
00320         void ConstructL( RStringF aNetType, RStringF aAddressType, 
00321                              const TDesC8& aAddress );
00322 
00330         TInt IsValidAddress( TBool aAddressTypeIP4,
00331                              const TDesC8& aAddress ) const;
00332 
00341         TInt IsValidAddress( const TInetAddr& aAddress, 
00342                              TInt aTTL, TUint aNumOfAddress ) const;
00343         
00353         HBufC8* ParseAddressFieldL( TBool aAddressTypeIP4,
00354                                     const TDesC8& aAddress,
00355                                     TInt& aTTL,
00356                                     TUint& aNumberOfAddresses ) const;
00357 
00368         HBufC8* ParseIP4AddressL( TInt aPos, 
00369                                   TInetAddr& aAddr,
00370                                   const TDesC8& aAddress,
00371                                   TInt& aTTL,
00372                                   TUint& aNumberOfAddresses ) const;
00373 
00384         HBufC8* ParseIP6AddressL( TInt aPos, 
00385                                   TInetAddr& aAddr,
00386                                   const TDesC8& aAddress,
00387                                   TInt& aTTL,
00388                                   TUint& aNumberOfAddresses ) const;
00389 
00396         void CopyNetTypeL( const TDesC8& aNetType );
00397 
00404         void CopyAddressTypeL( const TDesC8& aAddrType );
00405 
00413         void CopyAddressL( const TDesC8& aAddress, RStringPool aPool );
00414 
00415     private:    // Data
00416 
00417         // <network type>
00418         RStringF iNetType;
00419         
00420         // <address type>        
00421         RStringF iAddressType;
00422 
00423         // mutable TInetAddr for InetAddress()
00424         mutable TInetAddr iInetAddress;
00425 
00426         // Address in text format
00427         HBufC8* iAddress;
00428 
00429         // TTL for IP4 multicast addresses
00430         TInt iTTL;
00431         // Number of addresses
00432         TUint iNumOfAddress;
00433 
00434         // String pool
00435         RStringPool iPool;
00436 
00437         __DECLARE_TEST;
00438         };
00439 
00440 // CSDPCONNECTIONFIELD_H
00441 #endif

Copyright © Nokia Corporation 2001-2007
Back to top