Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 
     19 #ifndef PVMF_PROTOCOLENGINE_NODE_H_INCLUDED
     20 #define PVMF_PROTOCOLENGINE_NODE_H_INCLUDED
     21 
     22 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
     23 #include "pvmf_node_interface.h"
     24 #endif
     25 
     26 #ifndef PVMF_NODE_UTILS_H_INCLUDED
     27 #include "pvmf_node_utils.h"
     28 #endif
     29 
     30 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
     31 #include "oscl_scheduler_ao.h"
     32 #endif
     33 
     34 #ifndef PVMF_POOL_BUFFER_ALLOCATOR_H_INCLUDED
     35 #include "pvmf_pool_buffer_allocator.h"
     36 #endif
     37 
     38 #ifndef PVMI_CONFIG_AND_CAPABILITY_H_INCLUDED
     39 #include "pvmi_config_and_capability.h"
     40 #endif
     41 
     42 #ifndef PVMF_MEMPOOL_H_INCLUDED
     43 #include "pvmf_mempool.h"
     44 #endif
     45 
     46 #ifndef PVMI_DATA_STREAM_INTERFACE_H_INCLUED
     47 #include "pvmi_data_stream_interface.h"
     48 #endif
     49 
     50 #ifndef PVMF_PROTOCOLENGINE_PORT_H_INCLUDED
     51 #include "pvmf_protocol_engine_port.h"
     52 #endif
     53 
     54 #ifndef PVMF_PROTOCOLENGINE_DEFS_H_INCLUDED
     55 #include "pvmf_protocol_engine_defs.h"
     56 #endif
     57 
     58 #ifndef PVMF_DATA_SOURCE_INIT_EXTENSION_H_INCLUDED
     59 #include "pvmf_data_source_init_extension.h"
     60 #endif
     61 
     62 #ifndef PVMI_DATASTREAMUSER_INTERFACE_H_INCLUDED
     63 #include "pvmi_datastreamuser_interface.h"
     64 #endif
     65 
     66 #ifndef PVMF_PROTOCOLENGINE_NODE_EXTENSION_H_INCLUDED
     67 #include "pvmf_protocol_engine_node_extension.h"
     68 #endif
     69 
     70 #ifndef PVMF_PROTOCOLENGINE_NODE_EVENTS_H_INCLUDED
     71 #include "pvmf_protocol_engine_node_events.h"
     72 #endif
     73 
     74 #ifndef PVMF_DOWNLOAD_PROGRESS_EXTENSION_H
     75 #include "pvmf_download_progress_interface.h"
     76 #endif
     77 
     78 #ifndef PVMF_TRACK_SELECTION_EXTENSION_H_INCLUDED
     79 #include "pvmf_track_selection_extension.h"
     80 #endif
     81 
     82 #ifndef PVMF_PROTOCOLENGINE_NODE_COMMON_H_INCLUDED
     83 #include "pvmf_protocol_engine_node_common.h"
     84 #endif
     85 
     86 #ifndef PVMF_PROTOCOLENGINE_NODE_REGISTRY_H_INCLUDED
     87 #include "pvmf_protocol_engine_node_registry.h"
     88 #endif
     89 
     90 
     91 
     92 ///////////////////////////////////////////////
     93 // The PVMFProtocolEngineNode Node Implementation Class
     94 ///////////////////////////////////////////////
     95 
     96 class PVLogger;
     97 class PVMFProtocolEnginePort;
     98 class ProtocolContainer;
     99 class ProtocolContainerFactory;
    100 class PVMFProtocolEngineNodeOutput;
    101 class PVDlCfgFileContainer;
    102 class PVMFDownloadDataSourceContainer;
    103 class SDPInfoContainer;
    104 class AutoCleanup;
    105 
    106 class PVMFProtocolEngineNode :  public PVMFNodeInterface,
    107         public OsclTimerObject,
    108         public PVMFDataSourceInitializationExtensionInterface,
    109         public PVMIDatastreamuserInterface,
    110         public PVMFProtocolEngineNodeExtensionInterface,
    111         public PVMFDownloadProgressInterface,
    112         public PVMFTrackSelectionExtensionInterface,
    113         public PVMFProtocolEngineNodeMSHTTPStreamingExtensionInterface,
    114         public ProtocolObserver,
    115         public PVMFProtocolEngineNodeOutputObserver,
    116         public OsclTimerObserver,
    117         public PvmiDataStreamRequestObserver,
    118         public EventReporterObserver,
    119         public ProtocolContainerObserver
    120 
    121 {
    122     public:
    123         PVMFProtocolEngineNode(int32 aPriority = OsclActiveObject::EPriorityNominal);
    124         virtual ~PVMFProtocolEngineNode();
    125 
    126         // From PVMFNodeInterface
    127         PVMFStatus ThreadLogon();
    128         PVMFStatus ThreadLogoff();
    129         PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability);
    130         PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL);
    131         PVMFCommandId QueryUUID(PVMFSessionId, const PvmfMimeString& aMimeType,
    132                                 Oscl_Vector<PVUuid, PVMFProtocolEngineNodeAllocator>& aUuids,
    133                                 bool aExactUuidsOnly = false,
    134                                 const OsclAny* aContext = NULL);
    135         PVMFCommandId QueryInterface(PVMFSessionId, const PVUuid& aUuid,
    136                                      PVInterface*& aInterfacePtr,
    137                                      const OsclAny* aContext = NULL);
    138         PVMFCommandId RequestPort(PVMFSessionId, int32 aPortTag, const PvmfMimeString* aPortConfig = NULL, const OsclAny* aContext = NULL);
    139         PVMFCommandId ReleasePort(PVMFSessionId, PVMFPortInterface& aPort, const OsclAny* aContext = NULL);
    140         PVMFCommandId Init(PVMFSessionId, const OsclAny* aContext = NULL);
    141         PVMFCommandId Prepare(PVMFSessionId, const OsclAny* aContext = NULL);
    142         PVMFCommandId Start(PVMFSessionId, const OsclAny* aContext = NULL);
    143         PVMFCommandId Stop(PVMFSessionId, const OsclAny* aContext = NULL);
    144         PVMFCommandId Flush(PVMFSessionId, const OsclAny* aContext = NULL);
    145         PVMFCommandId Pause(PVMFSessionId, const OsclAny* aContext = NULL);
    146         PVMFCommandId Reset(PVMFSessionId, const OsclAny* aContext = NULL);
    147         PVMFCommandId CancelAllCommands(PVMFSessionId, const OsclAny* aContextData = NULL);
    148         PVMFCommandId CancelCommand(PVMFSessionId, PVMFCommandId aCmdId, const OsclAny* aContextData = NULL);
    149 
    150         //From PVMFDataSourceInitializationExtensionInterface
    151         void addRef();
    152         void removeRef();
    153         PVMFStatus SetSourceInitializationData(OSCL_wString& aSourceURL,
    154                                                PVMFFormatType& aSourceFormat,
    155                                                OsclAny* aSourceData);
    156         PVMFStatus SetClientPlayBackClock(PVMFMediaClock* aClientClock);
    157 
    158         // From PVMFProtocolEngineNodeExtensionInterface and
    159         // From PVMFProtocolEngineNodeMSHTTPStreamingExtensionInterface
    160         PVMFStatus GetHTTPHeader(uint8*& aHeader, uint32& aHeaderLen);
    161         void GetFileSize(uint32& aFileSize)
    162         {
    163             aFileSize = (iInterfacingObjectContainer == NULL ? 0 : iInterfacingObjectContainer->getFileSize());
    164         }
    165         bool GetSocketConfig(OSCL_String &aPortConfig);
    166         bool GetSocketConfigForLogging(OSCL_String &aPortConfig);
    167         bool SetUserAgent(OSCL_wString &aUserAgent, const bool isOverwritable = false);
    168         void SetHttpVersion(const uint32 aHttpVersion = HTTP_V11);
    169         void SetNetworkTimeout(const uint32 aTimeout);
    170         void SetNetworkLoggingTimeout(const uint32 aTimeout);
    171         void SetKeepAliveTimeout(const uint32 aTimeout)
    172         {
    173             uint32 timeout = aTimeout;
    174             if ((int32)timeout < 0) timeout = 0x7fffffff;
    175             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setKeepAliveTimeout(timeout);
    176         }
    177         void SetNumRedirectTrials(const uint32 aNumTrials)
    178         {
    179             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setNumRedirectTrials(aNumTrials);
    180         }
    181         void SetHttpExtensionHeaderField(OSCL_String &aFieldKey, OSCL_String &aFieldValue, const HttpMethod aMethod = HTTP_GET, const bool aPurgeOnRedirect = false);
    182         void SetLoggingURL(OSCL_wString& aSourceURL);
    183         void SetDownloadProgressMode(const DownloadProgressMode aMode = DownloadProgressMode_TimeBased)
    184         {
    185             if (iDownloadProgess) iDownloadProgess->setDownloadProgressMode(aMode);
    186         }
    187         bool SetStreamingProxy(OSCL_wString& aProxyURL, const uint32 aProxyPort)
    188         {
    189             return (iInterfacingObjectContainer == NULL ? false : iInterfacingObjectContainer->setStreamingProxy(aProxyURL, aProxyPort));
    190         }
    191         void DisableHttpHeadRequest(const bool aDisableHeadRequest = true)
    192         {
    193             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setHttpHeadRequestDisabled(aDisableHeadRequest);
    194         }
    195         bool GetASFHeader(Oscl_Vector<OsclRefCounterMemFrag, OsclMemAllocator> &aHeader)
    196         {
    197             return iProtocol->getHeader(aHeader);
    198         }
    199         bool SetStreamParams(const PVMFProtocolEngineNodeMSHTTPStreamingParams &aParams)
    200         {
    201             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setStreamParams((PVMFProtocolEngineNodeMSHTTPStreamingParams &)aParams);
    202             return true;
    203         }
    204         PVMFCommandId Seek(PVMFSessionId aSessionId, uint64 aNPTInMS, uint32& aFirstSeqNumAfterSeek, OsclAny* aContext);
    205         PVMFCommandId BitstreamSwitch(PVMFSessionId aSessionId, uint64 aNPTInMS, uint32& aFirstSeqNumAfterSwitch, OsclAny* aContext);
    206 
    207         PVMFStatus SetMediaMsgAllocatorNumBuffers(PVMFPortInterface* aPort, uint32 aNumBuffersInAllocator)
    208         {
    209             OSCL_UNUSED_ARG(aPort);
    210             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setMediaMsgAllocatorNumBuffers(aNumBuffersInAllocator);
    211             return PVMFSuccess;
    212         }
    213         void SetMaxASFHeaderSize(const uint32 aMaxASFHeaderSize = PVPROTOCOLENGINE_DEFAULT_MAXIMUM_ASF_HEADER_SIZE)
    214         {
    215             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setMaxASFHeaderSize(aMaxASFHeaderSize);
    216         }
    217         void SetUserAuthInfo(OSCL_String &aUserID, OSCL_String &aPasswd)
    218         {
    219             if (iInterfacingObjectContainer) iInterfacingObjectContainer->setUserAuthInfo(aUserID, aPasswd);
    220         }
    221         bool IsWMServerVersion4();
    222         void SetAccelBitrate(const uint32 aAccelBitrate)
    223         {
    224             if (iInterfacingObjectContainer) iInterfacingObjectContainer->SetAccelBitrate(aAccelBitrate);
    225         }
    226         void SetAccelDuration(const uint32 aAccelDuration)
    227         {
    228             if (iInterfacingObjectContainer) iInterfacingObjectContainer->SetAccelDuration(aAccelDuration);
    229         }
    230 
    231         void SetNumBuffersInMediaDataPoolSMCalc(uint32 aVal)
    232         {
    233             iInterfacingObjectContainer->setNumBuffersInMediaDataPoolSMCalc(aVal);
    234         }
    235 
    236         void SetMaxHttpStreamingSize(const uint32 aMaxHttpStreamingSize)
    237         {
    238             if (iInterfacingObjectContainer) iInterfacingObjectContainer->SetMaxHttpStreamingSize(aMaxHttpStreamingSize);
    239         }
    240 
    241         // From PVMIDatastreamuserInterface
    242         void PassDatastreamFactory(PVMFDataStreamFactory& aFactory, int32 aFactoryTag, const PvmfMimeString* aFactoryConfig = NULL);
    243 
    244         // From PVMFDownloadProgressInterface
    245         void setFormatDownloadSupportInterface(PVMFFormatProgDownloadSupportInterface* download_support_interface);
    246         void setClipDuration(const uint32 aClipDurationMsec);
    247         OsclSharedPtr<PVMFMediaClock> getDownloadProgressClock();
    248         void requestResumeNotification(const uint32 currentNPTReadPosition,
    249                                        bool& aDownloadComplete);
    250         void cancelResumeNotification();
    251         bool queryInterface(const PVUuid& uuid, PVInterface*& iface);
    252 
    253         //From PVMFTrackSelectionExtensionInterface
    254         OSCL_IMPORT_REF PVMFStatus GetMediaPresentationInfo(PVMFMediaPresentationInfo& aInfo);
    255         PVMFStatus SelectTracks(PVMFMediaPresentationInfo& aInfo);
    256 
    257         // From PvmiDataStreamRequestObserver
    258         PvmiDataStreamCommandId DataStreamRequest(PvmiDataStreamSession aSessionID, PvmiDataStreamRequest aRequestID, OsclAny* aRequestData, OsclAny* aContextData);
    259         PvmiDataStreamStatus DataStreamRequestSync(PvmiDataStreamSession aSessionID, PvmiDataStreamRequest aRequestID, OsclAny* aRequestData);
    260 
    261         // Currently all data stream requests are repositioning requests
    262         // otherwise, we'll need to peek into the queue
    263         bool IsRepositioningRequestPending();
    264 
    265     private:
    266         //from OsclActiveObject
    267         void Run();
    268 
    269         //from PVMFPortActivityHandler
    270         void HandlePortActivity(const PVMFPortActivity& aActivity);
    271 
    272         //From PVMFDataSourceInitializationExtensionInterface, the following two APIs are not used in this node
    273         PVMFStatus SetEstimatedServerClock(PVMFMediaClock* aClientClock)
    274         {
    275             OSCL_UNUSED_ARG(aClientClock);
    276             OSCL_LEAVE(OsclErrNotSupported);
    277             return PVMFFailure;
    278         }
    279 
    280         // From PVMFDownloadProgressInterface
    281         void setMP4DownloadSupportInterface(PVMFMP4ProgDownloadSupportInterface* download_support_interface)
    282         {
    283             OSCL_UNUSED_ARG(download_support_interface);
    284         }
    285 
    286         // Port processing
    287         bool ProcessPortActivity();
    288         void QueuePortActivity(const PVMFPortActivity& aActivity);
    289         void QueueActivityIncomingMessage(const PVMFStatus aStatus, const PVMFPortActivity &aActivity); // called by ProcessPortActivity()
    290         void QueueActivityOutgoingMessage(const PVMFStatus aStatus, const PVMFPortActivity &aActivity); // called by ProcessPortActivity()
    291         PVMFStatus ProcessIncomingMsg(PVMFPortInterface* aPort);
    292         PVMFStatus ProcessOutgoingMsg(PVMFPortInterface* aPort);
    293         PVMFStatus PostProcessForMsgSentSuccess(PVMFPortInterface* aPort, PVMFSharedMediaMsgPtr &aMsg);
    294         void SendOutgoingQueueReadyEvent(PVMFPortInterface* aPort);
    295         bool SearchPortActivityInQueue(const PVMFPortActivityType aType);
    296         void ProcessOutgoingQueueReady();
    297         void UpdateTimersInProcessIncomingMsg(const bool aEOSMsg, PVMFPortInterface* aPort);
    298         void UpdateTimersInProcessOutgoingMsg(const bool isMediaData, PVMFPortInterface* aPort);
    299 
    300         //Command processing
    301         PVMFCommandId QueueCommandL(PVMFProtocolEngineNodeCommand&);
    302         bool ProcessCommand(PVMFProtocolEngineNodeCommand&);
    303         void CommandComplete(PVMFProtocolEngineNodeCmdQ&,
    304                              PVMFProtocolEngineNodeCommand&,
    305                              PVMFStatus, OsclAny* aData = NULL,
    306                              PVUuid* aEventUUID = NULL,
    307                              int32* aEventCode = NULL,
    308                              int32 aEventDataLen = 0);
    309         int32 HandleCommandComplete(PVMFProtocolEngineNodeCmdQ& aCmdQ,
    310                                     PVMFProtocolEngineNodeCommand& aCmd,
    311                                     int32 aStatus);
    312         PVMFProtocolEngineNodeCommand* FindCmd(PVMFProtocolEngineNodeCmdQ &aCmdQueue, int32 aCmdId);
    313         bool FlushPending();
    314 
    315         //Command handlers.
    316         PVMFStatus DoReset(PVMFProtocolEngineNodeCommand&);
    317         PVMFStatus DoRequestPort(PVMFProtocolEngineNodeCommand&);
    318         PVMFStatus DoReleasePort(PVMFProtocolEngineNodeCommand&);
    319         PVMFStatus DoQueryUuid(PVMFProtocolEngineNodeCommand&);
    320         PVMFStatus DoQueryInterface(PVMFProtocolEngineNodeCommand&);
    321         PVMFStatus DoInit(PVMFProtocolEngineNodeCommand&);
    322         PVMFStatus DoPrepare(PVMFProtocolEngineNodeCommand&);
    323         PVMFStatus DoStart(PVMFProtocolEngineNodeCommand&);
    324         PVMFStatus DoStop(PVMFProtocolEngineNodeCommand&);
    325         PVMFStatus DoFlush(PVMFProtocolEngineNodeCommand&);
    326         PVMFStatus DoPause(PVMFProtocolEngineNodeCommand&);
    327         PVMFStatus DoCancelAllCommands(PVMFProtocolEngineNodeCommand&);
    328         PVMFStatus DoCancelCommand(PVMFProtocolEngineNodeCommand&);
    329         PVMFStatus DoSeek(PVMFProtocolEngineNodeCommand&);
    330         PVMFStatus DoBitsteamSwitch(PVMFProtocolEngineNodeCommand&);
    331         PVMFStatus DoReposition(PVMFProtocolEngineNodeCommand&);
    332         bool CheckAvailabilityOfDoStart(PVMFProtocolEngineNodeCommand& aCmd); // called in DoStart() only
    333         inline bool IsDataFlowEventAlreadyInQueue();
    334         void PassInObjects(); // called by DoInit()
    335 
    336         // Run decomposition
    337         bool HandleRunPortActivityProcessing();
    338         void HandleRunFlush();
    339 
    340         // Event reporting
    341         void ReportInfoEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, const int32 aEventCode = 0, OsclAny* aEventLocalBuffer = NULL, const uint32 aEventLocalBufferSize = 0);
    342         void ReportErrorEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, const int32 aEventCode = 0, int32 aEventDataLen = 0);
    343         void SetState(TPVMFNodeInterfaceState);
    344 
    345         // From OsclTimerObserver
    346         void TimeoutOccurred(int32 timerID, int32 timeoutInfo);
    347 
    348         // From ProtocolObserver
    349         void ProtocolStateComplete(const ProtocolStateCompleteInfo &aInfo);
    350         void OutputDataAvailable(OUTPUT_DATA_QUEUE &aOutputQueue, ProtocolEngineOutputDataSideInfo &aSideInfo);
    351         void ProtocolStateError(int32 aErrorCode); // server response error or other internal fatal error
    352         bool GetBufferForRequest(PVMFSharedMediaDataPtr &aMediaData);   // to contruct HTTP request
    353         void ProtocolRequestAvailable(uint32 aRequestType = ProtocolRequestType_Normaldata); // need to send to port
    354 
    355         // From PVMFProtocolEngineNodeOutputObserver
    356         void OutputBufferAvailable();
    357         void OutputBufferPoolFull();
    358         void ReadyToUpdateDownloadControl();
    359         bool QueueOutgoingMsgSentComplete(PVMFProtocolEnginePort *aPort, PVMFSharedMediaMsgPtr &aMsg, const PVMFStatus aStatus);
    360 
    361         // From EventReporterObserver
    362         void ReportEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, const int32 aEventCode = 0, OsclAny* aEventLocalBuffer = NULL, const uint32 aEventLocalBufferSize = 0);
    363         void NotifyContentTooLarge();
    364 
    365         // From ProtocolContainerObserver
    366         uint32 GetObserverState();
    367         void SetObserverState(const uint32 aState);
    368         bool DispatchEvent(PVProtocolEngineNodeInternalEvent *aEvent);
    369         bool SendMediaCommand(PVMFProtocolEnginePort *aPort, PVUid32 aCmdId, const bool isForLogging = false);
    370         void ClearRest(const bool aNeedDelete = false);
    371         void RecheduleDataFlow();
    372         void SendManualResumeNotificationEvent();
    373         bool IsRepositionCmdPending();
    374         PVMFProtocolEngineNodeCommand* FindPendingCmd(int32 aCmdId);
    375         void CompletePendingCmd(int32 status);
    376         void CompleteInputCmd(PVMFProtocolEngineNodeCommand& aCmd, int32 status);
    377         void ErasePendingCmd(PVMFProtocolEngineNodeCommand *aCmd);
    378 
    379         // Internal methods
    380         bool HandleProcessingState();
    381         void SetProcessingState(PVProtocolEngineNodePrcoessingState aState);
    382         bool DispatchInternalEvent(PVProtocolEngineNodeInternalEvent *aLatestEvent = NULL);
    383         void LogIncomingMessage(PVMFSharedMediaMsgPtr &aMsg, bool isEOS, PVMFPortInterface* aPort);
    384         bool IgnoreCurrentInputData(PVMFPortInterface* aPort, const bool isEOS, PVMFSharedMediaMsgPtr &aMsg);
    385         bool CheckEndOfProcessingInIgoreData(const bool isEOS, const bool isDataPort = true);
    386         // support GetSocketConfig and GetSocketConfigForLogging
    387         bool GetSocketConfigImp(const INetURI &aURI, OSCL_String &aPortConfig);
    388         bool ComposeSocketConfig(OSCL_String &aServerAddr, const uint32 aPortNum, OSCL_String &aPortConfig);
    389         bool CheckUsingProxy(OSCL_String &aPortConfig);
    390         bool getProxy(OSCL_String& aProxyName, uint32 &aProxyPort); // called by CheckUsingProxy() only
    391 
    392         uint32 GetProtocolType(PVMFFormatType& aSourceFormat, OsclAny* aSourceData);
    393         bool CreateProtocolObjects(OsclAny* &aProtocolInfo);
    394         bool CreateRestObjects();
    395         bool CreateEventHandlers();
    396         void DeleteProtocolObjects();
    397         void DeleteRestObjects();
    398         bool RecheckProtocolObjects(OsclAny* aSourceData, OsclAny* aPluginInfo);
    399         ProtocolContainer* CreateProtocolContainer(const uint32 aProtocolType);
    400         bool SendPortMediaCommand(PVMFProtocolEnginePort *aPort, PVUid32 aCmdId, const bool isForLogging = false);
    401         void RerunForPostProcessAfterOutgoingMsgSent(PVMFProtocolEnginePort *aPort, PVMFSharedMediaMsgPtr &aMsg);
    402         void LogPortMediaCmdQueued(PVMFProtocolEnginePort *aPort, PVUid32 aCmdId);
    403         bool CheckFormatSpecificInfoForMediaCommand(PVMFSharedMediaCmdPtr &aCmdPtr, PVUid32 aCmdId, const bool isForLogging = false);
    404         void ClearPorts(const bool aNeedDelete = false);
    405         void Clear(const bool aNeedDelete = false);
    406         void ResetClear(const bool aNeedDelete = false);
    407         void StopClear();
    408         void CancelClear();
    409         void GetObjects();
    410 
    411     private:
    412         int32 iStatusCode; // work as a global variable
    413         PVProtocolEngineNodePrcoessingState iProcessingState;
    414 
    415         // this object container contains the multiple input data from node user and output data to node user
    416         InterfacingObjectContainer *iInterfacingObjectContainer;
    417 
    418         friend class AutoCleanup;
    419         friend class PVProtocolEngineNodeInternalEventHandler;
    420         friend class ProtocolStateErrorHandler;
    421         friend class HttpHeaderAvailableHandler;
    422         friend class FirstPacketAvailableHandler;
    423         friend class NormalDataAvailableHandler;
    424         friend class ProtocolStateCompleteHandler;
    425         friend class NormalDataFlowHandler;
    426         friend class EndOfDataProcessingHandler;
    427         friend class ServerResponseErrorBypassingHandler;
    428         friend class CheckResumeNotificationHandler;
    429         friend class OutgoingMsgSentSuccessHandler;
    430 
    431         PVMFProtocolEngineNodeRegistry iRegistry;
    432         HttpBasedProtocol *iProtocol;
    433         ProtocolContainer *iProtocolContainer;
    434         ProtocolContainerFactory *iProtocolContainerFactory;
    435         PVMFProtocolEngineNodeOutput *iNodeOutput;
    436         PVProtocolEngineNodeInternalEventHandler *iEventHandlers[EVENT_HANDLER_TOTAL];
    437         PVProtocolEngineNodeInternalEventHandler *iCurrEventHandler;
    438         PVUuid iUuidForProtocolContainer;
    439 
    440         // PVDlCfgFileContainer
    441         PVDlCfgFileContainer *iCfgFileContainer;
    442         PVMFDownloadDataSourceContainer *iDownloadSource;
    443 
    444         // download control, auto-resume control
    445         DownloadControlInterface *iDownloadControl;
    446 
    447         // download progress
    448         DownloadProgressInterface *iDownloadProgess;
    449 
    450         // fasttrack only
    451         SDPInfoContainer *iSDPInfo;
    452 
    453         // user agent field
    454         UserAgentField *iUserAgentField;
    455 
    456         // report event
    457         EventReporter *iEventReport;
    458 
    459         // Fragment pool for port config format specific info for redirect
    460         OsclRefCounterMemFragAlloc *iPortConfigFSInfoAlloc;
    461         OsclMemPoolFixedChunkAllocator iPortConfigMemPool;
    462 
    463         // network timer for timeout
    464         PVMFProtocolEngineNodeTimer *iNodeTimer;
    465 
    466         Oscl_Vector<PVProtocolEngineNodeInternalEvent, PVMFProtocolEngineNodeAllocator> iInternalEventQueue;
    467 
    468 
    469         // Queue of incoming data
    470         // Input ports media msg queue should be used, but difficult without disturbing input port activity handling
    471         INPUT_DATA_QUEUE iDataInQueue; // INPUT_DATA_QUEUE is type defined in pvmf_protocol_engine_node_internal.h
    472 
    473         // Vector of ports contained in this node
    474         PVMFPortVector<PVMFProtocolEnginePort, PVMFProtocolEngineNodeAllocator> iPortVector;
    475         PVMFProtocolEnginePort *iPortInForData, *iPortInForLogging, *iPortOut;
    476         friend class PVMFProtocolEnginePort;
    477         Oscl_Vector<PVMFPortActivity, PVMFProtocolEngineNodeAllocator> iPortActivityQueue;
    478 
    479         PVMFProtocolEngineNodeCmdQ iInputCommands;
    480         PVMFProtocolEngineNodeCmdQ iCurrentCommand;
    481         PVMFNodeCapability iCapability;
    482         PVMFCommandId iCurrentCmdId;
    483         PVMFPortInterface* iCmdRespPort;
    484 
    485         PVLogger* iLogger;
    486         PVLogger* iDataPathLogger;
    487         PVLogger* iClockLogger;
    488 
    489         int32 iExtensionRefCount;
    490         PvmiDataStreamCommandId iCurrentDataStreamCmdId;
    491 };
    492 
    493 class AutoCleanup
    494 {
    495     public:
    496         AutoCleanup(PVMFProtocolEngineNode *aNode) : iNode(aNode), iNeedDeleteObjects(true)
    497         {
    498             ;
    499         }
    500         ~AutoCleanup()
    501         {
    502             if (iNode && iNeedDeleteObjects) iNode->DeleteProtocolObjects();
    503         }
    504 
    505         void cancel()
    506         {
    507             iNeedDeleteObjects = false;
    508         }
    509 
    510     private:
    511         PVMFProtocolEngineNode *iNode;
    512         bool iNeedDeleteObjects;
    513 };
    514 
    515 #endif // PVMF_PROTOCOLENGINE_NODE_H_INCLUDED
    516 
    517 
    518