|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Packet probe hook |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __PROBE_SAP_H |
|
19 #define __PROBE_SAP_H |
|
20 |
|
21 #include "prt.h" |
|
22 #include "family.h" |
|
23 |
|
24 |
|
25 class CProviderProbe : public CServProviderBase |
|
26 { |
|
27 friend class CProtocolProbe; |
|
28 public: |
|
29 CProviderProbe(CProtocolProbe* aProtocol); |
|
30 virtual ~CProviderProbe(); |
|
31 |
|
32 //These might be useful |
|
33 virtual void Start(); |
|
34 virtual TInt GetOption(TUint level,TUint name,TDes8& anOption) const; |
|
35 virtual TInt SetOption(TUint level,TUint name,const TDesC8 &anOption); |
|
36 virtual void Ioctl(TUint level,TUint name,TDes8* anOption); |
|
37 virtual void CancelIoctl(TUint aLevel,TUint aName); |
|
38 |
|
39 virtual TUint Write(const TDesC8& aDesc,TUint options, TSockAddr* aAddr=NULL); |
|
40 virtual void GetData(TDes8& aDesc,TUint options,TSockAddr* anAddr=NULL); |
|
41 |
|
42 void Process(RMBufChain& aPacket, CProtocolBase *aSourceProtocol); |
|
43 |
|
44 //These do nothing |
|
45 virtual void LocalName(TSockAddr& /*anAddr*/) const |
|
46 { Panic(EProbePanic_NotSupported); } |
|
47 inline virtual void RemName(TSockAddr& /*anAddr*/) const |
|
48 { Panic(EProbePanic_NotSupported); } |
|
49 inline virtual void ActiveOpen() |
|
50 { Panic(EProbePanic_NotSupported); } |
|
51 inline virtual void ActiveOpen(const TDesC8& /*aConnectionData*/) |
|
52 { Panic(EProbePanic_NotSupported); } |
|
53 virtual void Shutdown(TCloseType aOption); |
|
54 virtual void Shutdown(TCloseType aOption, const TDesC8& aDisconnectionData); |
|
55 virtual void AutoBind(); |
|
56 virtual TInt SetLocalName(TSockAddr& /*anAddr*/); |
|
57 |
|
58 inline virtual TInt SetRemName(TSockAddr& /*anAddr*/) |
|
59 { Panic(EProbePanic_NotSupported); return 0; } |
|
60 inline virtual TInt PassiveOpen(TUint /*aQueSize*/) |
|
61 { Panic(EProbePanic_NotSupported); return 0; } |
|
62 inline virtual TInt PassiveOpen(TUint /*aQueSize*/,const TDesC8& /*aConnectionData*/) |
|
63 { Panic(EProbePanic_NotSupported); return 0; } |
|
64 |
|
65 void Error(TInt aError, TUint aOperationMask); |
|
66 inline TBool FatalState() { return (iErrorMask & (MSocketNotify::EErrorFatal|MSocketNotify::EErrorConnect)) != 0; } |
|
67 protected: |
|
68 CProtocolProbe *const iProtocol; |
|
69 CProviderProbe *iNext; |
|
70 // |
|
71 // IsReceiving is intended for the protocol side. It is can be used by |
|
72 // the protocol side "Deliver" method to ask if this SAP is willing to |
|
73 // receive packets associated with the specified id. |
|
74 virtual TBool IsReceiving(const RMBufPktInfo &info); |
|
75 |
|
76 RMBufPktQ iRecvQ; |
|
77 // |
|
78 // iQueueLimit is used to control how much buffered data is allowed |
|
79 // to be in the iRecvQ, before "congestion" control hits. The value counts |
|
80 // bytes in iRecvQ in following way |
|
81 // - if iQueueLimit < 0, then incoming packet is dropped (= "congestion") |
|
82 // - if iQueueLimit >= 0, then incoming packet is added into iRecvQ, and |
|
83 // the length of the packet is subtracted from the iQueueLimit. When |
|
84 // GetData removes the packet from the queue, the length is added back |
|
85 // to iQueueLimit. |
|
86 // Thus, if left as initial value (= 0), only one packet at time can be |
|
87 // queued. If initialized to 8000, then at most 8000 bytes and 1 packet |
|
88 // can be queued at any point. |
|
89 TInt iQueueLimit; |
|
90 TInt iPacketsDropped; // Count packets dropped due "congestion" |
|
91 TBool iInputStopped:1; |
|
92 TUint iErrorMask; |
|
93 }; |
|
94 |
|
95 #endif |