|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef CIPADDRESS___ |
|
17 #define CIPADDRESS___ |
|
18 |
|
19 #include <in_sock.h> |
|
20 |
|
21 /** Size of CIpAddress buffer. */ |
|
22 const TInt KIpAddressSize = 39; // large enough for full IPv6 address = 39 (8 * 4 + 7) |
|
23 |
|
24 class CIpAddress : public CBase |
|
25 /** Utility class to hold an IP address as a string on the heap. |
|
26 |
|
27 This can be useful for parsers that have IP address fields. |
|
28 @publishedAll |
|
29 @released |
|
30 */ |
|
31 { |
|
32 public: |
|
33 IMPORT_C static CIpAddress* NewL(const TDesC& aAddr); |
|
34 IMPORT_C static CIpAddress* NewLC(const TDesC& aAddr); |
|
35 inline static CIpAddress* NewL(); |
|
36 inline static CIpAddress* NewLC(); |
|
37 IMPORT_C ~CIpAddress(); |
|
38 IMPORT_C void SetAddrL(const TDesC& aAddr); |
|
39 IMPORT_C const TDesC& Addr() const; |
|
40 private: |
|
41 CIpAddress(); |
|
42 private: |
|
43 HBufC* iAddr; |
|
44 }; |
|
45 |
|
46 inline CIpAddress* CIpAddress::NewL() |
|
47 /** Allocates and constructs a new empty IP address object. |
|
48 |
|
49 @return New IP address object */ |
|
50 { |
|
51 return NewL(KNullDesC); |
|
52 } |
|
53 |
|
54 inline CIpAddress* CIpAddress::NewLC() |
|
55 /** Allocates and constructs a new empty IP address object, leaving the object |
|
56 on the cleanup stack. |
|
57 |
|
58 @return New IP address object */ |
|
59 { |
|
60 return NewLC(KNullDesC); |
|
61 } |
|
62 |
|
63 #endif |