• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef PVMF_PROTOCOLENGINE_DOWNLOAD_COMMON_H_INCLUDED
19 #define PVMF_PROTOCOLENGINE_DOWNLOAD_COMMON_H_INCLUDED
20 
21 #ifndef PVMF_PROTOCOLENGINE_COMMON_H_INCLUDED
22 #include "pvmf_protocol_engine_common.h"
23 #endif
24 
25 #ifndef PVDL_CONFIG_FILE_H_INCLUDED
26 #include "pvdl_config_file.h"
27 #endif
28 
29 class DownloadState : public ProtocolState
30 {
31     public:
setConfigInfo(OsclAny * aConfigInfo)32         void setConfigInfo(OsclAny* aConfigInfo)
33         {
34             iCfgFile = *((OsclSharedPtr<PVDlCfgFile> *)aConfigInfo);
35         }
36 
37         // The header for download should be http header, but node will take care of http header
getHeader(Oscl_Vector<OsclRefCounterMemFrag,OsclMemAllocator> & aHeader)38         bool getHeader(Oscl_Vector<OsclRefCounterMemFrag, OsclMemAllocator> &aHeader)
39         {
40             OSCL_UNUSED_ARG(aHeader);
41             return false;
42         }
43 
reset()44         virtual void reset()
45         {
46             iOutputDataQueue.clear();
47             ProtocolState::reset();
48         }
49 
50         // constructor
DownloadState()51         DownloadState() : iSetContentLengthFlagtoConfigFileObject(false)
52         {
53             ;
54         }
55         // virtual destructor, let internal objects destruct automatically
~DownloadState()56         virtual ~DownloadState()
57         {
58             reset();
59         }
60 
61     protected:
62         OSCL_IMPORT_REF virtual int32 processMicroStateSendRequestPreCheck();
63         OSCL_IMPORT_REF virtual int32 processMicroStateGetResponsePreCheck();
64         // To compose a request, only need to override/implement these two functions
65         OSCL_IMPORT_REF virtual void setRequestBasics();
66         OSCL_IMPORT_REF virtual bool setHeaderFields();
67         OSCL_IMPORT_REF virtual int32 updateDownloadStatistics();
68         OSCL_IMPORT_REF virtual void saveConfig();
69 
70         // shared routine for all the download protocols
71         OSCL_IMPORT_REF virtual int32 checkParsingStatus(int32 parsingStatus);
72 
73     protected:
74         OsclSharedPtr<PVDlCfgFile> iCfgFile;
75         Oscl_Vector<OsclRefCounterMemFrag, OsclMemAllocator> iOutputDataQueue;
76 
77     private:
78         bool iSetContentLengthFlagtoConfigFileObject;
79 };
80 
81 #endif // PVMF_PROTOCOLENGINE_DOWNLOAD_COMMON_H_INCLUDED
82 
83