williamr@2: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef CIPADDRESS___ williamr@2: #define CIPADDRESS___ williamr@2: williamr@2: #include williamr@2: williamr@2: /** Size of CIpAddress buffer. */ williamr@2: const TInt KIpAddressSize = 39; // large enough for full IPv6 address = 39 (8 * 4 + 7) williamr@2: williamr@2: class CIpAddress : public CBase williamr@2: /** Utility class to hold an IP address as a string on the heap. williamr@2: williamr@2: This can be useful for parsers that have IP address fields. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CIpAddress* NewL(const TDesC& aAddr); williamr@2: IMPORT_C static CIpAddress* NewLC(const TDesC& aAddr); williamr@2: inline static CIpAddress* NewL(); williamr@2: inline static CIpAddress* NewLC(); williamr@2: IMPORT_C ~CIpAddress(); williamr@2: IMPORT_C void SetAddrL(const TDesC& aAddr); williamr@2: IMPORT_C const TDesC& Addr() const; williamr@2: private: williamr@2: CIpAddress(); williamr@2: private: williamr@2: HBufC* iAddr; williamr@2: }; williamr@2: williamr@2: inline CIpAddress* CIpAddress::NewL() williamr@2: /** Allocates and constructs a new empty IP address object. williamr@2: williamr@2: @return New IP address object */ williamr@2: { williamr@2: return NewL(KNullDesC); williamr@2: } williamr@2: williamr@2: inline CIpAddress* CIpAddress::NewLC() williamr@2: /** Allocates and constructs a new empty IP address object, leaving the object williamr@2: on the cleanup stack. williamr@2: williamr@2: @return New IP address object */ williamr@2: { williamr@2: return NewLC(KNullDesC); williamr@2: } williamr@2: williamr@2: #endif