realtimenetprots/rtp/cfrtp/inc/rtppint.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2008-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 // RTP PINT definitions.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef RTPPINT_H_
       
    24 #define RTPPINT_H_
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32std.h>
       
    28 #include <e32hashtab.h>
       
    29 #include <rtp_proto_id.h>
       
    30 #include <comms-infras/ss_protflow.h>
       
    31 #include "rtpflowfactory.h"	
       
    32 #include "rtpbaseflow.h"
       
    33 
       
    34 class CRtpFlow;
       
    35 class CRtcpFlow;
       
    36 
       
    37 NONSHARABLE_CLASS(CRtpProtocolIntfFactory) : public ESock::CProtocolIntfFactoryBase
       
    38 	/**
       
    39 	Factory for creation RTP PINT.
       
    40 
       
    41 	@internalComponent 
       
    42 	
       
    43 	**/				    
       
    44 	{
       
    45 friend class CRtpFlowFactory;
       
    46 public:
       
    47 	static CRtpProtocolIntfFactory* NewL(TUid aUid, ESock::CProtocolIntfFactoryContainer& aParentContainer);
       
    48 	CProtocolIntfBase* DoCreateProtocolIntfL(TFactoryQueryBase& aQuery);
       
    49 protected:
       
    50 	CRtpProtocolIntfFactory(TUid /*aFactoryId*/, ESock::CProtocolIntfFactoryContainer& /*aParentContainer*/);
       
    51 	};
       
    52 
       
    53 
       
    54 /* This class holds an Instances of RTP and RTCP flows.
       
    55  * This is TClass because it donot own this flows and donot manage them
       
    56  * in any way */
       
    57 class TRtpFlowHolder
       
    58 	{
       
    59 	/**
       
    60 	Helper class for managing flows belonging to different SCPRs.
       
    61 	This is needed because we have only one PINT per CPR.
       
    62 
       
    63 	@internalComponent.
       
    64 	**/				    
       
    65 
       
    66 	CRtpFlow  *iRtpFlow;
       
    67 	CRtcpFlow *iRtcpFlow;
       
    68 	/* The SCPR to which this flows belon to */
       
    69 	const Messages::TNodeId iScprId;
       
    70 public:
       
    71 	TRtpFlowHolder(const Messages::TNodeId& aScprId):iRtpFlow(0),iRtcpFlow(0),iScprId(aScprId)
       
    72 		{
       
    73 		}
       
    74 	void SetRtpFlow(CRtpFlow  *aRtpflow)
       
    75 		{
       
    76 		iRtpFlow = aRtpflow;
       
    77 		}
       
    78 	void SetRtcpFlow(CRtcpFlow *aRtcpFlow)
       
    79 		{
       
    80 		iRtcpFlow = aRtcpFlow;
       
    81 		}
       
    82 	CRtpFlow* GetRtpFlow()
       
    83 		{
       
    84 		return iRtpFlow;
       
    85 		}
       
    86 	CRtcpFlow* GetRtcpFlow()
       
    87 		{
       
    88 		return iRtcpFlow;
       
    89 		}
       
    90 	const  Messages::TNodeId& ScprId()
       
    91 		{
       
    92 		return iScprId;
       
    93 		}
       
    94 	};
       
    95 
       
    96 /* The PINT is singleton per instance of CPR. 
       
    97  * In our case an RTCP SCPR symbolises one RTP Session. This information is
       
    98  * contained inside the PINT. Each PINT will hold  Pointers to RTP and RTCP
       
    99  * flows and it will club the flows together by their SCPR ID */
       
   100 class CRtpProtocolIntf : public ESock::CProtocolIntfBase
       
   101 	{
       
   102 	/**
       
   103 	RTP PINT.
       
   104 	@internalComponent.
       
   105 	**/				    
       
   106 
       
   107 	friend class CRtpProtocolIntfFactory;
       
   108 protected:
       
   109 	CRtpProtocolIntf(ESock::CProtocolIntfFactoryBase& aFactory,const Messages::TNodeId& aId);
       
   110 	
       
   111 	// from CProtocolIntfBase
       
   112 	void DoFlowCreated(ESock::CSubConnectionFlowBase& aFlow);
       
   113 	void DoFlowBeingDeleted(ESock::CSubConnectionFlowBase& aFlow);
       
   114 	
       
   115 	private:
       
   116 	RArray<TRtpFlowHolder> iFlowArray;
       
   117 
       
   118 	TRtpFlowHolder* FindInFlowArray(const Messages::TNodeId& aScprId);
       
   119 	
       
   120 	public:
       
   121 	
       
   122 	~CRtpProtocolIntf();
       
   123 	
       
   124 	/* The Flows after getting Created will call this function to Register Them selves.
       
   125 	   Before registration the flows will be held in a Temporary Array. Once registered
       
   126 	   they will be associated with a SubConnID and moved to a Lookup table. Might leave
       
   127 	   if Insert fails */
       
   128 	void RegisterSubConnProvIDL(CRtpBaseFlow* aRtpflow, const Messages::TNodeId& aSprId);
       
   129 	
       
   130 	};
       
   131 	
       
   132 #endif