|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * CNetworkPartitionManager |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __CNETWORKPARTITIONMANAGER_H__ |
|
23 #define __CNETWORKPARTITIONMANAGER_H__ |
|
24 |
|
25 /******************************************************************************* |
|
26 * |
|
27 * System Includes |
|
28 * |
|
29 ******************************************************************************/ |
|
30 #include <string> |
|
31 using namespace std; |
|
32 |
|
33 /******************************************************************************* |
|
34 * |
|
35 * Local Includes |
|
36 * |
|
37 ******************************************************************************/ |
|
38 #include "../IntegerAllocatorLibrary/CIntegerAllocator.h" |
|
39 |
|
40 |
|
41 /******************************************************************************* |
|
42 * |
|
43 * Definitions |
|
44 * |
|
45 ******************************************************************************/ |
|
46 class CNetworkPartitionManager |
|
47 { |
|
48 public: |
|
49 CNetworkPartitionManager(); |
|
50 ~CNetworkPartitionManager(); |
|
51 |
|
52 int SetConfiguration( int aBaseNetworkAddress, int aBaseNetworkBitCount, int aSegmentSize ); |
|
53 int AllocateNetworkSegment( int *aNetmaskBitcount, int *aSegmentSize ); |
|
54 int FreeNetworkSegment( int aSegmentBaseAddress ); |
|
55 |
|
56 private: |
|
57 int log2( int aValue ); |
|
58 int IsPowerOfTwo( int aValue ); |
|
59 int NetmaskFromBitcount( int aBitCount ); |
|
60 |
|
61 int iBaseNetworkPartBitcount, iSegmentPartBitcount, iHostPartBitcount; |
|
62 int iBaseNetworkNetmask, iCompleteSegmentNetmask, iSegmentMask; |
|
63 int iBaseNetworkAddress; |
|
64 int iSegmentSize, iSegmentCount; |
|
65 CIntegerAllocator iAddressAllocator; |
|
66 }; |
|
67 |
|
68 #endif //__CNETWORKPARTITIONMANAGER_H__ |