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