networkprotocols/tcpipv4v6prt/inc/in_net.h
changeset 0 af10295192d8
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 // in_net.h - network layer protocol
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @internalComponent
       
    21 */
       
    22 #ifndef __IN_NET_H__
       
    23 #define __IN_NET_H__
       
    24 
       
    25 #include "inet.h"
       
    26 
       
    27 const TUint KNetDefaultRecvBuf =  8192;  // Default receive buffer limit for SAP's (ICMP & IP)
       
    28 
       
    29 //
       
    30 // This is not a good class. It is misnamed. -- msa
       
    31 // It is used by IP and ICMP, mainly for
       
    32 // its Async buffer queues, i really would need something different..
       
    33 //
       
    34 class CProtocolInet6Network : public CProtocolInet6Base
       
    35 	{
       
    36 	//
       
    37 	// Generic
       
    38 	//
       
    39 public:
       
    40 	virtual ~CProtocolInet6Network();
       
    41 	virtual void StartL();
       
    42 
       
    43 	inline TInt QueueLimit() { return iQueueLimit; }
       
    44 protected:
       
    45 	//
       
    46 	// The initial buffer limit for SAP's receive queues
       
    47 	// created under this protocol (see. iQueueLimit on
       
    48 	// CProviderInet6Network for interpretation).
       
    49 	TInt iQueueLimit;
       
    50 
       
    51 	virtual void Deliver(/*const*/ RMBufPacketBase &aPacket);
       
    52 	};
       
    53 
       
    54 
       
    55 class CProviderInet6Network : public CProviderInet6Base
       
    56 	{
       
    57 public:
       
    58 	CProviderInet6Network(CProtocolInet6Base *aProtocol) : CProviderInet6Base(aProtocol) {}
       
    59 	virtual ~CProviderInet6Network();
       
    60 	virtual void InitL();
       
    61 	virtual void Shutdown(TCloseType option);
       
    62 	virtual void Process(RMBufChain& aPacket, CProtocolBase *aSourceProtocol = NULL);
       
    63 	virtual void GetData(TDes8 &aDesc, TUint options, TSockAddr *anAddr=NULL);
       
    64 	virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr=NULL);
       
    65 	virtual TInt SetLocalName(TSockAddr &anAddr);
       
    66 	virtual void AutoBind();
       
    67 
       
    68 	// IsReceiving is intended for the protocol side. It is can be used by
       
    69 	// the protocol side "Deliver" method to ask if this SAP is willing to
       
    70 	// receive packets associated with the specified id. What the "id" is,
       
    71 	// depends on the protocol. For, example, for IP level SAP/PRT pair, the
       
    72 	// id is the protocol of the received packet (e.g. protocol or next header
       
    73 	// field from the IP header).
       
    74 	virtual TBool IsReceiving(const RMBufPktInfo &aInfo);
       
    75 protected:
       
    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 	TUint iInputStopped:1;
       
    92 	};
       
    93 
       
    94 #endif