dvrengine/CommonRecordingEngine/inc/CCRPunchPacketSender.h
branchRCL_3
changeset 47 826cea16efd9
parent 45 798ee5f1972c
child 48 13a33d82ad98
equal deleted inserted replaced
45:798ee5f1972c 47:826cea16efd9
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:    Class for sending a punch packet*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CCRPUNCHPACKRTSENDER_H
       
    21 #define __CCRPUNCHPACKRTSENDER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "CCRSock.h"
       
    26 
       
    27 // CONSTANTS
       
    28 // None
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // DATA TYPES
       
    34 // None
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CCRConnection; 
       
    38 class CAsyncCallBack;
       
    39 class CCRRtspPacketSource;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  Class that punches holes to firewall.
       
    45 *
       
    46 *  @lib CommonRecordingEngine.lib
       
    47 *  @since Series 60 3.0
       
    48 */
       
    49 class CCRPunchPacketSender : public CBase, public MCRSockObserver
       
    50     {
       
    51 
       
    52 public: // Constructors and destructor
       
    53 
       
    54     /**
       
    55     * Two-phased constructor.
       
    56     * @return CCRPunchPacketSender pointer to CCRPunchPacketSender class
       
    57     */
       
    58     static CCRPunchPacketSender* NewL( RConnection& aConnection, 
       
    59                                        RSocketServ& aSockServer, 
       
    60                                        TInetAddr& aFromAddr, 
       
    61                                        TInetAddr& aRemoteAddr , 
       
    62                                        TUint32 aMySSRC,
       
    63                                        CCRRtspPacketSource& aOwner );
       
    64 
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     virtual ~CCRPunchPacketSender( );
       
    69 
       
    70 private: // Methods from base classes
       
    71 
       
    72     /**
       
    73     * From MCRSockObserver.
       
    74     * This method is called after some data has been received  from socket.
       
    75     * @since Series 60 3.0
       
    76     * @param aData is descriptor containing the data received. 
       
    77     *        ownership of data is not passed via this call.
       
    78     * @return none.
       
    79     */
       
    80     void DataReceived( TInt aSockId,
       
    81                        const TDesC8 &aData );
       
    82 
       
    83     /**
       
    84     * From MCRSockObserver.
       
    85     * This method is called after status of socket changes.
       
    86     * @since Series 60 3.0
       
    87     * @param aStatus is sock status.
       
    88     * @return none.
       
    89     */
       
    90     void SockStatusChange( TInt aSockId,
       
    91                            CCRSock::TCRSockStatus aStatus,
       
    92                            TInt aError );
       
    93 
       
    94 private:
       
    95 
       
    96     /**
       
    97     * Default constructor.
       
    98     * @param aConnection a connection.
       
    99     * @param aSockServer a socket server.
       
   100     * @param aFromAddr a address.
       
   101     * @param aRemoteAddr
       
   102     * @param aMySSRC
       
   103     * @param aOwner
       
   104     */
       
   105     CCRPunchPacketSender( RConnection& aConnection, 
       
   106                           RSocketServ& aSockServer,
       
   107                           TInetAddr& aFromAddr, 
       
   108                           TInetAddr& aRemoteAddr , 
       
   109                           TUint32 aMySSRC,
       
   110                           CCRRtspPacketSource& aOwner ); 
       
   111      
       
   112     /** 
       
   113     * 2nd phase constructor 
       
   114     */
       
   115     void ConstructL();
       
   116        
       
   117 private: // new methods
       
   118     
       
   119     /**
       
   120     * Method that is called when this instace is finishing business.
       
   121     * @since Series 60 3.0
       
   122     * @param aSelf
       
   123     * @return TInt
       
   124     */
       
   125     static TInt CleanupCallBack ( TAny* aSelf ); 
       
   126     
       
   127 private: // Data types
       
   128     
       
   129     /**
       
   130     * Connection.
       
   131     */
       
   132     RConnection& iConnection; 
       
   133     
       
   134     /**
       
   135     * Socket server.
       
   136     */
       
   137     RSocketServ& iSockServer;
       
   138     
       
   139     /**
       
   140     * Socket 1.
       
   141     */
       
   142     CCRSock* iSock1;
       
   143     
       
   144     /**
       
   145     * Socket 2
       
   146     */
       
   147     CCRSock* iSock2;
       
   148     
       
   149     /**
       
   150     * Address.
       
   151     */
       
   152     TInetAddr iFromAddr;
       
   153     
       
   154     /**
       
   155     * Remote address.
       
   156     */
       
   157     TInetAddr iRemoteAddr;
       
   158     
       
   159     /**
       
   160     * Sender report.
       
   161     */
       
   162     TUint32 iMySSRC;
       
   163     
       
   164     /**
       
   165     * Owner.
       
   166     */
       
   167     CCRRtspPacketSource& iOwner; 
       
   168     
       
   169     /**
       
   170     * Asyncronic cleanup.
       
   171     */
       
   172     CAsyncCallBack* iCleanUp; 
       
   173     
       
   174     /**
       
   175     * Socket 1 state.
       
   176     */
       
   177     TBool iSentViaSock1; 
       
   178     
       
   179     /**
       
   180     * Socket 2 state.
       
   181     */
       
   182     TBool iSentViaSock2;         
       
   183 
       
   184     };
       
   185 
       
   186 #endif // __CCRPUNCHPACKRTSENDER_H
       
   187 
       
   188 // End of file