|
1 // Copyright (c) 2005-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 AVCTP |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef AVCTPUTILS_H |
|
24 #define AVCTPUTILS_H |
|
25 |
|
26 |
|
27 /* |
|
28 @internalTechnology |
|
29 */ |
|
30 namespace SymbianAvctp |
|
31 { |
|
32 |
|
33 _LIT(KAvctpPanicName, "AvctpPrtPanic"); |
|
34 |
|
35 /** |
|
36 AVCTP panic codes |
|
37 */ |
|
38 enum TPanic |
|
39 { |
|
40 /** ESock has done something unexpected */ |
|
41 EUnexpectedEsockEvent = 0, |
|
42 /** Unable to set remote address on lower protocol */ |
|
43 EErrorSettingAddress = 1, |
|
44 /** We don't support (dis)connection data */ |
|
45 EDisconnectDataNotSupported = 2, |
|
46 /** We don't support the graceful close of the lower protocol Sap */ |
|
47 ELowerProtocolSapCanClose = 3, |
|
48 /** We don't support Active Open calls since AVCTP is connectionless*/ |
|
49 EActiveOpenNotSupported = 4, |
|
50 /** We don't support Passive Open calls since AVCTP is connectionless*/ |
|
51 EPassiveOpenNotSupported = 5, |
|
52 /** The protocol hasn't been bound to a lower protocol */ |
|
53 ENotBound = 6, |
|
54 /** Unknown packet type */ |
|
55 EUnknownPacketType = 7, |
|
56 /** The idle timer has expired but we're not idle */ |
|
57 EIdleTimeoutWhenNotIdle = 8, |
|
58 /** The lower protocol SAP's remote address and the passed address don't match */ |
|
59 EMismatchedAddressAndSap = 9, |
|
60 /** There must be at least one data client pending a join in the join async callback */ |
|
61 EDataClientsPendingJoinWasZero = 10, |
|
62 /** We've unexpectedly found a null TPid */ |
|
63 ENullPid = 11, |
|
64 /** We've unexpectedly found a null TBTDevAddr */ |
|
65 ENullTBTDevAddr = 12, |
|
66 /** We've should've had a null TBTDevAddr at this point*/ |
|
67 ETBTDevAddrNotNull = 13, |
|
68 /** L2CAP shouldn't have given us an error */ |
|
69 EUnexpectedErrorFromL2CAP = 14, |
|
70 /** We're expecting a Lower Protocol SAP we could use at this point*/ |
|
71 ENullLowerProtocolSap = 15, |
|
72 /** Expected a usable Muxer at this point */ |
|
73 ENullMuxer = 15, |
|
74 /** Unexpected Muxer Event*/ |
|
75 EUnexpectedMuxerEvent = 16, |
|
76 /** The muxer shouldn't have any data clients ! */ |
|
77 EMuxerHasADataClient = 17, |
|
78 /** A sap is being asked to bind to a Pid when it's already bound to one */ |
|
79 ESapAlreadyBound = 18, |
|
80 /** A muxer is being asked to bind to a remote address when it's already bound to one */ |
|
81 EMuxerAlreadyBound = 19, |
|
82 /** A sap Link Manager is being asked to bind to a Pid when it's already bound to one */ |
|
83 ESapLinksMgrAlreadyBound = 20, |
|
84 /** No data clients are allowed on a CAvctpTransport */ |
|
85 EUnexpectedDataClient = 21, |
|
86 /** When the Control EConnectRspAccept is called on the SapLinksMgr, |
|
87 the muxer that is addressed by the Control must be Connected */ |
|
88 EMuxerNotConnected = 22, |
|
89 /** We should've had a muxer at this point */ |
|
90 EMuxerNotFound = 23, |
|
91 /** We've received an unexpected Avctp Sub Conn Event*/ |
|
92 EUnexpectedAvctpSubConnEvent = 24, |
|
93 /** The protocol has received a badly formed message in control plane*/ |
|
94 EProtocolReceivingBadlyFormedControlMessage = 25, |
|
95 /** The protocol has received a message from a protocol it was not expecting*/ |
|
96 EProtocolReceivingControlFromUnexpectedProtocol = 26, |
|
97 /** A Muxer isn't clear to send when it should be */ |
|
98 EMuxerBlocked = 27, |
|
99 /** We expected to have a proper packet */ |
|
100 ENullPacket = 28, |
|
101 /** Avctp is connectionless so a valid sockAddr must be supplied to the Sap */ |
|
102 ENullSockAddr = 29, |
|
103 /** We expected a usable Avctp Packet Manager at this point */ |
|
104 ENullPacketMgr = 30, |
|
105 /** We expected a null packet mgr pointer */ |
|
106 ENonNullPacketMgr = 31, |
|
107 /** We've some how ended up with the wrong BT address */ |
|
108 EWrongBTAddress = 32, |
|
109 /** The muxer must be blocked if the packet manager has is still working on a |
|
110 partial packet when a sap wants to write to it*/ |
|
111 EMuxerNotBlocked = 33, |
|
112 /** A packet is in the wrong state */ |
|
113 EInvalidPacketState = 34, |
|
114 /** The Q Count doesn't match what we thought it was */ |
|
115 EOutboundQCountIncorrect = 35, |
|
116 /** Avctp doesn't support Ioctls */ |
|
117 EIoctlsNotSupported = 36, |
|
118 /** Avctp doesn't support parameters being set on it's subconnections */ |
|
119 EParameterSettingNotSupported = 37, |
|
120 /** Someone has tried to get a non Mtu Option */ |
|
121 ENonMtuOption = 38, |
|
122 /** Stub Panic for exported Avctp functions */ |
|
123 EAvctpStubUsedInANonAvBuild = 39, |
|
124 /** We expected to find a SapLinksMgr */ |
|
125 ESapLinksMgrNotFound = 40, |
|
126 /** No events for this address */ |
|
127 EMuxEventsNotFound = 41, |
|
128 /** DeliverEvent has been called, but there is no request from the client outstanding |
|
129 so this event would be dropped by ESock */ |
|
130 EAttemptToDeliverEventWithNoNotificationOutstanding = 42, |
|
131 EUnexpectedErrorCode = 43, |
|
132 /** |
|
133 An unexpected comms-framework message has been received by a node |
|
134 This panic code should never happen |
|
135 */ |
|
136 EUnexpectedMessage = 43, |
|
137 |
|
138 /** |
|
139 An attempt was made to use an RNodeInterface who's communication channel was closed |
|
140 This panic code should never happen |
|
141 */ |
|
142 ENodeInterfaceUnusable = 44, |
|
143 EAvctpMuxerStateOutOfBounds = 45, |
|
144 EAvctpTransportNotFound = 46, |
|
145 EAvctpInvalidChannelNotify = 47, |
|
146 EAvctpInvalidChannel = 48, |
|
147 EAvctpUnexpectedIoctlCompletion = 49, |
|
148 EUnexpectedIdleMuxer = 50, |
|
149 ENewDataNotSupported = 51, |
|
150 EAvctpClientNotFound = 52, |
|
151 EAvctpInvalidAddress = 53, |
|
152 /** SetOption called on an CServProviderBase returned an error*/ |
|
153 ESetOptionError = 54, |
|
154 EGetOptionError = 55, |
|
155 EAvctpInvalidFragmenterState = 56, |
|
156 EAvctpEmptyIndicationQueue = 57, |
|
157 EAvctpInvalidSecChannelRefCount = 58, |
|
158 ESetRemNameError = 59, |
|
159 EAvctpFragmenterNonEmptyPdu = 60, |
|
160 EAvctpFragmenterEmptyPdu = 61, |
|
161 EAvctpFragmenterInvalidHeaderType = 62, |
|
162 EAvctpControlSAPOpetationNotSupported = 63, |
|
163 EAvctpDataSAPNullSocket = 64, |
|
164 EAvctpRMBufChainSplitError = 65, |
|
165 EAvctpInvalidChannelIoctl = 66, |
|
166 EAvctpSapClosed = 67, |
|
167 ENullAvctpProtocol = 68, |
|
168 }; |
|
169 |
|
170 /** |
|
171 Panics raised by state machine default behaviour are multiplied by this |
|
172 factor. The less signifigant digits are then available to carry a state |
|
173 index, allowing more information when fixing defects. |
|
174 |
|
175 For example, a bad event passed to the Avctp muxer state machine may raise |
|
176 panic 'AvctpPrtPanic 161001' if it occurs in the 'Link Pending' state. |
|
177 */ |
|
178 const TInt KStatePanicMultiplier = 10000; |
|
179 |
|
180 /** |
|
181 A delimiter to prevent a panic code of 0 creating ambigious panics. |
|
182 Without this panic code 0 in state 8 and panic code 8 (not in the state |
|
183 machine) would be identical. |
|
184 */ |
|
185 const TInt KStatePanicDelimiter = 1000; // '1' is the delimiter |
|
186 |
|
187 /** |
|
188 If for any reason the current state cannot be found, this value is placed |
|
189 in the state field of a panic. |
|
190 */ |
|
191 const TInt KUnknownState = KStatePanicDelimiter - 1; |
|
192 |
|
193 const TInt KBTAddressLength = 12; // used to allocate a TBuf<> needed to get the readable BTDevAddress |
|
194 void Panic(TPanic aPanic); |
|
195 |
|
196 void Panic(TPanic aPanic, TInt aState); |
|
197 |
|
198 } // end of namespace SymbianAvctp |
|
199 |
|
200 #endif // AVCTPUTILS_H |
|
201 |