|
1 // Copyright (c) 1999-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 // Utility functions for L2CAP |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef L2UTIL_H |
|
19 #define L2UTIL_H |
|
20 |
|
21 _LIT(KL2CAPPanicName, "L2CAP Panic"); |
|
22 |
|
23 enum TL2CAPPanic |
|
24 { |
|
25 EL2CapPDUInvalidLength = 0, |
|
26 EL2CapPDUInvalidFrameType = 1, |
|
27 EL2CAPLinkDownWhenNotUp = 2, |
|
28 EL2CAPMuxAlreadyExists = 3, |
|
29 EL2CAPLinkDownConnectComplete = 4, |
|
30 EL2CAPProtocolOpenedAfterClose = 5, |
|
31 EL2CAPClonesExistDuringSAPDestructor = 6, |
|
32 EL2CAPSDUQueueStillExistsDuringSAPDestructor = 7, |
|
33 EL2CAPCloneHasNoReferenceToListeningSAP = 8, |
|
34 EL2SAPTwoIoctls = 9, |
|
35 EL2SAPStrayIoctlCancel = 10, |
|
36 EL2CAPSAPOpenWithConnectionDataNotSupported = 11, |
|
37 EL2CAPShutdownWithDisconnectionDataNotSupported = 12, |
|
38 EL2CAPPauseDataPlaneCalledWhenDataPlaneDoesNotExist = 13, |
|
39 EL2CAPAttemptToAsignCloneToSecondListeningSAP = 14, |
|
40 EL2CAPLinkUpWhenNoLinkRequested = 15, |
|
41 EL2CAPCouldNotSetBasebandAddress = 16, |
|
42 EL2CAPMuxDeleteWithResourcesStillRegistered = 17, |
|
43 EL2CAPPacketCompleteFailedToConsumeIncomingPDU = 18, |
|
44 EL2CAPUnexpectedSocketEvent = 19, |
|
45 EL2CAPUnexpectedSAPSignalHandlerEvent = 20, |
|
46 EL2CAPUnexpectedDataControllerEvent = 21, |
|
47 EL2CAPUnexpectedSecurityManagerEvent = 22, |
|
48 EL2CAPStateClosedWithData = 23, |
|
49 EL2CAPSDUPositionNegativeDuringSegmentation = 24, |
|
50 EL2CAPPDUBeingSentAfterFragmentationComplete = 25, |
|
51 EL2CAPInvalidHFragmentedPDUSenderStatusCode = 26, |
|
52 EL2CAPUnexpectedSocketUpcall = 27, |
|
53 EL2CAPRequestToResendAPDUThatIsAlreadyInTheResendQueue = 28, |
|
54 EL2CAPAttemptToChangeSegmentationForPartiallySentSDU = 29, |
|
55 EL2CAPBadDataPlaneConfiguration = 30, |
|
56 EL2CAPInvalidDataControllerTimerState = 31, |
|
57 EL2CAPIFrameOrSFrameHandledByBasicController = 32, |
|
58 EL2CAPUnexpectedSAPEvent = 33, |
|
59 |
|
60 EL2CAPInvalidConfigResponseCodeGenerated = 35, |
|
61 EL2CAPInvalidPeerConfigCodeGenerated = 36, |
|
62 EL2CAPInvalidCallToAppendPayloadToBuffer = 37, |
|
63 EL2CAPPDUSendPendingCalledTwice = 38, |
|
64 EL2CAPFragmentSenderDeletedWhileSending = 39, |
|
65 EL2CAPRequestToFragmentWhileBufferContainsData = 40, |
|
66 EL2CAPDeleteCFrameWhileContainingCommands = 41, |
|
67 EL2CAPAckTimerExpiryWithoutPDUToSupervise = 42, |
|
68 EL2CAPSigHandlerDeletedWithResources = 43, |
|
69 EL2CAPSAPSignalHandlerRegisteredTwice = 44, |
|
70 EL2CAPSSHTimerExpiredWhileInIdleState = 45, |
|
71 EL2CAPNoResponseSignalHandler = 46, |
|
72 EL2CAPAttemptToStartRTxTimerForResponseCommand = 47, |
|
73 EL2CAPAttemptToRegisterEntityConfigTwice = 48, |
|
74 EL2CAPAttemptToCreateCommandLongerThanSigMTU = 49, |
|
75 EL2CAPInvalidLinkMode = 50, |
|
76 EL2CAPUpdatePDUTimerDebugFailed = 51, |
|
77 EL2CAPInvalidDebugFlushCounterEvent = 52, |
|
78 EL2CAPInvalidPDUSAR = 53, |
|
79 EL2CAPInvalidSAPSHTimerState = 54, |
|
80 EL2CAPInvalidCommandRejectReason = 55, |
|
81 EL2CAPInvalidSAPShutdownType = 56, |
|
82 EL2CAPInvalidConfigOptionState = 57, |
|
83 EL2CAPAttemptToRestartFlushTimer = 58, |
|
84 EL2CAPGetOptionFailed =59, |
|
85 EL2CAPMuxerDeletedUnexpectedly = 60, |
|
86 EL2CAPMuxerStateOutOfBounds = 61, |
|
87 EL2CAPSAPMuxerStateOutOfBounds = 62, |
|
88 EL2CAPOptimalFragmentSizeTooBigForACLBuffer = 63, |
|
89 EL2CAPUnexpectedFragmentation = 64, |
|
90 EL2CAPACLBufferTooSmall = 65, |
|
91 EL2CAPReceivedPDUsDuringSRejSequenceError = 66, |
|
92 EL2CAPFecReconfigAttemptAfterInitialConfig = 68, |
|
93 EL2CAPFecConfigAttemptWithoutPeerInfo = 69, |
|
94 EL2CAPAsymmetricChannelModes = 70, |
|
95 EL2CAPUnexpectedGetPduLeave = 71, |
|
96 EL2CAPCompletedPDUOnAckedQ = 72, |
|
97 EL2CAPFecNegotiatorWasNotSetUp = 73, |
|
98 // EL2CAPFecNegotiatorSetUpCalledTwice = 74, |
|
99 EL2CAPUnknownChannelMode = 75, |
|
100 EL2CAPUnexpectedMonitorTimeout = 76, |
|
101 // EL2CAPStrayCallToProcessFinal = 77, |
|
102 EL2CAPFrameNotOnMissingList = 78, |
|
103 EL2CAPOldestSRejedFrameNotOnMissingList = 79, |
|
104 EL2CAPFrameNotOnMissingListNorDuplicate = 80, |
|
105 EL2CAPOldestUnackedPduTxSeqNotMatchingExpectedAck = 81, |
|
106 EL2CAPUnacknowledgedPdusMissingFromList = 82, |
|
107 EL2CAPPollFrameNumberTransmitIsZero = 83, |
|
108 EL2CAPPollFrameNumberTransmitIsNotZero = 84, |
|
109 EL2CAPMonitorTimerNotRunning = 85, |
|
110 EL2CAPIFramePutOnSduQOutOfSequence = 86, |
|
111 EL2CAPDataFrameNotPassedOnEntryToSRejSent = 87, |
|
112 EL2CAPLeftWithUnconsumedPdusAfterReceivingAllSRejedFrames = 88, |
|
113 EL2CAPExpectedTxSeqMismatchAfterReceivingAllSRejedFrames = 89, |
|
114 EL2CAPSduQNotExisitantInConnectComplete = 90, |
|
115 EL2CAPTryingToDequeueSRejedTxSeqFromEmptyQ = 91, |
|
116 EL2CAPGetNewIFrameCalledDuringRetransmission = 92, |
|
117 EL2CAPAckTimerRunningWhenRemoteBusy = 93, |
|
118 EL2CAPSRejReqSeqNotOnUnackedList = 94, |
|
119 EL2CAPSFrameQueuedForSendTwice = 95, |
|
120 EL2CAPAckedTxSeqFoundOnUnackedList = 96, |
|
121 EL2CAPNewTxSeqFoundOnUnackedList = 97, |
|
122 EL2CAPInRejSentAndLocalBusy = 98, |
|
123 EL2CAPInSRejSentAndLocalBusy = 99, |
|
124 EL2CAPCaughtInSRejSentWithNoMissingTxSeqs = 100, |
|
125 EL2CAPStrayPendingLocalBusy = 101, |
|
126 // EL2CAPErtmReceiveStateUnexpectedLeave = 102, |
|
127 EL2CAPNextExpectedTxSeqCalledWhenNoneAreExpected = 103, |
|
128 EL2CapSduQAndLocalBusyStateInconsistent = 104, |
|
129 EL2CAPRejSentEnteredWhenSduQFull = 105, |
|
130 EL2CAPNotInLocalBusyAfterTransitionToRecvFromSrejSentWithSduQFull = 106, |
|
131 EL2CapDuplicateIFramePassedToIncomingQ = 107, |
|
132 EL2CAPLocalBusyUnderIllegalConditions = 108, |
|
133 EL2CAPWindowInformationInconsistentWhenExitingSduQFull = 109, |
|
134 EL2CAPRetransmitPDUCalledForNormalTransmit = 110, |
|
135 EL2CAPNormalReceiveStateWhenSRejBufferIsNotEmpty = 111, |
|
136 EL2CAPNormalReceiveStateWhenMissingSRejFramesListIsNotEmpty = 112, |
|
137 EL2CAPZeroAclMtuInTryToSend = 113, |
|
138 EL2CAPFixedCIDIFrame = 114, |
|
139 EL2CAPReqSeqSetOnFrameAlreadyQueuedForSend = 115, |
|
140 EL2CAPSendSFrameWithAckCalledForSRejP0 = 116, |
|
141 EL2CAPEnterLocalBusyCalledWhileDelayTimerStillRunning = 117, |
|
142 EL2CAPBufferSeqNotEqualToExpectedTxSeqWhenInRecvAndSduQNotFull = 118, |
|
143 EL2CAPLocalBusyDelayTimerNotRunningWhenSduQFullButNotInLB = 119, |
|
144 EL2CAPStrayCallToDataControllerDeliveredOutgoingData = 120, |
|
145 EL2CAPWaitAckPendingInWaitAck = 121, |
|
146 EL2CAPRejSentEnteredWithBufferedFrames = 122, |
|
147 EL2CAPMultiSRejPathHitWhenNotSoConfigured = 123, |
|
148 EL2CAPUnownedPduOnMuxQ = 124, |
|
149 EL2CAPPutIFrameCalledWhenSDUQFull = 125, |
|
150 EL2CAPReceivedTxSeqNotMatchingSRejSentSubcase = 126, |
|
151 EL2CAPPreviouslyAcceptedFecValueSuddenlyUnacceptable = 127, |
|
152 EL2CAPPeerAndPreferredChannelModesNotEqual = 128, |
|
153 EL2CAPFlushingNotReallySupported = 129, |
|
154 EL2CAPUnackedTxSeqNotFoundOnUnackedList = 130, |
|
155 EL2CAPHaveSRejsToResendEvenThoughReceivedFirstInOrder = 131, |
|
156 EL2CAPLastTxSeqCalledWhenNoneAreExpected = 132, |
|
157 EL2CAPGivenMoreSRejedTxSeqsToTraceThanCanStore = 133, |
|
158 EL2CAPStrayCallToGetTxSeqForResend = 134, |
|
159 EL2CAPNextTxSeqExpectedBySduQNotEqualToBufferSeqWhenNotInSRejSent = 135, |
|
160 EL2CAPAttemptToEnterWaitFWhenAlreadyInAWaitState = 136, |
|
161 EL2CAPAttemptToEnterWaitAckWhenAlreadyInAWaitState = 137, |
|
162 EL2CAPTryingToAppendSameTxSeqIFrameTwice = 138, |
|
163 EL2CAPTryingToRemoveUnackedIFrameWithSameTxSeqButDifferentAddress = 139, |
|
164 EL2CAPFlushingIncomingIFramesInStateOtherThanRecv = 140, |
|
165 EL2CAPExpectedTxSeqNotEqualToBufferSeqWhenIncomingQEmpty = 141, |
|
166 EL2CAPWindowInformationInconsistentAfterMovingBufferSeqWhenSduQFull = 142, |
|
167 EL2CAPExpectedTxSeqAndBufferSeqAndTxSeqExpectedBySduQNotEqualWhenIncomingQEmptyAndInRecvState = 143, |
|
168 EL2CAPTxSeqExpectedBySduQNotWithinBufferSeqAndExpectedTxSeq = 144, |
|
169 EL2CAPUpdateLocalConfigCalledWithoutPeerEntityConfig = 145, |
|
170 EL2CAPOpenChannelRequestCalledTwice = 146, |
|
171 EL2CAPIFrameSentInWaitAck = 147, |
|
172 EL2CAPNullOwnerSupplied = 148, |
|
173 EL2CAPTryingToStealOwnedPdu = 149, |
|
174 EL2CapConstructingPositiveConfigResponseWithUnresolvedOptionStatus = 200, |
|
175 EL2CapReferencingUnackedIFrameWhenNoRetransmissionGoing = 274, |
|
176 }; |
|
177 |
|
178 /** |
|
179 Panics raised by state machine default behaviour are multiplied by this |
|
180 factor. The less signifigant digits are then available to carry a state |
|
181 index, allowing more information when fixing defects. |
|
182 |
|
183 For example, 'L2CAP Panic 331008' is a UnexpectedSAPEvent panic in the |
|
184 'Open' state. |
|
185 */ |
|
186 const TInt KL2StatePanicMultiplier = 10000; |
|
187 |
|
188 /** |
|
189 A delimiter to prevent a panic code of 0 creating ambigious panics. |
|
190 Without this panic code 0 in state 8 and panic code 8 (not in the state |
|
191 machine) would be identical. |
|
192 */ |
|
193 const TInt KL2StatePanicDelimiter = 1000; // '1' is the delimiter |
|
194 |
|
195 /** |
|
196 If for any reason the current state cannot be found, this value is placed |
|
197 in the state field of a panic. |
|
198 */ |
|
199 const TInt KL2UnknownState = KL2StatePanicDelimiter - 1; |
|
200 |
|
201 void Panic(TL2CAPPanic aPanic); |
|
202 |
|
203 void Panic(TL2CAPPanic aPanic, TInt aState); |
|
204 |
|
205 #endif |
|
206 |