20 */ |
20 */ |
21 |
21 |
22 #include <e32uid.h> |
22 #include <e32uid.h> |
23 #include <nifmbuf.h> |
23 #include <nifmbuf.h> |
24 #include <es_ini.h> |
24 #include <es_ini.h> |
|
25 #include <e32svr.h> |
|
26 #include <u32hal.h> |
25 #include "BcaController.h" |
27 #include "BcaController.h" |
26 |
28 |
27 _LIT(KRawIpIniFile, "rawip.ini"); |
|
28 _LIT(KLinkLit, "link"); |
|
29 _LIT(KHighmarkLit, "highmark"); |
|
30 _LIT(KPacketLit, "packet"); |
|
31 _LIT(KMaxPacketSizeLit, "maxippacketsize"); |
|
32 //In order not to flow off SPUD everytime we set the default to 1 |
29 //In order not to flow off SPUD everytime we set the default to 1 |
33 const TUint KDefaultBufferSize=1; |
30 const TUint KDefaultBufferSize=1; |
|
31 |
|
32 #ifdef __EABI__ |
|
33 // Patch data is used and KMaxTxIPPacketSize and KMaxRxIPPacketSize can be modified to a different value in RawIpNif.iby file |
|
34 extern const TInt KMaxSendQueueLen = KDefaultBufferSize; |
|
35 extern const TInt KMaxTxIPPacketSize = KMaxIPPacket + KIPTagHeaderLength; |
|
36 extern const TInt KMaxRxIPPacketSize = KMaxIPPacket + KIPTagHeaderLength; |
|
37 #endif |
34 |
38 |
35 CBcaController::CBcaController(MControllerObserver& aObserver, |
39 CBcaController::CBcaController(MControllerObserver& aObserver, |
36 CBttLogger* aTheLogger) |
40 CBttLogger* aTheLogger) |
37 /** |
41 /** |
38 * Constructor. |
42 * Constructor. |
40 : iObserver(aObserver), |
44 : iObserver(aObserver), |
41 iTheLogger(aTheLogger), |
45 iTheLogger(aTheLogger), |
42 iTxFlowControl(EFlowControlOff), |
46 iTxFlowControl(EFlowControlOff), |
43 iTxContextActive(ETrue), |
47 iTxContextActive(ETrue), |
44 iSendState(EIdle), |
48 iSendState(EIdle), |
45 iMaxSendQueueLen(1), |
49 iMaxSendQueueLen(KDefaultBufferSize), |
46 iNumPacketsInSendQueue(0) |
50 iNumPacketsInSendQueue(0) |
47 { |
51 { |
48 iSendQueue.Init(); |
52 iSendQueue.Init(); |
49 } |
53 } |
50 |
54 |
64 |
68 |
65 void CBcaController::BaseConstructL() |
69 void CBcaController::BaseConstructL() |
66 { |
70 { |
67 _LOG_L1C1(_L8("CBcaController::BaseConstructL")); |
71 _LOG_L1C1(_L8("CBcaController::BaseConstructL")); |
68 |
72 |
69 // Default value for the pakcket size |
|
70 iMaxPacketSise = KMaxIPPacket + KIPTagHeaderLength; |
|
71 |
|
72 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS |
73 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS |
73 iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger); |
74 iIPTagHeader = new (ELeave) CIPTagHeader(iTheLogger); |
74 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS |
75 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS |
75 |
76 |
76 CESockIniData* iniData = NULL; |
77 #if defined (__EABI__) |
77 TRAPD(res, iniData = CESockIniData::NewL(KRawIpIniFile)); |
78 // Default value for queue length |
78 CleanupStack::PushL(iniData); |
79 iMaxSendQueueLen = KMaxSendQueueLen; |
79 |
80 // Default value for Tx and Rx packet size |
80 if(res!=KErrNone) |
81 iMaxTxPacketSize = KMaxTxIPPacketSize; |
81 { |
82 iMaxRxPacketSize = KMaxRxIPPacketSize; |
82 _LOG_L1C2(_L8("RawIp ini file %S not found. Default values will be used."), &KRawIpIniFile); |
83 #else // WINS |
83 CleanupStack::PopAndDestroy(); |
84 // Set default values in case patch is not present in epocrawip.ini |
84 return; |
85 iMaxSendQueueLen = KDefaultBufferSize; |
85 } |
86 iMaxTxPacketSize = KMaxIPPacket + KIPTagHeaderLength; |
86 |
87 iMaxRxPacketSize = KMaxIPPacket + KIPTagHeaderLength; |
87 //here process the file |
88 |
88 if(!iniData->FindVar(KLinkLit(), KHighmarkLit(), iMaxSendQueueLen)) |
89 // for the emulator process is patched via the epocrawip.ini file |
89 { |
90 UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMaxSendQueueLen",&iMaxSendQueueLen); |
90 iMaxSendQueueLen = KDefaultBufferSize; |
91 UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMaxTxIPPacketSize",&iMaxTxPacketSize); |
91 } |
92 UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"rawip_KMaxRxIPPacketSize",&iMaxRxPacketSize); |
92 if(!iniData->FindVar(KPacketLit(), KMaxPacketSizeLit(), iMaxPacketSise)) |
93 #endif |
93 { |
|
94 iMaxPacketSise = KMaxIPPacket + KIPTagHeaderLength; |
|
95 } |
|
96 |
|
97 CleanupStack::PopAndDestroy(); |
|
98 } |
94 } |
99 |
95 |
100 void CBcaController::UpdateInternalFlowFlag(TFlowControl aValue) |
96 void CBcaController::UpdateInternalFlowFlag(TFlowControl aValue) |
101 /** |
97 /** |
102 * Updates Internal Flow flag and resumes the data flow if |
98 * Updates Internal Flow flag and resumes the data flow if |
402 TBool CBcaController::IsSendQueueFull() |
398 TBool CBcaController::IsSendQueueFull() |
403 /** |
399 /** |
404 * Indicator of whether the BufferQueue is full |
400 * Indicator of whether the BufferQueue is full |
405 * @return TBool. ETrue if bufferQueue is full, EFalse if queue is not full |
401 * @return TBool. ETrue if bufferQueue is full, EFalse if queue is not full |
406 */ |
402 */ |
407 { |
403 { |
408 iFullQueueFlag = iNumPacketsInSendQueue >= iMaxSendQueueLen; |
404 iFullQueueFlag = iNumPacketsInSendQueue >= iMaxSendQueueLen; |
409 return iFullQueueFlag; |
405 return iFullQueueFlag; |
410 } |
406 } |
411 |
407 |
412 void CBcaController::AppendToSendQueue(RMBufChain& aPdu) |
408 void CBcaController::AppendToSendQueue(RMBufChain& aPdu) |