realtimenetprots/rtp/cfrtp/inc/cfrtphandler.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2007-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 // CCFRtp Handler Declarations
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22 */
       
    23 
       
    24 #if !defined(__CFRTP_HANDLER_H__)
       
    25 #define __CFRTP_HANDLER_H__
       
    26 
       
    27 #include <in_sock.h>
       
    28 #include "rtphandlerbase.h"
       
    29 
       
    30 // forward declarations
       
    31 
       
    32 class MRtpDataSender
       
    33 	{
       
    34 	public:
       
    35 	virtual void SendData(TDes8& aBuffer,TSockAddr& aRemoteAddr, TInt aFlags, TRequestStatus& aStatus)=0;
       
    36 	};
       
    37 
       
    38 
       
    39 NONSHARABLE_CLASS(CCFRtpHandler) : public CRtpHandlerBase
       
    40 	{
       
    41 public:
       
    42 	static CCFRtpHandler* NewL(MRtpDataSender *aDataSender,	TInt aPriority = EPriorityNormal);
       
    43 
       
    44 	virtual ~CCFRtpHandler();
       
    45 
       
    46 	// virtual functions from CRtpHandlerBase
       
    47 	virtual void Send(TDes8& aBuffer, TRequestStatus& aStatus);
       
    48 	virtual void Read(TDes8& aBuffer);
       
    49 	
       
    50 	void Cancel();
       
    51 	
       
    52 	virtual void ActivateL(RSocketServ& aServer,TRtpConnectionType aConnectionType,RConnection& aConnection);
       
    53 	virtual void ActivateL(RSocketServ& aServer,TRtpConnectionType aConnectionType,RSubConnection& aSubConnection);
       
    54 	virtual void ActivateL(RSocketServ& aServer,TRtpConnectionType aConnectionType);
       
    55 	
       
    56 	virtual TBool CompareAddresses(const TSockAddr& aAddr1,const TSockAddr& aAddr2);
       
    57 
       
    58 	virtual inline void SetLocalAddress(const TSockAddr& aAddr);
       
    59 	virtual inline void SetRemoteAddress(const TSockAddr& aAddr);
       
    60 	virtual inline TSockAddr& RemoteAddress();
       
    61 	virtual inline TSockAddr& LocalAddress();
       
    62 	virtual inline TSockAddr& RecvAddress();
       
    63 
       
    64 	 // from CActive
       
    65 	 virtual void RunL();
       
    66 	 virtual TInt RunError(TInt aError);
       
    67 	
       
    68 	
       
    69 	virtual inline void SetDefaultRemoteAddress(const TSockAddr& aAddr);
       
    70 	virtual inline TSockAddr& DefaultRemoteAddress();
       
    71 	virtual inline void SetRecvAddress(const TSockAddr &aAddr);
       
    72 	
       
    73 	void CancelSend();
       
    74 	void CancelRecv();
       
    75 
       
    76 private:
       
    77 	CCFRtpHandler();
       
    78 	CCFRtpHandler(TInt aPriority);
       
    79 	
       
    80 	// from CHandlerBase
       
    81 	virtual void ReadMore();
       
    82 private:
       
    83 	TInetAddr iLocalAddr;
       
    84 	// The remote addres is Overloaded
       
    85 	// The same variable is used to send rtcp packet to various sources
       
    86 	TInetAddr iRemoteAddr;
       
    87 	TInetAddr iRecvAddr;
       
    88 	TInetAddr iDefaultRemoteAddr;
       
    89 	MRtpDataSender *iDataSender;
       
    90 	};
       
    91 
       
    92 
       
    93 inline void CCFRtpHandler::SetLocalAddress(const TSockAddr& aAddr)
       
    94 	{
       
    95 	iLocalAddr = TInetAddr(aAddr);
       
    96 	}
       
    97 
       
    98 inline void CCFRtpHandler::SetRemoteAddress(const TSockAddr& aAddr)
       
    99 	{
       
   100 	iRemoteAddr = TInetAddr(aAddr);
       
   101 	}
       
   102 
       
   103 inline TSockAddr& CCFRtpHandler::RemoteAddress()
       
   104 	{
       
   105 	return iRemoteAddr;
       
   106 	}
       
   107 
       
   108 inline TSockAddr& CCFRtpHandler::LocalAddress()
       
   109 	{
       
   110 	return iLocalAddr;
       
   111 	}
       
   112 
       
   113 inline void CCFRtpHandler::SetRecvAddress(const TSockAddr &aAddr)
       
   114 	{
       
   115 	iRecvAddr = aAddr;
       
   116 	}
       
   117 
       
   118 inline TSockAddr& CCFRtpHandler::RecvAddress()
       
   119 	{
       
   120 	return iRecvAddr;
       
   121 	}
       
   122 inline void CCFRtpHandler::SetDefaultRemoteAddress(const TSockAddr& aAddr)
       
   123 	{
       
   124 	iDefaultRemoteAddr = TInetAddr(aAddr);
       
   125 	}
       
   126 
       
   127 inline TSockAddr& CCFRtpHandler::DefaultRemoteAddress()
       
   128 	{
       
   129 	return iDefaultRemoteAddr;
       
   130 	}
       
   131 	
       
   132 #endif //__CFRTP_HANDLER_H__
       
   133