multimediacommsengine/mmceshared/inc/mceserial.h
changeset 0 1bce908db942
child 49 64c62431ac08
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 "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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MCESERIAL_H
       
    22 #define MCESERIAL_H
       
    23 
       
    24 #include <e32std.h>  	
       
    25 #include <s32strm.h>
       
    26 #include <s32mem.h>
       
    27 #include <e32des8.h>
       
    28 
       
    29 #include "mcerefer.h"
       
    30 #include "mcecomsession.h"
       
    31 #include "mcecomaudiostream.h"
       
    32 #include "mcecomvideostream.h"
       
    33 #include "mcecomstreambundle.h"
       
    34 
       
    35 #include "mceclientserver.h"
       
    36 #include "mcefactory.h"
       
    37 #include "mcecomfactory.h"
       
    38 #include "mcecomserializationcontext.h"
       
    39 
       
    40 class CMceManager;
       
    41 class CSIPProfile;
       
    42 
       
    43 
       
    44 #define MCE_DELETE( val ) delete val;val=NULL
       
    45 #define MCE_HAS_DATA( buf ) ( buf && buf->Length() > 0 )
       
    46 #define MCE_MOVE_BUFPTR( from, to ) HBufC8* to = from;from=NULL
       
    47 #define MCE_MOVE_ARRPTR( from, to ) CDesC8Array* to = from;from=NULL
       
    48 #define MCE_IS_ERROR( error ) ( error < KErrNone )
       
    49 #define MCE_NEED_TO_SEND( session, receivedSdp )\
       
    50     ( session.NeedToSend( receivedSdp ) ||\
       
    51       session.FCActions().NeedToSendOffer() )
       
    52 #define MCE_NEED_TO_RECEIVE( session ) session.NeedToReceive()
       
    53 #define MCE_FORCED_TO_RECEIVE( session ) session.ForceSDPSendingStatus()
       
    54 
       
    55 _LIT8( KMceEmpty, "" );
       
    56 
       
    57 
       
    58 enum TMceContentType
       
    59     {
       
    60     EMceContentTypeUserDefined,
       
    61     EMceContentTypeSDP,
       
    62     EMceContentTypeMultiPart
       
    63     };
       
    64 
       
    65 
       
    66 
       
    67 /**
       
    68  * static class providing decoding and  encoding
       
    69  * functionality of basic data types.
       
    70  *
       
    71  * @lib 
       
    72  */
       
    73 class MceSerial
       
    74     {
       
    75 public:
       
    76 
       
    77     /**
       
    78      * Decodes descriptor from stream
       
    79      * @param aString placeholder for data to be read from stream
       
    80      * @param aReadStream stream from which data is decoded
       
    81      **/
       
    82     static void DecodeL( TDes8& aString, RReadStream& aReadStream );
       
    83 
       
    84     /**
       
    85     * Encodes descriptor to stream
       
    86     * @param aString string to be encoded to stream
       
    87     * @param aWriteStream stream to which string is encoded
       
    88     **/
       
    89     static void EncodeL( const TDesC8& aString, RWriteStream& aWriteStream );
       
    90     
       
    91     /**
       
    92      * Encodes string buffer to stream. If buffer is NULL empty string is encoded
       
    93      * @param aString string buffer to be encoded to stream
       
    94      * @param aWriteStream stream to which string is encoded
       
    95      **/
       
    96     static void EncodeL( HBufC8* aString, RWriteStream& aWriteStream );
       
    97     
       
    98     /**
       
    99      * Decodes string buffer from stream
       
   100      * @param aBuffer placeholder for data to be read from stream
       
   101      * @param aReadStream stream from which data is decoded
       
   102      **/
       
   103     static void DecodeL( HBufC8*& aBuffer, RReadStream& aReadStream );
       
   104 
       
   105     /**
       
   106      * Decodes descriptor array from stream
       
   107      * @param aArray placeholder for data to be read from stream
       
   108      * @param aReadStream stream from which data is decoded
       
   109      **/
       
   110     static void DecodeL( CDesC8Array*& aArray, RReadStream& aReadStream );
       
   111 
       
   112     /**
       
   113      * Encodes descriptor array  to stream. If arrays is NULL empty arrays is encoded
       
   114      * @param aArray  descriptor array to be encoded to stream
       
   115      * @param aWriteStream stream to which string is encoded
       
   116      **/
       
   117     static void EncodeL( CDesC8Array* aArray, RWriteStream& aWriteStream );
       
   118     
       
   119     /**
       
   120      * Decodes media id from stream
       
   121      * @param aId placeholder for data to be read from stream
       
   122      * @param aReadStream stream from which data is decoded
       
   123      **/
       
   124     static void DecodeL( TMceMediaId& aId, RReadStream& aReadStream );
       
   125 
       
   126     /**
       
   127      * Encodes media id to stream. 
       
   128      * @param aId media id  to be encoded to stream
       
   129      * @param aWriteStream stream to which media id is encoded
       
   130      **/
       
   131     static void EncodeL( TMceMediaId aId, RWriteStream& aWriteStream );
       
   132 	
       
   133 	static void EncodeL( RArray<TMceCryptoContext>& aArray, RWriteStream& aWriteStream  );
       
   134     
       
   135     static void DecodeL( RArray<TMceCryptoContext>& aArray, RReadStream& aReadStream );
       
   136     };
       
   137     
       
   138 
       
   139 
       
   140 /**
       
   141  * Base class of messages passed between client and server
       
   142  *
       
   143  * @lib 
       
   144  */
       
   145 class CMceMsgBase : public CBase
       
   146     {
       
   147         
       
   148 public:
       
   149 
       
   150     /**
       
   151     * C++ constructor
       
   152     * @param aType  the type of message
       
   153     **/
       
   154     CMceMsgBase( TMceItcDataType aType );
       
   155     
       
   156     /**
       
   157     * C++ destructor
       
   158     **/
       
   159     ~CMceMsgBase();
       
   160 
       
   161     /**
       
   162      * Encodes message
       
   163      **/
       
   164     virtual void EncodeL() = 0;
       
   165 
       
   166     /**
       
   167      * Decodes message from descriptor
       
   168      * @param aContext encoded string representing this message
       
   169      **/
       
   170     void DecodeL( const TDesC8& aContext );
       
   171 
       
   172     /**
       
   173     * Decodes message from stream
       
   174     * @param aReadStream encoded string representing 
       
   175     * this message as stream
       
   176     * @param aReadStream the stream
       
   177     **/
       
   178     virtual void DoDecodeL( RReadStream& aReadStream ) = 0;
       
   179     
       
   180     /**
       
   181     * Decodes message from stream
       
   182     * @param aSerCtx containing stream as encoded string representing 
       
   183     * this message as stream
       
   184     **/
       
   185     virtual void DoDecodeL( MMceComSerializationContext& aSerCtx );
       
   186         
       
   187     /**
       
   188     * Returns type of message
       
   189     * @returnt ype of message
       
   190     **/
       
   191     TMceItcDataType Type();
       
   192         
       
   193     /**
       
   194     * Returns buffer to which messge has been encoded
       
   195     * @return buffer to which messge has been encoded
       
   196     **/
       
   197     CBufFlat& EncodeBuffer();
       
   198 
       
   199     /**
       
   200     * Clones encode buffer
       
   201     * @return cloned encode buffer
       
   202     **/
       
   203     HBufC8* EncodeBufferCloneL();
       
   204 
       
   205     /**
       
   206     * Pushes all (encoded) data to cleanup stack
       
   207     **/
       
   208 	virtual void PushL();
       
   209 
       
   210     /**
       
   211     * Pops all (encoded) data from cleanup stack
       
   212     **/
       
   213 	virtual void Pop();
       
   214 	    
       
   215     /**
       
   216     * Destroys all (encoded) data
       
   217     **/
       
   218     virtual void Close() = 0;
       
   219     
       
   220     /**
       
   221     * Handles ownership rollback of leave situations.
       
   222     **/
       
   223     void OwnershipRollbackPushLC();
       
   224     
       
   225 protected:
       
   226 
       
   227     /**
       
   228 	* TCleanupItem funtion.
       
   229 	*/
       
   230 	static void OwnershipRollback( TAny* aData );
       
   231 	
       
   232     /**
       
   233     * Releases ownership of certain owned member data.
       
   234     */
       
   235     virtual void DoOwnershipRollback();
       
   236     	    
       
   237 protected://output
       
   238 
       
   239     CBufFlat* iEncodeBuf;
       
   240     
       
   241     TMceItcDataType iType;
       
   242     
       
   243     TBool iPushed;
       
   244     
       
   245     };
       
   246 
       
   247 
       
   248 /**
       
   249  * Message for transferring descriptor array
       
   250  * between client and server
       
   251  *
       
   252  * @lib 
       
   253  */
       
   254 class CMceMsgTextArray : public CMceMsgBase
       
   255     {
       
   256 public:
       
   257 
       
   258     /**
       
   259     * C++ constructor for decoding
       
   260     **/
       
   261     CMceMsgTextArray();
       
   262     
       
   263     /**
       
   264     * C++ constructor for encoding
       
   265     * @param aArray data to be encoded
       
   266     **/
       
   267     CMceMsgTextArray( CDesC8Array& aArray );
       
   268 
       
   269     /**
       
   270     * Destructor
       
   271     **/
       
   272     ~CMceMsgTextArray();
       
   273     
       
   274     /**
       
   275      * Encodes message
       
   276      **/
       
   277     void EncodeL();
       
   278     
       
   279     /**
       
   280     * Decodes message from stream
       
   281     * @param aReadStream encoded string representing 
       
   282     * this message as stream
       
   283     * @param aReadStream the stream
       
   284     **/
       
   285     void DoDecodeL( RReadStream& aReadStream );
       
   286 
       
   287     /**
       
   288     * Destroys all (encoded) data
       
   289     **/
       
   290 	void Close();
       
   291 	
       
   292     /**
       
   293     * Destroys all (encoded) data
       
   294     **/
       
   295 	void LocalClose();
       
   296 	
       
   297     /**
       
   298     * Transfers ownership
       
   299     * @return array 
       
   300     **/
       
   301     CDesC8Array* Array();
       
   302 	
       
   303                    
       
   304 public://input/output
       
   305     
       
   306     CDesC8Array* iArray;
       
   307     };
       
   308 
       
   309 
       
   310 
       
   311 /**
       
   312  * Message for transferring SIP data
       
   313  * between client and server
       
   314  *
       
   315  * @lib 
       
   316  */
       
   317 class CMceMsgSIPData : public CMceMsgBase
       
   318     {
       
   319 
       
   320 
       
   321 public:
       
   322 
       
   323     /**
       
   324     * C++ constructor for decoding
       
   325     **/
       
   326     CMceMsgSIPData();
       
   327 
       
   328     
       
   329     /**
       
   330     * C++ constructor for encoding
       
   331     * @param aTrxType data to be encoded
       
   332     * @param aSIPHeaders data to be encoded
       
   333     * @param aContentType data to be encoded
       
   334     **/
       
   335     CMceMsgSIPData( TUint32 aTrxType,
       
   336                     CDesC8Array& aSIPHeaders,
       
   337                     HBufC8& aContentType );
       
   338     
       
   339     /**
       
   340     * Destructor
       
   341     **/
       
   342     ~CMceMsgSIPData();
       
   343     
       
   344 protected:
       
   345                      
       
   346     /**
       
   347     * C++ constructor for encoding
       
   348     * @param aType type of message
       
   349     **/
       
   350     CMceMsgSIPData( TMceItcDataType aType );
       
   351     
       
   352     /**
       
   353     * C++ constructor for encoding
       
   354     * @param aType type of message
       
   355     * @param aTrxType data to be encoded
       
   356     * @param aSIPHeaders data to be encoded
       
   357     * @param aContentType data to be encoded
       
   358     **/
       
   359     CMceMsgSIPData( TMceItcDataType aType,
       
   360                     TUint32 aTrxType,
       
   361                     CDesC8Array& aSIPHeaders,
       
   362                     HBufC8& aContentType );
       
   363                     
       
   364     /**
       
   365     * Encodes message to stream
       
   366     * @param aWriteStream the stream
       
   367     **/
       
   368     void EncodeStreamL( RBufWriteStream& aWriteStream );
       
   369 
       
   370 
       
   371 public:
       
   372                     
       
   373     /**
       
   374      * Encodes message
       
   375      **/
       
   376     void EncodeL();
       
   377     
       
   378     /**
       
   379     * Decodes message from stream
       
   380     * @param aReadStream encoded string representing 
       
   381     * this message as stream
       
   382     * @param aReadStream the stream
       
   383     **/
       
   384     void DoDecodeL( RReadStream& aReadStream );
       
   385     
       
   386     /**
       
   387     * Destroys all (encoded) data
       
   388     **/
       
   389 	void Close();
       
   390 
       
   391     /**
       
   392     * Destroys all (encoded) data
       
   393     **/
       
   394 	void LocalClose();
       
   395 	
       
   396     /**
       
   397     * Transfers ownership
       
   398     * @return SIP headers 
       
   399     **/
       
   400     CDesC8Array* Headers();
       
   401 
       
   402     /**
       
   403     * Transfers ownership
       
   404     * @return content type 
       
   405     **/
       
   406     HBufC8* ContentType();
       
   407 
       
   408 protected:
       
   409 
       
   410     /**
       
   411     * Releases ownership of certain owned member data.
       
   412     */
       
   413     void DoOwnershipRollback();
       
   414                       
       
   415 public://input/output
       
   416     
       
   417     //method code from SipStrings
       
   418     TUint32 iTrxType;
       
   419     
       
   420     //sip headers
       
   421     CDesC8Array* iSIPHeaders;
       
   422     
       
   423     //content type
       
   424     HBufC8* iContentType;
       
   425     
       
   426 public://internal 
       
   427 
       
   428     TMceContentType iContentTypeId;
       
   429     
       
   430     };
       
   431 
       
   432 
       
   433 /**
       
   434  * Message for transferring SIP reply
       
   435  * between client and server
       
   436  *
       
   437  * @lib 
       
   438  */
       
   439 class CMceMsgSIPReply : public CMceMsgSIPData
       
   440     {
       
   441 public:
       
   442 
       
   443     /**
       
   444     * C++ constructor for decoding
       
   445     **/
       
   446     CMceMsgSIPReply();
       
   447 
       
   448     /**
       
   449     * C++ constructor for encoding
       
   450     * @param aTrxType data to be encoded
       
   451     * @param aReason data to be encoded
       
   452     * @param aCode data to be encoded
       
   453     * @param aSIPHeaders data to be encoded
       
   454     * @param aContentType data to be encoded
       
   455     **/
       
   456     CMceMsgSIPReply( TUint32 aTrxType,
       
   457                      HBufC8& aReason, TUint32 aCode,
       
   458                      CDesC8Array& aSIPHeaders,
       
   459                      HBufC8& aContentType );
       
   460     
       
   461     /**
       
   462     * C++ constructor for encoding
       
   463     * @param aReason data to be encoded
       
   464     * @param aCode data to be encoded
       
   465     * @param aSIPHeaders data to be encoded
       
   466     * @param aContentType data to be encoded
       
   467     **/
       
   468     CMceMsgSIPReply( HBufC8& aReason, TUint32 aCode,
       
   469                      CDesC8Array& aSIPHeaders,
       
   470                      HBufC8& aContentType );
       
   471                      
       
   472     /**
       
   473     * Destructor
       
   474     **/
       
   475     ~CMceMsgSIPReply();
       
   476     
       
   477     /**
       
   478     * Encodes message
       
   479     **/
       
   480     void EncodeL();
       
   481     
       
   482     /**
       
   483     * Decodes message from stream
       
   484     * @param aReadStream encoded string representing 
       
   485     * this message as stream
       
   486     * @param aReadStream the stream
       
   487     **/
       
   488     void DoDecodeL( RReadStream& aReadStream );
       
   489     
       
   490     /**
       
   491     * Destroys all (encoded) data
       
   492     **/
       
   493 	void Close();
       
   494 
       
   495     /**
       
   496     * Destroys all (encoded) data
       
   497     **/
       
   498 	void LocalClose();
       
   499 	
       
   500     /**
       
   501     * Transfers ownership
       
   502     * @return reason 
       
   503     **/
       
   504     HBufC8* Reason();
       
   505                    
       
   506 public://input/output
       
   507     
       
   508     HBufC8* iReason;
       
   509     TUint32 iCode;
       
   510     
       
   511 public://internal
       
   512 
       
   513     TInt iReasonAsPoolIndex;    
       
   514     
       
   515     };
       
   516 /** 
       
   517  * Message for transferring SIP request
       
   518  * between client and server
       
   519  *
       
   520  * @lib 
       
   521  */
       
   522 class CMceMsgSIPRequest : public CMceMsgSIPData
       
   523     {
       
   524 public:
       
   525 
       
   526     /**
       
   527     * C++ constructor for decoding
       
   528     **/
       
   529     CMceMsgSIPRequest();
       
   530 
       
   531        
       
   532     /**
       
   533     * C++ constructor for encoding
       
   534     * @param aReason data to be encoded
       
   535     * @param aCode data to be encoded
       
   536     * @param aSIPHeaders data to be encoded
       
   537     * @param aContentType data to be encoded
       
   538     **/
       
   539     CMceMsgSIPRequest( HBufC8& aMethod,
       
   540                      CDesC8Array& aSIPHeaders,
       
   541                      HBufC8& aContentType );
       
   542                      
       
   543     /**
       
   544     * Destructor
       
   545     **/
       
   546     ~CMceMsgSIPRequest();
       
   547     
       
   548     
       
   549     /**
       
   550     * Encodes message
       
   551     **/
       
   552     void EncodeL();
       
   553     
       
   554     /**
       
   555     * Decodes message from stream
       
   556     * @param aReadStream encoded string representing 
       
   557     * this message as stream
       
   558     * @param aReadStream the stream
       
   559     **/
       
   560     void DoDecodeL( RReadStream& aReadStream );
       
   561 
       
   562 
       
   563 
       
   564 private:
       
   565 
       
   566     /**
       
   567     * Destroys all (encoded) data
       
   568     **/
       
   569 	void Close();
       
   570 
       
   571     /**
       
   572     * Destroys all (encoded) data
       
   573     **/
       
   574 	void LocalClose();
       
   575 	
       
   576 	
       
   577 	
       
   578 public:
       
   579 
       
   580     // Returns the request Method, ownership is transfered.
       
   581     HBufC8* RequestMethod();
       
   582     
       
   583 
       
   584 private://input/output
       
   585     
       
   586     HBufC8* iMethod;
       
   587     };
       
   588 
       
   589 
       
   590 
       
   591 /**
       
   592  * Message for transferring SIP event
       
   593  * between client and server
       
   594  *
       
   595  * @lib 
       
   596  */
       
   597 class CMceMsgSIPEvent : public CMceMsgSIPData
       
   598     {
       
   599 public:
       
   600 
       
   601     /**
       
   602     * C++ constructor for decoding
       
   603     **/
       
   604     CMceMsgSIPEvent();
       
   605     
       
   606     /**
       
   607     * C++ constructor for encoding
       
   608     * @param aId data to be encoded
       
   609     * @param aDialogId data to be encoded
       
   610     * @param aEventType data to be encoded
       
   611     * @param aRecipient data to be encoded
       
   612     * @param aOriginator data to be encoded
       
   613     * @param aEventHeader data to be encoded
       
   614     * @param aReferTo data to be encoded
       
   615     * @param aReferType data to be encoded
       
   616     * @param aRefreshInterval data to be encoded
       
   617     * @param aSIPHeaders data to be encoded
       
   618     * @param aContentType data to be encoded
       
   619     **/
       
   620     CMceMsgSIPEvent( TUint32 aId,
       
   621                      TUint32 aDialogId,
       
   622                      TMceItcEventType aEventType,
       
   623                      HBufC8* aRecipient,
       
   624                      HBufC8* aOriginator,
       
   625                      HBufC8* aEventHeader,
       
   626                      HBufC8* aReferTo,
       
   627                      CMceRefer::TType aReferType,
       
   628                      TUint32 aRefreshInterval,
       
   629                      CDesC8Array* aSIPHeaders,
       
   630                      HBufC8* aContentType );
       
   631 
       
   632     /**
       
   633     * C++ constructor for encoding
       
   634     * @param aId data to be encoded
       
   635     * @param aDialogId data to be encoded
       
   636     * @param aEventType data to be encoded
       
   637     * @param aReferType data to be encoded
       
   638     * @param aRefreshInterval data to be encoded
       
   639     * @param aSIPHeaders data to be encoded
       
   640     * @param aContentType data to be encoded
       
   641     **/
       
   642     CMceMsgSIPEvent( TUint32 aId,
       
   643                      TUint32 aDialogId,
       
   644                      TMceItcEventType aEventType,
       
   645                      CMceRefer::TType aReferType,
       
   646                      TUint32 aRefreshInterval,
       
   647                      CDesC8Array* aSIPHeaders,
       
   648                      HBufC8* aContentType );
       
   649                   
       
   650     ~CMceMsgSIPEvent();
       
   651 
       
   652     /**
       
   653     * Encodes message
       
   654     **/
       
   655     void EncodeL();
       
   656     
       
   657     /**
       
   658     * Decodes message from stream
       
   659     * @param aReadStream encoded string representing 
       
   660     * this message as stream
       
   661     * @param aReadStream the stream
       
   662     **/
       
   663     void DoDecodeL( RReadStream& aReadStream );
       
   664 
       
   665 private:
       
   666 
       
   667     /**
       
   668     * Destroys all (encoded) data
       
   669     **/
       
   670 	void Close();
       
   671 
       
   672     /**
       
   673     * Destroys all (encoded) data
       
   674     **/
       
   675 	void LocalClose();
       
   676 
       
   677 public:
       
   678 	// Getters for members
       
   679 	
       
   680 	// Returns the ID.
       
   681 	TUint32 Id();
       
   682 	
       
   683 	// Returns the dialog ID.
       
   684 	TUint32 DialogId();
       
   685 	
       
   686 	// Returns the event type.
       
   687 	TUint32 EventType();
       
   688 	
       
   689 	// Returns the recipient, ownership is transfered.
       
   690     HBufC8* Recipient();
       
   691     
       
   692     // Returns the originator, ownership is transfered.
       
   693     HBufC8* Originator();
       
   694     
       
   695     // Returns the event header, ownership is transfered.
       
   696     HBufC8* EventHeader();
       
   697     
       
   698     // Returns the refer-to header, ownership is transfered.
       
   699     HBufC8* ReferTo();
       
   700     
       
   701     // Returns the refer type.
       
   702 	TUint32 ReferType();
       
   703 	
       
   704 	// Returns the refresh interval.
       
   705 	TUint32 RefreshInterval();
       
   706     
       
   707     // Returns the SIP headers, ownership is transfered.
       
   708     CDesC8Array* SIPHeaders();
       
   709     
       
   710     // Returns the content type, ownership is transfered.
       
   711     HBufC8* ContentType();
       
   712 
       
   713 protected:
       
   714 
       
   715     /**
       
   716     * Releases ownership of certain owned member data.
       
   717     */
       
   718     void DoOwnershipRollback();
       
   719         
       
   720 private://input/output
       
   721     
       
   722     TUint32 iId;
       
   723     TUint32 iDialogId;
       
   724     TUint32 iEventType;
       
   725     HBufC8* iRecipient;
       
   726     HBufC8* iOriginator;
       
   727     HBufC8* iEventHeader;
       
   728     HBufC8* iReferTo;
       
   729     TUint32 iReferType;
       
   730     TUint32 iRefreshInterval;
       
   731     
       
   732     //for testing
       
   733 
       
   734 	MCE_UNIT_TEST_DEFS	
       
   735     };
       
   736     
       
   737 
       
   738 
       
   739 /**
       
   740  * Message for transferring objects between client and server
       
   741  * The class of object must implement:
       
   742  * - ExternalizeL( RWriteStream& aWriteStream )
       
   743  * - Factory(), which implements CreateLC( RReadStream& aReadStream )
       
   744  *
       
   745  * @lib 
       
   746  */
       
   747 template <class T> 
       
   748 class CMceMsgObject : public CMceMsgBase
       
   749     {
       
   750 public:
       
   751 
       
   752     /**
       
   753     * C++ constructor for decoding
       
   754     **/
       
   755     inline CMceMsgObject();
       
   756     
       
   757     /**
       
   758     * C++ constructor for encoding
       
   759     * @param aObject data to be encoded
       
   760     * @param aItcType data to be encoded
       
   761     **/
       
   762     inline CMceMsgObject( T& aObject, TMceItcDataType aItcType );
       
   763 
       
   764     /**
       
   765     * C++ destructor
       
   766     **/
       
   767     inline ~CMceMsgObject();
       
   768     
       
   769     /**
       
   770     * Encodes message
       
   771     **/
       
   772     inline void EncodeL();
       
   773     
       
   774     /**
       
   775     * Decodes message from stream
       
   776     * @param aReadStream encoded string representing 
       
   777     * this message as stream
       
   778     * @param aReadStream the stream
       
   779     **/
       
   780     inline void DoDecodeL( RReadStream& aReadStream );
       
   781     
       
   782     /**
       
   783     * Decodes message from stream
       
   784     * @param aSerCtx containing stream as encoded string representing 
       
   785     * this message as stream
       
   786     **/
       
   787     inline void DoDecodeL( MMceComSerializationContext& aSerCtx );
       
   788 
       
   789     /**
       
   790     * Transfers ownership
       
   791     * @return object 
       
   792     **/
       
   793     inline T* Object();
       
   794     
       
   795     /**
       
   796     * Destroys all (encoded) data
       
   797     **/
       
   798 	inline void Close();
       
   799 
       
   800     /**
       
   801     * Destroys all (encoded) data
       
   802     **/
       
   803 	inline void LocalClose();
       
   804                        
       
   805 public://input/output
       
   806     
       
   807     T* iObject;
       
   808         
       
   809     };
       
   810 
       
   811 
       
   812 /**
       
   813  * Message for transferring arrays of messages 
       
   814  * between client and server
       
   815  *
       
   816  * @lib 
       
   817  */
       
   818 template <class T> 
       
   819 class CMceMsgArray : public CMceMsgBase
       
   820     {
       
   821 public:
       
   822 
       
   823     /**
       
   824     * C++ constructor for encoding/decoding
       
   825     * aFactory factory, which can encode messages
       
   826     * based on message type
       
   827     **/
       
   828     inline CMceMsgArray( T& aFactory );
       
   829 
       
   830     inline ~CMceMsgArray();
       
   831 
       
   832 public:
       
   833                     
       
   834     /**
       
   835     * Encodes message
       
   836     **/
       
   837     inline void EncodeL();
       
   838         
       
   839     /**
       
   840     * Decodes message from stream
       
   841     * @param aReadStream encoded string representing 
       
   842     * this message as stream
       
   843     * @param aReadStream the stream
       
   844     **/
       
   845     inline void DoDecodeL( RReadStream& aReadStream );
       
   846     
       
   847     /**
       
   848     * Destroys all (encoded) data
       
   849     **/
       
   850 	inline void Close();
       
   851 
       
   852     /**
       
   853     * Destroys all (encoded) data
       
   854     **/
       
   855 	inline void LocalClose();
       
   856                    
       
   857 public://input/output
       
   858     
       
   859     RPointerArray<CMceMsgBase> iArray;
       
   860     T& iFactory;
       
   861         
       
   862     };
       
   863 
       
   864 
       
   865 	    
       
   866 /**
       
   867  * One-way stream serializer for Server and Client side stream
       
   868  *
       
   869  * @lib 
       
   870  */
       
   871 template <class T>
       
   872 class TMceMediaStreamSerializer
       
   873     {
       
   874     
       
   875 public:
       
   876 
       
   877     /**
       
   878     * Constructor for internalization for server side
       
   879     * @param aStream the stream
       
   880     */
       
   881     inline TMceMediaStreamSerializer( T& aStream );
       
   882 
       
   883     /**
       
   884     * Constructor for internalization for client side
       
   885     * @param aStream the stream
       
   886     * @param aFlatData to which flat data is fetched
       
   887     */
       
   888     inline TMceMediaStreamSerializer( T& aStream, CMceComMediaStream* aFlatData );
       
   889 
       
   890     /**
       
   891     * Internalizes
       
   892     * @param aSerCtx context for serialization
       
   893     */
       
   894     inline void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   895 
       
   896     /**
       
   897     * Externalizes
       
   898     * @param aSerCtx context for serialization
       
   899     */
       
   900     inline void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   901 
       
   902 
       
   903 private:
       
   904 
       
   905     /**
       
   906     * Server / client side stream
       
   907     */
       
   908     T& iStream;
       
   909 
       
   910     /**
       
   911     * Flat data container
       
   912     */
       
   913     CMceComMediaStream* iFlatData;
       
   914     
       
   915     };
       
   916     
       
   917 
       
   918 
       
   919 /**
       
   920  * Session serializer for Server and Client side session
       
   921  *
       
   922  * @lib 
       
   923  */
       
   924 template <class T>
       
   925 class TMceSessionSerializer
       
   926     {
       
   927     
       
   928 public:
       
   929 
       
   930     /**
       
   931     * Constructor for internalization for server side
       
   932     * @param aSession the session
       
   933     */
       
   934     inline TMceSessionSerializer( T& aSession );
       
   935 
       
   936     /**
       
   937     * Constructor for internalization for client side
       
   938     * @param aSession the session
       
   939     * @param aFlatData to which flat data is fetched
       
   940     */
       
   941     inline TMceSessionSerializer( T& aSession, CMceComSession*  aFlatData );
       
   942 
       
   943     /**
       
   944     * Internalizes
       
   945     * @param aSerCtx context for serialization
       
   946     */
       
   947     inline void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   948 
       
   949     /**
       
   950     * Externalizes
       
   951     * @param aSerCtx context for serialization
       
   952     */
       
   953     inline void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   954 
       
   955 
       
   956 private:
       
   957 
       
   958     /**
       
   959     * Server / client side session
       
   960     */
       
   961     T& iSession;
       
   962 
       
   963     /**
       
   964     * Flat data container
       
   965     */
       
   966     CMceComSession* iFlatData;
       
   967     
       
   968     };
       
   969     
       
   970 
       
   971 /**
       
   972  * audio stream serializer for Server and Client side stream
       
   973  *
       
   974  * @lib 
       
   975  */
       
   976 template <class T>
       
   977 class TMceAudioStreamSerializer
       
   978     {
       
   979     
       
   980 public:
       
   981 
       
   982     /**
       
   983     * Constructor for internalization for server side
       
   984     * @param aStream the stream
       
   985     */
       
   986     inline TMceAudioStreamSerializer( T& aStream );
       
   987 
       
   988     /**
       
   989     * Internalizes
       
   990     * @param aSerCtx context for serialization
       
   991     */
       
   992     inline void InternalizeL( MMceComSerializationContext& aSerCtx );
       
   993 
       
   994     /**
       
   995     * Externalizes
       
   996     * @param aSerCtx context for serialization
       
   997     */
       
   998     inline void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
   999 
       
  1000 
       
  1001 private:
       
  1002 
       
  1003       
       
  1004     /**
       
  1005     * Server / client side stream
       
  1006     */
       
  1007     T& iAudioStream;
       
  1008 
       
  1009     };
       
  1010 
       
  1011 
       
  1012 /**
       
  1013  * Video stream serializer for Server and Client side stream
       
  1014  *
       
  1015  * @lib 
       
  1016  */
       
  1017 template <class T>
       
  1018 class TMceVideoStreamSerializer
       
  1019     {
       
  1020     
       
  1021 public:
       
  1022 
       
  1023     /**
       
  1024     * Constructor for internalization for server side
       
  1025     * @param aStream the stream
       
  1026     */
       
  1027     inline TMceVideoStreamSerializer( T& aStream );
       
  1028 
       
  1029     /**
       
  1030     * Internalizes
       
  1031     * @param aSerCtx context for serialization
       
  1032     */
       
  1033     inline void InternalizeL( MMceComSerializationContext& aSerCtx );
       
  1034 
       
  1035     /**
       
  1036     * Externalizes
       
  1037     * @param aSerCtx context for serialization
       
  1038     */
       
  1039     inline void ExternalizeL( MMceComSerializationContext& aSerCtx );
       
  1040 
       
  1041 
       
  1042 private:
       
  1043 
       
  1044       
       
  1045     /**
       
  1046     * Server / client side stream
       
  1047     */
       
  1048     T& iVideoStream;
       
  1049 
       
  1050     };
       
  1051 
       
  1052 
       
  1053 
       
  1054 
       
  1055 #include "mceserial.inl"
       
  1056 
       
  1057 
       
  1058 #endif