aboutsummaryrefslogtreecommitdiff
path: root/nodes/pvprotocolenginenode/protocol_common/src/pvmf_protocol_engine_node_common.h
blob: 8b3ce5dc7db62c655fe9276ea2071ee18203c1eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
/* ------------------------------------------------------------------
 * Copyright (C) 1998-2009 PacketVideo
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 * -------------------------------------------------------------------
 */

#ifndef PVMF_PROTOCOLENGINE_NODE_COMMON_H_INCLUDED
#define PVMF_PROTOCOLENGINE_NODE_COMMON_H_INCLUDED

#ifndef OSCL_MEM_MEMPOOL_H_INCLUDED
#include "oscl_mem_mempool.h"
#endif
#ifndef PVMF_MEDIA_DATA_H_INCLUDED
#include "pvmf_media_data.h"
#endif
#ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED
#include "pvmf_simple_media_buffer.h"
#endif
#ifndef PVMF_META_DATA_TYPES_H_INCLUDED
#include "pvmf_meta_data_types.h"
#endif
#ifndef PVMF_MEDIA_MSG_FORMAT_IDS_H_INCLUDED
#include "pvmf_media_msg_format_ids.h"
#endif
#ifndef PVMI_DATASTREAMUSER_INTERFACE_H_INCLUDED
#include "pvmi_datastreamuser_interface.h"
#endif
#ifndef PVLOGGER_H_INCLUDED
#include "pvlogger.h"
#endif
#ifndef PVLOGGER_FILE_APPENDER_H_INCLUDED
#include "pvlogger_file_appender.h"
#endif
#ifndef PVMF_DOWNLOAD_DATA_SOURCE_H_INCLUDED
#include "pvmf_download_data_source.h"
#endif
#ifndef PVMF_SOURCE_CONTEXT_DATA_H_INCLUDED
#include "pvmf_source_context_data.h"
#endif
#ifndef OSCL_TIMER_H_INCLUDED
#include "oscl_timer.h"
#endif
#ifndef PVMF_PROTOCOL_ENGINE_COMMON_H_INCLUDED
#include "pvmf_protocol_engine_common.h"
#endif
#ifndef PVMF_NODE_UTILS_H_INCLUDED
#include "pvmf_node_utils.h"
#endif
#ifndef PVMF_PROTOCOL_ENGINE_NODE_EVENTS_H_INCLUDED
#include "pvmf_protocol_engine_node_events.h"
#endif
#ifndef PVMI_DATA_STREAM_INTERFACE_H_INCLUDED
#include "pvmi_data_stream_interface.h"
#endif
#ifndef PVMF_EVENT_HANDLING_H_INCLUDED
#include "pvmf_event_handling.h"
#endif
#ifndef PVMF_MEDIA_PRESENTATION_INFO_H_INCLUDED
#include "pvmf_media_presentation_info.h"
#endif
#ifndef PVMF_MEMPOOL_H_INCLUDED
#include "pvmf_mempool.h"
#endif
#ifndef PVMF_MEDIA_CLOCK_H_INCLUDED
#include "pvmf_media_clock.h"
#endif
#ifndef PVMI_KVP_H_INCLUDED
#include "pvmi_kvp.h"
#endif


//#define PVMF_PROTOCOL_ENGINE_LOG_MS_STREAMING_OUTPUT



//memory allocator type for this node.
typedef OsclMemAllocator PVMFProtocolEngineNodeAllocator;

// Structure to hold the key string info for
// AAC decnode's capability-and-config
struct PVProtocolEngineNodeKeyStringData
{
    char iString[64];
    PvmiKvpType iType;
    PvmiKvpValueType iValueType;
};

// The number of characters to allocate for the key string
#define PVPROTOCOLENGINENODECONFIG_KEYSTRING_SIZE 128

///////////////////////////////////////////////////////
// For Command implementation
///////////////////////////////////////////////////////

//Default vector reserve size
#define PVMF_PROTOCOLENGINE_NODE_COMMAND_VECTOR_RESERVE 16

//Starting value for command IDs
#define PVMF_PROTOCOLENGINE_NODE_COMMAND_ID_START 6000

enum PVMFProtocolEngineNodeCmdType
{
    PVPROTOCOLENGINE_NODE_CMD_SEEK = PVMF_GENERIC_NODE_COMMAND_LAST,
    PVPROTOCOLENGINE_NODE_CMD_BITSTREAM_SWITCH,
    PVPROTOCOLENGINE_NODE_CMD_DATASTREAM_REQUEST_REPOSITION
};

enum PVMFProtocolEngineNodeState
{
    // this is special node internal state for processing start command
    // we set node state as this state before doing the actual work for start
    // this is to differentiate the node state between pause and start without completing start command
    // this differentiation aims to ignore logging/keep-alive response when start command gets called,
    // but hasn't got completed.
    // This internal state should be gone when start command gets completed, then node state will change
    // to EPVMFNodeStarted
    PVMFProtocolEngineNodeState_BeingStarted = EPVMFNodeLastState,
};


//Node command type.
#define PVMFProtocolEngineNodeCommandBase PVMFGenericNodeCommand<PVMFProtocolEngineNodeAllocator> // to remove warning on symbian build
class PVMFProtocolEngineNodeCommand: public PVMFProtocolEngineNodeCommandBase
{
    public:
        //constructor for Custom2 command
        void Construct(PVMFSessionId s, int32 cmd, int32 arg1, int32 arg2, int32& arg3, const OsclAny*aContext)
        {
            PVMFProtocolEngineNodeCommandBase::Construct(s, cmd, aContext);
            iParam1 = (OsclAny*)arg1;
            iParam2 = (OsclAny*)arg2;
            iParam3 = (OsclAny*) & arg3;
        }
        void Parse(int32&arg1, int32&arg2, int32*&arg3)
        {
            arg1 = (int32)iParam1;
            arg2 = (int32)iParam2;
            arg3 = (int32*)iParam3;
        }

        // Constructor and parser for seek and bitstreamSwitch
        void Construct(PVMFSessionId s, int32 cmd,
                       uint64 aNPTInMS,
                       uint32& aFirstSeqNumAfterChange,
                       OsclAny* aContext)
        {
            PVMFProtocolEngineNodeCommandBase::Construct(s, cmd, aContext);
            iNPTInMS = aNPTInMS;
            iParam2 = (OsclAny*) & aFirstSeqNumAfterChange;
        }

        void Parse(uint64& aNPTInMS, uint32*& aFirstSeqNumAfterChange)
        {
            aNPTInMS = iNPTInMS;
            aFirstSeqNumAfterChange = (uint32*)iParam2;
        }

        // constructor and parser for data stream request, especially reposition request
        void Construct(PVMFSessionId s, int32 cmd,
                       PvmiDataStreamSession aSessionID,
                       PvmiDataStreamRequest aRequestID,
                       OsclAny* aRequestData,
                       PvmiDataStreamCommandId aDataStreamCmdId,
                       OsclAny* aContext)
        {
            PVMFProtocolEngineNodeCommandBase::Construct(s, cmd, aContext);
            iParam1 = (OsclAny*)aSessionID;
            iParam2 = (OsclAny*)((uint32)aRequestID);
            iParam3 = aRequestData;
            iParam4 = (OsclAny*)aDataStreamCmdId;
        }

        void Parse(PvmiDataStreamSession& aSessionID, PvmiDataStreamRequest& aRequestID,
                   OsclAny*& aRequestData, PvmiDataStreamCommandId &aDataStreamCmdId)
        {
            aSessionID   = (PvmiDataStreamSession)iParam1;
            aRequestData = iParam3;
            aDataStreamCmdId = (PvmiDataStreamCommandId)iParam4;
            uint32 requestIDNum = (uint32)iParam2;
            aRequestID   = (PvmiDataStreamRequest)requestIDNum;
        }

        void Parse(OsclAny*& aRequestData)
        {
            aRequestData = iParam3;
        }

        void Parse(OsclAny*& aRequestData, PvmiDataStreamCommandId &aDataStreamCmdId)
        {
            aRequestData = iParam3;
            aDataStreamCmdId = (PvmiDataStreamCommandId)iParam4;
        }

    private:
        uint64 iNPTInMS;
};


//Command queue type
typedef PVMFNodeCommandQueue<PVMFProtocolEngineNodeCommand, PVMFProtocolEngineNodeAllocator> PVMFProtocolEngineNodeCmdQ;

typedef Oscl_Vector<PVMFSharedMediaMsgPtr, PVMFProtocolEngineNodeAllocator> INPUT_DATA_QUEUE;
typedef Oscl_Vector<OsclRefCounterMemFrag, PVMFProtocolEngineNodeAllocator> OUTPUT_DATA_QUEUE;
typedef Oscl_Vector<OsclRefCounterMemFrag*, PVMFProtocolEngineNodeAllocator> PENDING_OUTPUT_DATA_QUEUE;

// two macros used in the array member and function parameter below
#define PVHTTPDOWNLOADOUTPUT_CONTENTDATA_CHUNKSIZE 8000
#define EVENT_HANDLER_TOTAL 10

enum NetworkTimerType
{
    SERVER_RESPONSE_TIMER_ID = 0,
    SERVER_INACTIVITY_TIMER_ID,
    SERVER_KEEPALIVE_TIMER_ID,
    SERVER_RESPONSE_TIMER_ID_FOR_STOPEOS_LOGGING,
    // handle data processing in case of no data input (PE node will become idle) for download/progressive streaming,
    // so there should be a way to activate PE node to continue data processing if needed
    WALL_CLOCK_TIMER_ID,
    // a timer to report buffer status periodically, say at every up to 2sec, at least buffer status has to be reported
    // which tells our system is running
    BUFFER_STATUS_TIMER_ID
};

enum PVHttpProtocol
{
    PVHTTPPROTOCOL_PROGRESSIVE_DOWNLOAD = 0,
    PVHTTPPROTOCOL_PROGRESSIVE_STREAMING,
    PVHTTPPROTOCOL_SHOUTCAST,
    PVHTTPPROTOCOL_FASTTRACK_DOWNLOAD,
    PVHTTPPROTOCOL_MS_HTTP_STREAMING,
    PVHTTPPROTOCOL_UNKNOWN
};

// Forward declarations
class PVMFProtocolEngineNode;
class PVMFProtocolEnginePort;
class PVMIDataStreamSyncInterface;
class PVLogger;
class PVMFLightMediaFragGroupAlloc;
class PVMFMediaPresentationInfo;
class HttpBasedProtocol;
class PVMFProtocolEngineNodeOutput;
class DownloadControlInterface;
class DownloadProgressInterface;
class EventReporter;
class PVDlCfgFile;
class PVDlCfgFileContainer;
class PVMFDownloadDataSourceContainer;
class PVMFProtocolEngineNodeTimer;
class InterfacingObjectContainer;
class UserAgentField;
struct PVProtocolEngineNodeInternalEvent;
class PVProtocolEngineNodeInternalEventHandler;
class PVMFProtocolEnginePort;
class OsclSharedLibrary;


enum NodeObjectType
{
    NodeObjectType_InputPortForData = 0,
    NodeObjectType_InputPortForLogging,
    NodeObjectType_OutPort,
    NodeObjectType_InternalEventQueue,

    NodeObjectType_Protocol,
    NodeObjectType_Output,
    NodeObjectType_DownloadControl,
    NodeObjectType_DownloadProgress,
    NodeObjectType_EventReport,
    NodeObjectType_DlCfgFileContainer,
    NodeObjectType_DataSourceContainer,
    NodeObjectType_Timer,
    NodeObjectType_InterfacingObjectContainer,
    NodeObjectType_UseAgentField
};

class ProtocolContainerObserver
{
    public:
        virtual uint32 GetObserverState() = 0;
        virtual void SetObserverState(const uint32 aState) = 0;
        virtual bool DispatchEvent(PVProtocolEngineNodeInternalEvent *aEvent) = 0;
        virtual bool SendMediaCommand(PVMFProtocolEnginePort *aPort, PVUid32 aCmdId, const bool isForLogging = false) = 0;
        virtual void ClearRest(const bool aNeedDelete = false) = 0;
        virtual void RecheduleDataFlow() = 0;
        virtual void SendManualResumeNotificationEvent() = 0;
        virtual bool IsRepositionCmdPending() = 0;
        virtual PVMFProtocolEngineNodeCommand* FindPendingCmd(int32 aCmdId) = 0;
        virtual void CompletePendingCmd(int32 status) = 0;
        virtual void CompleteInputCmd(PVMFProtocolEngineNodeCommand& aCmd, int32 status) = 0;
        virtual void ErasePendingCmd(PVMFProtocolEngineNodeCommand *aCmd) = 0;
        virtual void ReportEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, const int32 aEventCode = 0, OsclAny* aEventLocalBuffer = NULL, const uint32 aEventLocalBufferSize = 0) = 0;
};



// This class handles protocol initialization for multiple http based protocols,
// and it serves as a friend class of PVMFProtocolEngineNode, and thus helps do
// protocol initialization.
class ProtocolContainer
{
    public:
        // constructor
        OSCL_IMPORT_REF ProtocolContainer(PVMFProtocolEngineNode *aNode = NULL);
        virtual ~ProtocolContainer()
        {
            iDataPathLogger = NULL;
            clear();
        }

        void setObserver(ProtocolContainerObserver *aObserver)
        {
            iObserver = aObserver;
        }
        OSCL_IMPORT_REF virtual bool createProtocolObjects();
        OSCL_IMPORT_REF virtual void deleteProtocolObjects();
        OSCL_IMPORT_REF virtual bool isObjectsReady(); // centralize the info-checking
        OSCL_IMPORT_REF virtual void setSupportObject(OsclAny* aSupportObject, const uint32 aType);
        virtual PVMFStatus doInit()
        {
            return PVMFSuccess;    // used in PVMFProtocolEngineNode::doInit
        }
        OSCL_IMPORT_REF virtual PVMFStatus doPrepare();                         // used in PVMFProtocolEngineNode::doPrepare, the default implementation is for both 3gpp and fasttrack download
        virtual bool doProPrepare()
        {
            return true;    // used only for fasttrack, invoke the call to generate SDP info.
        }
        virtual int32 doPreStart()
        {
            return PROCESS_SUCCESS;
        }
        virtual bool doPause()
        {
            return true;
        }
        OSCL_IMPORT_REF virtual PVMFStatus doStop();
        OSCL_IMPORT_REF virtual bool doEOS(const bool isTrueEOS = true);
        virtual bool doInfoUpdate(const uint32 downloadStatus)
        {
            OSCL_UNUSED_ARG(downloadStatus);    // for now, used for download only, report event and update download control
            return true;
        }
        virtual PVMFStatus doSeek(PVMFProtocolEngineNodeCommand& aCmd)
        {
            OSCL_UNUSED_ARG(aCmd);
            return PVMFSuccess;
        }
        virtual PVMFStatus doBitstreamSwitch(PVMFProtocolEngineNodeCommand& aCmd)
        {
            OSCL_UNUSED_ARG(aCmd);
            return PVMFSuccess;
        }
        OSCL_IMPORT_REF virtual bool reconnectSocket(const bool aForceSocketReconnect = true);  // used for progressive download and http streaming
        virtual bool needSocketReconnect()
        {
            return true;
        }
        OSCL_IMPORT_REF virtual void startDataFlowByCommand(const bool needDoSocketReconnect = true);

        OSCL_IMPORT_REF virtual void doClear(const bool aNeedDelete = false);
        OSCL_IMPORT_REF virtual void doStopClear();
        OSCL_IMPORT_REF virtual void doCancelClear();
        virtual bool addSourceData(OsclAny* aSourceData)
        {
            OSCL_UNUSED_ARG(aSourceData);
            return true;
        }
        virtual bool createCfgFile(OSCL_String& aUri)
        {
            OSCL_UNUSED_ARG(aUri);
            return true;
        }
        virtual bool getProxy(OSCL_String& aProxyName, uint32 &aProxyPort) = 0;
        virtual void setHttpVersion(const uint32 aHttpVersion)
        {
            OSCL_UNUSED_ARG(aHttpVersion);
        }
        virtual bool handleContentRangeUnmatch()
        {
            return true;
        }
        virtual bool downloadUpdateForHttpHeaderAvailable()
        {
            return true;
        }
        virtual void setHttpExtensionHeaderField(OSCL_String &aFieldKey, OSCL_String &aFieldValue, const HttpMethod aMethod = HTTP_GET, const bool aPurgeOnRedirect = false)
        {
            OSCL_UNUSED_ARG(aFieldKey);
            OSCL_UNUSED_ARG(aFieldValue);
            OSCL_UNUSED_ARG(aMethod);
            OSCL_UNUSED_ARG(aPurgeOnRedirect);
        }

        OSCL_IMPORT_REF virtual void handleTimeout(const int32 timerID);
        OSCL_IMPORT_REF virtual bool handleProtocolStateComplete(PVProtocolEngineNodeInternalEvent &aEvent, PVProtocolEngineNodeInternalEventHandler *aEventHandler);

        // for fasttrack only
        virtual PVMFStatus getMediaPresentationInfo(PVMFMediaPresentationInfo& aInfo)
        {
            OSCL_UNUSED_ARG(aInfo);
            return PVMFSuccess;
        }
        virtual PVMFStatus selectTracks(PVMFMediaPresentationInfo& aInfo)
        {
            OSCL_UNUSED_ARG(aInfo);
            return PVMFSuccess;
        }

        //Http status code 409 means low disk space
        virtual bool isHTTP409ForLowDiskSpace(const int32 errorCode)
        {
            OSCL_UNUSED_ARG(errorCode);
            return false;
        }

        // for ms http streaming only
        virtual void setLoggingStartInPause(const bool aLoggingStartInPause = true)
        {
            OSCL_UNUSED_ARG(aLoggingStartInPause);
        }
        virtual bool isLoggingStartInPause()
        {
            return false;
        }
        virtual bool needSendEOSDuetoError(const int32 aErrorCode)
        {
            OSCL_UNUSED_ARG(aErrorCode);
            return false;
        }

        // for progressive download only
        virtual bool needCheckExtraDataComeIn()
        {
            return false;
        }
        virtual bool needCheckEOSAfterDisconnectSocket()
        {
            return false;
        }

        // for progressive playback (special case of progressive download) only
        virtual bool isStreamingPlayback()
        {
            return false;
        }
        virtual bool completeRepositionRequest()
        {
            return false;
        }
        virtual void checkSendResumeNotification()
        {
            ;
        }
        virtual void enableInfoUpdate(const bool aEnabled = true)
        {
            OSCL_UNUSED_ARG(aEnabled);
        }

        OSCL_IMPORT_REF virtual OsclAny* getObject(const NodeObjectType aObjectType);

        virtual void SetSharedLibraryPtr(OsclSharedLibrary* aPtr)
        {
            iOsclSharedLibrary = aPtr;
        }

        /**
         * Retrieves shared library pointer
         * @returns Pointer to the shared library.
         **/
        virtual OsclSharedLibrary* GetSharedLibraryPtr()
        {
            return iOsclSharedLibrary;
        }

    protected:
        OSCL_IMPORT_REF virtual PVMFStatus initImpl();
        virtual int32 initNodeOutput() = 0;
        OSCL_IMPORT_REF bool initProtocol();
        virtual bool initProtocol_SetConfigInfo() = 0;
        virtual void initDownloadControl()
        {
            ;
        }
        OSCL_IMPORT_REF uint32 getBitMaskForHTTPMethod(const HttpMethod aMethod = HTTP_GET);
        // called by handleTimeout()
        virtual bool handleTimeoutInPause(const int32 timerID)
        {
            OSCL_UNUSED_ARG(timerID);
            return false;
        }
        virtual bool handleTimeoutInDownloadStreamingDone(const int32 timerID)
        {
            OSCL_UNUSED_ARG(timerID);
            return false;
        }
        // called by doStop()
        OSCL_IMPORT_REF virtual void sendSocketDisconnectCmd();
        // called by handleTimeout()
        OSCL_IMPORT_REF virtual bool ignoreThisTimeout(const int32 timerID);
        OSCL_IMPORT_REF virtual void clear();

    private:
        //called by createProtocolObjects()
        bool createNetworkTimer();

        // called by handleTimeout()
        bool handleTimeoutErr(const int32 timerID);

        // called by startDataFlowByCommand()
        void checkEOSMsgFromInputPort();
        // called by doClear or doCancelClear()
        void clearInternalEventQueue();

    protected:
        PVMFProtocolEngineNode *iNode;
        ProtocolContainerObserver *iObserver;
        PVLogger *iDataPathLogger;

        // hold references for the following node objects
        HttpBasedProtocol *iProtocol;
        PVMFProtocolEngineNodeOutput *iNodeOutput;
        DownloadControlInterface *iDownloadControl;
        DownloadProgressInterface *iDownloadProgess;
        EventReporter *iEventReport;
        PVDlCfgFileContainer *iCfgFileContainer;
        PVMFDownloadDataSourceContainer *iDownloadSource;
        PVMFProtocolEngineNodeTimer *iNodeTimer;
        InterfacingObjectContainer *iInterfacingObjectContainer;
        UserAgentField *iUserAgentField;

        // pass-in node objects
        PVMFProtocolEnginePort *iPortInForData, *iPortInForLogging, *iPortOut;
        Oscl_Vector<PVProtocolEngineNodeInternalEvent, PVMFProtocolEngineNodeAllocator> *iInternalEventQueue;

        OsclSharedLibrary* iOsclSharedLibrary;
};

////////////////////////////////////////////////////////////////////////////////////

// Using state to handle multiple use cases
enum PVProtocolEngineNodePrcoessingState
{
    ProcessingState_Idle = 0,
    ProcessingState_NormalDataflow,             // normal data flow
    // other states are changed to using event
};

static const TPVMFNodeInterfaceState SetStateByCommand[11] =
{
    EPVMFNodeInitialized,   // PVMF_GENERIC_NODE_INIT=4
    EPVMFNodePrepared,      // PVMF_GENERIC_NODE_PREPARE=5
    EPVMFNodeStarted,       // PVMF_GENERIC_NODE_START=6
    EPVMFNodePrepared,      // PVMF_GENERIC_NODE_STOP=7
    EPVMFNodeStarted,       // PVMF_GENERIC_NODE_FLUSH=8
    EPVMFNodePaused,        // PVMF_GENERIC_NODE_PAUSE=9
    EPVMFNodeCreated,       // PVMF_GENERIC_NODE_RESET=10
    EPVMFNodeLastState,     // PVMF_GENERIC_NODE_CANCELALLCOMMANDS=11
    EPVMFNodeLastState,     // PVMF_GENERIC_NODE_CANCELCOMMAND=12
    EPVMFNodeStarted,       // PVPROTOCOLENGINE_NODE_CMD_SEEK=13,
    EPVMFNodeStarted        // PVPROTOCOLENGINE_NODE_CMD_BITSTREAM_SWITCH=14
};


////////////////////////////////////////////////////////////////////////////////////
//////  PVProtocolEngineNodeInternalEvent definition
////////////////////////////////////////////////////////////////////////////////////

// This structure defines the internal event(constrast to node event) struture, which serves as the basis of
// event-driven handling inside the node
enum PVProtocolEngineNodeInternalEventType
{
    // This group of events comes from the callback/feedback from protocol engine
    PVProtocolEngineNodeInternalEventType_HttpHeaderAvailable = 0,
    PVProtocolEngineNodeInternalEventType_FirstPacketAvailable,
    PVProtocolEngineNodeInternalEventType_NormalDataAvailable,
    PVProtocolEngineNodeInternalEventType_ProtocolStateComplete,

    // This group of events comes from node itself
    PVProtocolEngineNodeInternalEventType_EndOfProcessing,
    PVProtocolEngineNodeInternalEventType_ServerResponseError_Bypassing,
    PVProtocolEngineNodeInternalEventType_ProtocolStateError,
    PVProtocolEngineNodeInternalEventType_CheckResumeNotificationMaually,
    PVProtocolEngineNodeInternalEventType_OutgoingMsgQueuedAndSentSuccessfully,

    // data flow event
    PVProtocolEngineNodeInternalEventType_IncomingMessageReady = 9,
    PVProtocolEngineNodeInternalEventType_HasExtraInputData,
    PVProtocolEngineNodeInternalEventType_OutputDataReady,
    PVProtocolEngineNodeInternalEventType_StartDataflowByCommand,
    PVProtocolEngineNodeInternalEventType_StartDataflowByBufferAvailability,
    PVProtocolEngineNodeInternalEventType_StartDataflowBySendRequestAction,
    PVProtocolEngineNodeInternalEventType_StartDataflowByPortOutgoingQueueReady
};

struct PVProtocolEngineNodeInternalEvent
{
    PVProtocolEngineNodeInternalEventType iEventId;
    OsclAny *iEventInfo; // any other side info except the actual data, such as error code, sequence number(http streaming), seek offset(fasttrack)
    OsclAny *iEventData; // actual data for the event

    // default constructor
    PVProtocolEngineNodeInternalEvent() : iEventId(PVProtocolEngineNodeInternalEventType_HttpHeaderAvailable), iEventInfo(NULL), iEventData(NULL)
    {
        ;
    }

    // constructor with parameters
    PVProtocolEngineNodeInternalEvent(PVProtocolEngineNodeInternalEventType aEventId, OsclAny *aEventInfo, OsclAny *aEventData = NULL)
    {
        iEventId   = aEventId;
        iEventInfo = aEventInfo;
        iEventData = aEventData;
    }

    PVProtocolEngineNodeInternalEvent(const ProtocolEngineOutputDataSideInfo &aSideInfo, const OsclAny *aData = NULL)
    {
        ProtocolEngineOutputDataSideInfo sideInfo = (ProtocolEngineOutputDataSideInfo&) aSideInfo;
        iEventId   = (PVProtocolEngineNodeInternalEventType)((uint32)sideInfo.iDataType);
        iEventInfo = (OsclAny *)sideInfo.iData;
        iEventData = (OsclAny *)aData;
    }
    PVProtocolEngineNodeInternalEvent(PVProtocolEngineNodeInternalEventType aEventId, int32 aInfoCode = 0)
    {
        iEventId   = aEventId;
        iEventInfo = (OsclAny *)aInfoCode;
        iEventData = NULL;
    }

    // copy constructor
    PVProtocolEngineNodeInternalEvent(const PVProtocolEngineNodeInternalEvent &x)
    {
        iEventId   = x.iEventId;
        iEventInfo = x.iEventInfo;
        iEventData = x.iEventData;
    }

    // operator "="
    PVProtocolEngineNodeInternalEvent &operator=(const PVProtocolEngineNodeInternalEvent& x)
    {
        iEventId   = x.iEventId;
        iEventInfo = x.iEventInfo;
        iEventData = x.iEventData;
        return *this;
    }
};

// this structure defines information needed for EndOfDataProcessingHandler, will be as iEventInfo
struct EndOfDataProcessingInfo
{
    bool iSendResumeNotification;
    bool iExtraDataComeIn;
    bool iSendServerDisconnectEvent;
    bool iStreamingDone;
    bool iForceStop;

    // constructor
    EndOfDataProcessingInfo() : iSendResumeNotification(false),
            iExtraDataComeIn(false),
            iSendServerDisconnectEvent(false),
            iStreamingDone(false),
            iForceStop(false) {}

    bool isValid() const
    {
        return (iSendResumeNotification     ||
                iExtraDataComeIn            ||
                iSendServerDisconnectEvent  ||
                iStreamingDone              ||
                iForceStop);
    }

    void clear()
    {
        iSendResumeNotification = false;
        iExtraDataComeIn = false;
        iSendServerDisconnectEvent = false;
        iStreamingDone = false;
        iForceStop = false;
    }
};

// this structure defines information needed for ProtocolStateErrorHandler, will be as iEventInfo
struct ProtocolStateErrorInfo
{
    int32 iErrorCode;
    // true means using the current iErrorCode, false means using the previous iErrorCode
    bool iUseInputErrorCode;

    // constructor
    ProtocolStateErrorInfo() : iErrorCode(0), iUseInputErrorCode(true)
    {
        ;
    }
    ProtocolStateErrorInfo(const int32 aErrorCode, const bool aUseInputErrorCode = true) :
            iErrorCode(aErrorCode),
            iUseInputErrorCode(aUseInputErrorCode)
    {
        ;
    }
};

// this structure defines infomation needed for OutgoingMsgSentSuccessHandler, will be as iEventInfo
struct OutgoingMsgSentSuccessInfo
{
    PVMFProtocolEnginePort *iPort;
    PVMFSharedMediaMsgPtr iMsg;

    // constructor
    OutgoingMsgSentSuccessInfo(): iPort(NULL)
    {
        ;
    }
    OutgoingMsgSentSuccessInfo(PVMFProtocolEnginePort *aPort, PVMFSharedMediaMsgPtr &aMsg) :
            iPort(aPort), iMsg(aMsg)
    {
        ;
    }

    OutgoingMsgSentSuccessInfo &operator=(const OutgoingMsgSentSuccessInfo& x)
    {
        iPort = x.iPort;
        iMsg  = x.iMsg;
        return *this;
    }
};

// use polymophism to handle variant events
class PVProtocolEngineNodeInternalEventHandler
{
    public:
        virtual ~PVProtocolEngineNodeInternalEventHandler() {}

        virtual bool handle(PVProtocolEngineNodeInternalEvent &aEvent) = 0;
        virtual bool completePendingCommand(PVProtocolEngineNodeInternalEvent &aEvent);

        // contructor
        PVProtocolEngineNodeInternalEventHandler(PVMFProtocolEngineNode *aNode);

    protected:
        bool isBeingStopped(const int32 aStatus = PROCESS_SUCCESS_END_OF_MESSAGE); // common routine

    private:
        inline bool isCurrEventMatchCurrPendingCommand(uint32 aCurrEventId);
        bool completePendingCommandWithError(PVProtocolEngineNodeInternalEvent &aEvent);
        int32 getBasePVMFErrorReturnCode(const int32 errorCode, const bool isForCommandComplete = true);
        void handleErrResponse(int32 &aBaseCode, int32 &aErrCode, char* &aEventData, uint32 &aEventDataLen);
        void handleAuthenErrResponse(int32 &aErrCode, char* &aEventData, uint32 &aEventDataLen);
        void handleRedirectErrResponse(char* &aEventData, uint32 &aEventDataLen);
        inline bool isStopCmdPending(); // called by isBeingStopped
        inline bool isProtocolStateComplete(const int32 aStatus);

    protected:
        PVMFProtocolEngineNode *iNode;
        PVLogger* iDataPathLogger;

    private:
        OSCL_HeapString<OsclMemAllocator> iAuthenInfoRealm;
};

// ProtocolStateErrorHandling becomes a little bit more complicated due to the new requirement:
// PE node needs to send EOS to downstream node once error happens during streaming
// Previously, PE node just error out without doing that much stuff. Now for this new requirement,
// PE node needs two rounds error handling in this case, at the first round, probably does nothing but
// storing error code and preparing sending EOS, and then at the second round, does the real error handling
// But for other cases (PDL or streaming doesn't really start), just do error handling
class ProtocolStateErrorHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        ProtocolStateErrorHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode), iErrorCode(0)
        {
            ;
        }
    private:
        int32 parseServerResponseCode(const int32 aErrorCode, bool &isInfoEvent);
        // return value: 0 means caller needs to return immediately, not 0 means error
        int32 checkRedirectHandling(const int32 aErrorCode);
        bool handleRedirect();
        bool NeedHandleContentRangeUnmatch(const int32 aErrorCode);
        bool handleContentRangeUnmatch();
        bool needCompletePendingCommandAtThisRound(PVProtocolEngineNodeInternalEvent &aEvent);

    private:
        int32 iErrorCode;
};

class HttpHeaderAvailableHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        HttpHeaderAvailableHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};

class FirstPacketAvailableHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        FirstPacketAvailableHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};


class NormalDataAvailableHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        NormalDataAvailableHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};

class ProtocolStateCompleteHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        ProtocolStateCompleteHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};

class NormalDataFlowHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        NormalDataFlowHandler(PVMFProtocolEngineNode *aNode) : PVProtocolEngineNodeInternalEventHandler(aNode), iSendSocketReconnect(false)
        {
            ;
        }

    private:
        bool flushDataPostProcessing(const int32 aStatusFlushData);
        bool handleEOSLogging();
        bool handleEOS(const int32 aStatus);
        bool handleEndOfProcessing(const int32 aStatus);
        bool dataFlowContinue(const int32 aStatus);
        inline bool isReadyGotoNextState(const int32 aStatus); // called by dataFlowContinueOrStop

    private:
        bool iSendSocketReconnect;
};

class EndOfDataProcessingHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        EndOfDataProcessingHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }

    private:
        void cleanupForStop(PVProtocolEngineNodeInternalEvent &aEvent);
};


class ServerResponseErrorBypassingHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        ServerResponseErrorBypassingHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};


// This handler is for PVProtocolEngineNodeInternalEventType_CheckResumeNotificationMaually only. This happens in progressive streaming,
// when MBDS is quickly filled up,and parser node hasn't parsed any data. In this special case, PE node will go idle, but parser node
// may send an internal RequestResumeNotification before parsing any data, then deadlock happens.
class CheckResumeNotificationHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        CheckResumeNotificationHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};

class OutgoingMsgSentSuccessHandler : public PVProtocolEngineNodeInternalEventHandler
{
    public:
        bool handle(PVProtocolEngineNodeInternalEvent &aEvent);

        // constructor
        OutgoingMsgSentSuccessHandler(PVMFProtocolEngineNode *aNode) :
                PVProtocolEngineNodeInternalEventHandler(aNode)
        {
            ;
        }
};




////////////////////////////////////////////////////////////////////////////////////
//////  PVMFProtocolEngineNodeOutput
////////////////////////////////////////////////////////////////////////////////////

// Observer class for pvHttpStreamingOutput to notify the node when the output buffer is available since
// the memory pool is created inside pvHttpStreamingOutput
class PVMFProtocolEngineNodeOutputObserver
{
    public:
        virtual ~PVMFProtocolEngineNodeOutputObserver() {}

        // notify the node that the output buffer pool is fool, so hold off any data processing
        virtual void OutputBufferPoolFull() = 0;
        // notify the node that the new output buffer inside the pool is back to available.
        virtual void OutputBufferAvailable() = 0;
        // notify the node that the new data is already written the file and then download control and status
        // should be updated responsively
        virtual void ReadyToUpdateDownloadControl() = 0;
        // notify the node that a media message has been queued in outgoing message queue successfully
        virtual bool QueueOutgoingMsgSentComplete(PVMFProtocolEnginePort *aPort, PVMFSharedMediaMsgPtr &aMsg, const PVMFStatus aStatus) = 0;
};

enum NodeOutputType
{
    NodeOutputType_InputPortForData = 0,
    NodeOutputType_InputPortForLogging,
    NodeOutputType_OutPort,
    NodeOutputType_DataStreamFactory
};

// This base class encapsulates port objects (port and data stream)
class PVMFProtocolEngineNodeOutput
{
    public:
        // set output object such as, input port, output port and data stream factory
        OSCL_IMPORT_REF virtual void setOutputObject(OsclAny* aOutputObject, const uint32 aObjectType = NodeOutputType_InputPortForData);
        virtual void setConfigInfo(OsclAny* aConfig)
        {
            OSCL_UNUSED_ARG(aConfig);
        }
        OSCL_IMPORT_REF virtual bool passDownNewOutputData(OUTPUT_DATA_QUEUE &aOutputQueue, OsclAny* aSideInfo = NULL);
        OSCL_IMPORT_REF virtual int32 flushData(const uint32 aOutputType = NodeOutputType_InputPortForData) = 0;
        virtual int32 initialize(OsclAny* aInitInfo = NULL) = 0;
        virtual int32 reCreateMemPool(uint32 aNumPool)
        {
            OSCL_UNUSED_ARG(aNumPool);
            return PROCESS_SUCCESS;
        }
        virtual uint32 getNumBuffersInMediaDataPool()
        {
            return 0;
        }
        OSCL_IMPORT_REF bool getBuffer(PVMFSharedMediaDataPtr &aMediaData, uint32 aRequestSize = PVHTTPDOWNLOADOUTPUT_CONTENTDATA_CHUNKSIZE);
        OSCL_IMPORT_REF virtual void discardData(const bool aNeedReopen = false);
        OSCL_IMPORT_REF virtual bool isPortBusy();

        // PPB (progressive streaming/playback)
        virtual bool releaseMemFrag(OsclRefCounterMemFrag* aFrag)
        {
            OSCL_UNUSED_ARG(aFrag);
            return false;
        };
        virtual void setContentLength(uint32 aLength)
        {
            OSCL_UNUSED_ARG(aLength);
        };
        virtual void dataStreamCommandCompleted(const PVMFCmdResp& aResponse)
        {
            OSCL_UNUSED_ARG(aResponse);
        };
        virtual void setDataStreamSourceRequestObserver(PvmiDataStreamRequestObserver* aObserver)
        {
            OSCL_UNUSED_ARG(aObserver);
        };
        virtual void flushDataStream()
        {
            ;
        }
        virtual bool seekDataStream(const uint32 aSeekOffset)
        {
            OSCL_UNUSED_ARG(aSeekOffset);
            return true;
        };

        // get info from output object to serve as the basis for status update
        uint32 getCurrentOutputSize()
        {
            return iCurrTotalOutputSize;
        }
        void setCurrentOutputSize(const uint32 aCurrentSize)
        {
            iCurrTotalOutputSize = aCurrentSize;    // used in resume download
        }
        virtual uint32 getCurrentPlaybackTime()
        {
            return 0;
        }
        // in case of progressive streaming, the following two sizes mean available cache size and maximum cache size
        virtual uint32 getAvailableOutputSize()
        {
            return 0xFFFFFFFF;
        }
        virtual uint32 getMaxAvailableOutputSize()
        {
            return 0;
        }

        // constructor and destructor
        OSCL_IMPORT_REF PVMFProtocolEngineNodeOutput(PVMFProtocolEngineNodeOutputObserver *aObserver = NULL);
        OSCL_IMPORT_REF virtual ~PVMFProtocolEngineNodeOutput();

    protected:
        // for media data
        OSCL_IMPORT_REF PVMFStatus createMemPool();
        OSCL_IMPORT_REF void deleteMemPool();
        // create media data for composing http request
        OSCL_IMPORT_REF bool createMediaData(PVMFSharedMediaDataPtr &aMediaData, uint32 aRequestSize);
        OSCL_IMPORT_REF bool sendToDestPort(PVMFSharedMediaDataPtr &aMediaData, PVMFProtocolEnginePort *aPort);

        // send the input media data to the port
        OSCL_IMPORT_REF virtual bool sendToPort(PVMFSharedMediaDataPtr &aMediaData, const uint32 aPortType = NodeOutputType_InputPortForData);

        // reset
        OSCL_IMPORT_REF virtual void reset();

    protected:
        PVMFProtocolEnginePort *iPortIn;  // input port connecting to socket node, both for download and http streaming

        // Output buffer memory pool
        OsclMemPoolFixedChunkAllocator *iContentDataMemPool;

        // Allocator for simple media data buffer
        PVMFSimpleMediaBufferCombinedAlloc *iMediaDataAlloc;

        // Memory pool for simple media data
        PVMFMemPoolFixedChunkAllocator iMediaDataMemPool;

        PVMFSharedMediaDataPtr iMediaData;
        Oscl_Vector<OUTPUT_DATA_QUEUE, PVMFProtocolEngineNodeAllocator> iOutputFramesQueue;
        // Mem frags in this queue are being used by the data stream
        PENDING_OUTPUT_DATA_QUEUE iPendingOutputDataQueue;

        // observer to notify the node when output buffer is available
        PVMFProtocolEngineNodeOutputObserver *iObserver;

        // current total output size, serves as the basis for status update
        uint32 iCurrTotalOutputSize;

        PVLogger* iLogger;
        PVLogger* iDataPathLogger;
        PVLogger* iClockLogger;
};


////////////////////////////////////////////////////////////////////////////////////
//////  DownloadControlInterface
////////////////////////////////////////////////////////////////////////////////////
enum DownloadControlSupportObjectType
{
    DownloadControlSupportObjectType_SupportInterface = 0,
    DownloadControlSupportObjectType_ProgressInterface,
    DownloadControlSupportObjectType_EnginePlaybackClock,
    DownloadControlSupportObjectType_ProtocolEngine,
    DownloadControlSupportObjectType_ConfigFileContainer,
    DownloadControlSupportObjectType_SDPInfoContainer,
    DownloadControlSupportObjectType_DownloadProgress,
    DownloadControlSupportObjectType_OutputObject
};

// The intent of introducing this download ocntrol interface is to make streaming counterpart as a NULL object,
// which remove any error-prone check
class DownloadControlInterface
{
    public:
        // set download control supporting objects:
        virtual void setSupportObject(OsclAny *aDLSupportObject, DownloadControlSupportObjectType aType) = 0;
        // From PVMFDownloadProgressInterface API pass down
        virtual void requestResumeNotification(const uint32 currentNPTReadPosition, bool& aDownloadComplete, bool& aNeedSendUnderflowEvent) = 0;
        // check whether to make resume notification; if needed, then make resume notification
        virtual void cancelResumeNotification() = 0;
        // cancel request of resume notification.
        virtual int32 checkResumeNotification(const bool aDownloadComplete = true) = 0;
        // return true for the new download progress
        // From PVMFDownloadProgressInterface API
        virtual void getDownloadClock(OsclSharedPtr<PVMFMediaClock> &aClock) = 0;
        // From PVMFDownloadProgressInterface API
        virtual void setClipDuration(const uint32 aClipDurationMsec) = 0;
        // for auto-resume control for resume download
        virtual void setPrevDownloadSize(uint32 aPrevDownloadSize = 0) = 0;
        virtual void clear() = 0;

        // for progressive playback repositioning
        virtual void clearPerRequest() = 0;
        virtual bool isDownloadCompletedPerRequest() = 0;

        // destructor
        virtual ~DownloadControlInterface()
        {
            ;
        }
};

////////////////////////////////////////////////////////////////////////////////////
//////  DownloadProgressInterface
////////////////////////////////////////////////////////////////////////////////////

// This class encapsulates the download progress update based on different download progress modes
class DownloadProgressInterface
{
    public:
        virtual void setSupportObject(OsclAny *aDLSupportObject, DownloadControlSupportObjectType aType) = 0;

        // updata download clock and download progress
        virtual bool update(const bool aDownloadComplete = false) = 0;

        // return true for the new download progress
        virtual bool getNewProgressPercent(uint32 &aProgressPercent) = 0;

        // return duration for auto-resume decision
        virtual void setClipDuration(const uint32 aClipDurationMsec) = 0;

        virtual void setDownloadProgressMode(DownloadProgressMode aMode = DownloadProgressMode_TimeBased) = 0;

        virtual ~DownloadProgressInterface()
        {
            ;
        }
};

////////////////////////////////////////////////////////////////////////////////////
//////  EventReporter
////////////////////////////////////////////////////////////////////////////////////
// This class wraps up sending node info&error event.
enum EventReporterSupportObjectType
{
    EventReporterSupportObjectType_DownloadProgress = 0,
    EventReporterSupportObjectType_ProtocolEngine,
    EventReporterSupportObjectType_ConfigFileContainer,
    EventReporterSupportObjectType_NodeInterfacingObject,
    EventReporterSupportObjectType_TimerObject,
    EventReporterSupportObjectType_OutputObject
};

class EventReporterObserver
{
    public:
        // TODO: Change the buffer to be const void*.
        // TODO: Why do we have event data AND event buffer?
        virtual void ReportEvent(PVMFEventType aEventType, OsclAny* aEventData = NULL, const int32 aEventCode = 0, OsclAny* aEventLocalBuffer = NULL, const size_t aEventLocalBufferSize = 0) = 0;
        virtual void NotifyContentTooLarge() = 0;
        virtual uint32 GetObserverState() = 0;
};

class EventReporter
{
    public:
        virtual ~EventReporter() {}

        // constructor
        OSCL_IMPORT_REF EventReporter(EventReporterObserver *aObserver);

        virtual void setSupportObject(OsclAny *aSupportObject, EventReporterSupportObjectType aType)
        {
            OSCL_UNUSED_ARG(aSupportObject);
            OSCL_UNUSED_ARG(aType);
        }

        // major function to walk throught all the node info & error event whether to be sent out
        virtual bool checkReportEvent(const uint32 downloadStatus)
        {
            OSCL_UNUSED_ARG(downloadStatus);
            return true;
        }
        // the content-length event and content too large event, can't fit into the above checkReportEvent() completely
        virtual bool checkContentInfoEvent(const uint32 downloadStatus)
        {
            OSCL_UNUSED_ARG(downloadStatus);
            return true;
        }

        // enable some specific events
        virtual void sendDataReadyEvent()
        {
            ;
        }
        virtual void enableBufferingCompleteEvent()
        {
            ;
        }
        virtual void sendBufferStatusEvent()
        {
            ;
        }

        OSCL_IMPORT_REF virtual void clear();

        // node is running in start state to kick off the normal downloading and streaming
        OSCL_IMPORT_REF void startRealDataflow();

    protected:
        bool iStarted;
        EventReporterObserver *iObserver;
        PVLogger *iDataPathLogger;
};


// This class wraps up user agent setting, differentiated in progessive download, fastrack and ms http streaming.
// Any this kind of variation should be wrapped up into an object
class UserAgentField
{
    public:
        // constructor
        UserAgentField() : iOverwritable(false)
        {
            ;
        }
        OSCL_IMPORT_REF UserAgentField(OSCL_wString &aUserAgent, const bool isOverwritable = false);
        OSCL_IMPORT_REF UserAgentField(OSCL_String &aUserAgent, const bool isOverwritable = false);
        virtual ~UserAgentField()
        {
            ;
        }

        // set user agent
        OSCL_IMPORT_REF bool setUserAgent(OSCL_wString &aUserAgent, const bool isOverwritable = false);
        OSCL_IMPORT_REF bool setUserAgent(OSCL_String &aUserAgent, const bool isOverwritable = false);

        // get the actual user agent (not wide string version) based on overwrite mode or replace mode (attach the input user agent to the default one)
        OSCL_IMPORT_REF bool getUserAgent(OSCL_String &aUserAgent);

    protected:
        virtual void getDefaultUserAgent(OSCL_String &aUserAgent) = 0;

    protected:
        OSCL_HeapString<OsclMemAllocator> iInputUserAgent;
        OSCL_HeapString<OsclMemAllocator> iActualUserAgent;
        bool iOverwritable;
};

typedef Oscl_Vector<OutgoingMsgSentSuccessInfo, PVMFProtocolEngineNodeAllocator> OutgoingMsgSentSuccessInfoVec;

// This class interfaces between the node and node user, which is in fact a data holder and holds the data set by the node public APIs
// and some output data return to node user
class InterfacingObjectContainer
{
    public:
        // set and get download format
        void setDownloadFormat(PVMFFormatType &aDownloadFormat)
        {
            iDownloadFormat = (PVMFFormatType)aDownloadFormat;
        }
        PVMFFormatType getDownloadFormat() const
        {
            return iDownloadFormat;
        }

        // set and get url
        void setURI(OSCL_String &aUri, const bool aRedirectUri = false)
        {
            iDownloadURI.setURI(aUri, aRedirectUri);
        }
        void setURI(OSCL_wString &aUri, const bool aRedirectUri = false)
        {
            iDownloadURI.setURI(aUri, aRedirectUri);
        }
        INetURI &getURIObject()
        {
            return iDownloadURI;
        }

        void setLoggingURI(OSCL_String &aUri)
        {
            iLoggingURI.setURI(aUri);
        }
        void setLoggingURI(OSCL_wString &aUri)
        {
            iLoggingURI.setURI(aUri);
        }
        INetURI &getLoggingURIObject()
        {
            return iLoggingURI;
        }

        // set and get data stream factory
        void setDataStreamFactory(const PVMFDataStreamFactory *aDataStreamFactory)
        {
            iDataStreamFactory = (PVMFDataStreamFactory *)aDataStreamFactory;
        }
        PVMFDataStreamFactory *getDataStreamFactory()
        {
            return iDataStreamFactory;
        }

        // set and get stream parameters in http streaming
        void setStreamParams(PVMFProtocolEngineNodeMSHTTPStreamingParams &aStreamParams)
        {
            iStreamParams = aStreamParams;
        }
        PVProtocolEngineMSHttpStreamingParams *getStreamParams()
        {
            return &iStreamParams;
        }

        //set fast cache setting
        void SetAccelBitrate(uint32 aAccelBitrate)
        {
            iStreamParams.iAccelBitrate = aAccelBitrate;
        }
        void SetAccelDuration(uint32 aAccelDuration)
        {
            iStreamParams.iAccelDuration = aAccelDuration;
        }

        //set max streaming size
        void SetMaxHttpStreamingSize(uint32 aMaxHttpStreamingSize)
        {
            iStreamParams.iMaxHttpStreamingSize = aMaxHttpStreamingSize;
        }

        // set and get number of buffers in media message allocator in http streaming
        void setMediaMsgAllocatorNumBuffers(const uint32 aNumBuffersInAllocator)
        {
            iNumBuffersInAllocator = aNumBuffersInAllocator;
        }
        uint32 getMediaMsgAllocatorNumBuffers() const
        {
            return iNumBuffersInAllocator;
        }

        // set and get number of redirect trials
        void setNumRedirectTrials(const uint32 aNumRedirectTrials)
        {
            iNumRedirectTrials = aNumRedirectTrials;
        }
        void setCurrNumRedirectTrials(const uint32 aCurrNumRedirectTrials)
        {
            iCurrRedirectTrials = aCurrNumRedirectTrials;
        }
        uint32 getNumRedirectTrials() const
        {
            return iNumRedirectTrials;
        }
        uint32 getCurrNumRedirectTrials() const
        {
            return iCurrRedirectTrials;
        }

        // set and get http header
        // return the actual http header length, 0 means no header
        OSCL_IMPORT_REF uint32 setHttpHeader(OUTPUT_DATA_QUEUE &aHttpHeader);
        void getHTTPHeader(uint8*& aHeader, uint32& aHeaderLen)
        {
            aHeader = (uint8*)iHttpHeaderBuffer;
            aHeaderLen = iHttpHeaderLength;
        }

        // set and get file size
        void setFileSize(const uint32 aFileSize)
        {
            iFileSize = aFileSize;
        }
        uint32 getFileSize() const
        {
            return iFileSize;
        }

        // socket connect flags
        void updateSocketConnectFlags(const bool isEOS)
        {
            if (!iCurrSocketConnection && !isEOS) iSocketReconnectCmdSent = false; // when connnection becomes from down (EOS) to up, clear the flag of sending socket reconnect command
            iPrevSocketConnection = iCurrSocketConnection;
            iCurrSocketConnection = !isEOS;
        }
        bool isSocketConnectionUp() const
        {
            return iCurrSocketConnection;
        }
        bool isPrevSocketConnectionUp() const
        {
            return iPrevSocketConnection;
        }
        bool isSocketReconnectCmdSent() const
        {
            return iSocketReconnectCmdSent;
        }
        void setSocketReconnectCmdSent(const bool aSocketReconnectCmdSent = true)
        {
            iSocketReconnectCmdSent = aSocketReconnectCmdSent;
        }
        bool ignoreCurrentInputData() const
        {
            return isCurrentInputDataUnwanted;
        }
        void setInputDataUnwanted(const bool aInputDataUnwanted = true)
        {
            isCurrentInputDataUnwanted = aInputDataUnwanted;
        }

        // KeepAlive timeout
        void setKeepAliveTimeout(const uint32 aTimeout)
        {
            iKeepAliveTimeout = aTimeout;
        }
        uint32 getKeepAliveTimeout() const
        {
            return iKeepAliveTimeout;
        }

        // Streaming proxy
        OSCL_IMPORT_REF bool setStreamingProxy(OSCL_wString& aProxyName, const uint32 aProxyPort = DEFAULT_HTTP_PORT_NUMBER);
        void getStreamingProxy(OSCL_String& aProxyName, uint32 &aProxyPort)
        {
            aProxyName = iProxyName;
            aProxyPort = iProxyPort;
        }

        // flag of disabling HTTP HEAD request
        void setHttpHeadRequestDisabled(const bool aDisableHeadRequest = true)
        {
            iDisableHeadRequest = aDisableHeadRequest;
        }
        bool getHttpHeadRequestDisabled() const
        {
            return iDisableHeadRequest;
        }

        // maximum ASF header size
        void setMaxASFHeaderSize(const uint32 aMaxASFHeaderSize)
        {
            iMaxASFHeaderSize = aMaxASFHeaderSize;
        }
        uint32 getMaxASFHeaderSize() const
        {
            return iMaxASFHeaderSize;
        }

        // latest packet number just sent to downstream node successfully
        void setLatestPacketNumSent(const uint32 aPacketNum)
        {
            iLatestDataPacketNumSent = aPacketNum;
        }
        uint32 getLatestPacketNumSent() const
        {
            return iLatestDataPacketNumSent;
        }

        // user-id and password for HTTP authentication
        void setUserAuthInfo(OSCL_String &aUserID, OSCL_String &aPasswd)
        {
            if (aUserID.get_size() > 0)
            {
                iStreamParams.iUserID = OSCL_HeapString<OsclMemAllocator> (aUserID.get_cstr(), aUserID.get_size());
            }
            if (aPasswd.get_size() > 0)
            {
                iStreamParams.iUserPasswd = OSCL_HeapString<OsclMemAllocator> (aPasswd.get_cstr(), aPasswd.get_size());
            }
        }

        OSCL_IMPORT_REF void setNumBuffersInMediaDataPoolSMCalc(uint32 aVal);
        uint32 getNumBuffersInMediaDataPoolSMCalc() const
        {
            return iNumBuffersInMediaDataPoolSMCalc;
        }
        // iOutputPortConnected
        void setOutputPortConnect(const bool aConnected = true)
        {
            iOutputPortConnected = aConnected;
        }
        bool getOutputPortConnect() const
        {
            return iOutputPortConnected;
        }

        // iCancelCmdHappened
        void setCancelCmdHappened(const bool aCancelCmdHappened = true)
        {
            iCancelCmdHappened = aCancelCmdHappened;
        }
        bool getCancelCmdHappened() const
        {
            return iCancelCmdHappened;
        }

        // iEOPInfo
        EndOfDataProcessingInfo *getEOPInfo()
        {
            return &iEOPInfo;
        }

        // protocol state complete info
        void setProtocolStateCompleteInfo(const ProtocolStateCompleteInfo &aInfo, const bool aForceSet = false)
        {
            if (!aForceSet)
            {
                if (aInfo.isDownloadStreamingDone) iProtocolStateCompleteInfo.isDownloadStreamingDone = true;
                if (aInfo.isWholeSessionDone)     iProtocolStateCompleteInfo.isWholeSessionDone = true;
                if (aInfo.isEOSAchieved)              iProtocolStateCompleteInfo.isEOSAchieved = true;
            }
            else
            {
                iProtocolStateCompleteInfo.isDownloadStreamingDone = aInfo.isDownloadStreamingDone;
                iProtocolStateCompleteInfo.isWholeSessionDone      = aInfo.isWholeSessionDone;
                iProtocolStateCompleteInfo.isEOSAchieved           = aInfo.isEOSAchieved;
            }
        }
        ProtocolStateCompleteInfo *getProtocolStateCompleteInfo()
        {
            return &iProtocolStateCompleteInfo;
        }

        OutgoingMsgSentSuccessInfoVec *getOutgoingMsgSentSuccessInfoVec()
        {
            return &iOutgoingMsgSentSuccessInfoVec;
        }

        bool isDownloadStreamingDone()
        {
            return iProtocolStateCompleteInfo.isDownloadStreamingDone;
        }
        bool isWholeSessionDone()
        {
            return iProtocolStateCompleteInfo.isWholeSessionDone;
        }
        bool isEOSAchieved()
        {
            return iProtocolStateCompleteInfo.isEOSAchieved;
        }

        void setTruncatedForLimitSize(const bool aTruncatedForLimitSize = false)
        {
            iTruncatedForLimitSize = aTruncatedForLimitSize;
        }
        bool getTruncatedForLimitSize() const
        {
            return iTruncatedForLimitSize;
        }

        // constructor
        InterfacingObjectContainer();
        ~InterfacingObjectContainer()
        {
            clear();
            iOutgoingMsgSentSuccessInfoVec.clear();
        }

        // clear
        void clear()
        {
            iHttpHeaderLength           = 0;
            iFileSize                   = 0;
            iSocketReconnectCmdSent     = false;
            iCurrRedirectTrials         = 0;
            isCurrentInputDataUnwanted  = true; // when clear(), treat all the input data unwanted (that needs to be ignored), let command and event to enable it
            iProcessingDone             = false;
            iKeepAliveTimeout           = 0;
            iDisableHeadRequest         = true; // changed on the request of Japan
            iMaxASFHeaderSize           = 0;
            iCancelCmdHappened          = false;
            iTruncatedForLimitSize      = false;
            iProtocolStateCompleteInfo.clear();
        }

    private:
        PVMFFormatType  iDownloadFormat;
        // set by SetSourceInitializationData()
        INetURI iDownloadURI;
        // set by SetLoggingURL
        INetURI iLoggingURI;
        // set by PassDatastreamFactory()
        PVMFDataStreamFactory *iDataStreamFactory;
        // set by SetStreamParams()
        PVProtocolEngineMSHttpStreamingParams iStreamParams;
        // set by SetMediaMsgAllocatorNumBuffers()
        uint32 iNumBuffersInAllocator;
        // set by SetNumRedirectTrials
        uint32 iNumRedirectTrials;
        uint32 iCurrRedirectTrials;

        uint32 iNumBuffersInMediaDataPoolSMCalc;
        // get from GetHTTPHeader()
        char iHttpHeaderBuffer[PVHTTPDOWNLOADOUTPUT_CONTENTDATA_CHUNKSIZE+1]; // to hold http header
        uint32 iHttpHeaderLength;
        // get from GetFileSize()
        uint32 iFileSize;

        // socket connect flags
        bool iCurrSocketConnection; // true means the connection is up and on ; false means the connection is downn
        bool iPrevSocketConnection; // the status of previous socket connection
        bool iSocketReconnectCmdSent; // flag to record whether the socket reconnect command is sent

        // this flag is introduced to ignore unwanted incoming messages in certain scenarios,
        // such as stop/reset/cancel, protocol state complete/error, while init/prepare/start command would disable
        // this flag
        bool isCurrentInputDataUnwanted;

        bool iProcessingDone; // work as a global variable

        uint32 iKeepAliveTimeout;

        // streaming proxy and port
        OSCL_HeapString<OsclMemAllocator> iProxyName;
        uint32 iProxyPort;

        bool iDisableHeadRequest;
        uint32 iMaxASFHeaderSize;
        uint32 iLatestDataPacketNumSent;

        // the connection status between PE node output port and downstream(JB) node input port
        // this flag will help sending EOS or not
        bool iOutputPortConnected;

        bool iCancelCmdHappened;

        // work as a global variable
        EndOfDataProcessingInfo iEOPInfo;
        ProtocolStateCompleteInfo iProtocolStateCompleteInfo;
        OutgoingMsgSentSuccessInfoVec iOutgoingMsgSentSuccessInfoVec;

        // This flag mean data-size reach limitation or not
        // true : data reached limitation
        // false: data don't reach limitation
        bool iTruncatedForLimitSize;
};


////////////////////////////////////////////////////////////////////////////////////
//////  PVMFProtocolEngineNodeTimer
////////////////////////////////////////////////////////////////////////////////////

// This class wraps OsclTimer<allocator> to hide some details and make call more expressive
struct TimerUnit
{
    uint32 iTimerID;
    uint32 iTimeout;

    // constructor
    TimerUnit() : iTimerID(0), iTimeout(0)
    {
        ;
    }
    TimerUnit(const uint32 aTimerID, const uint32 aTimeout) : iTimerID(aTimerID), iTimeout(aTimeout)
    {
        ;
    }
};

class PVMFProtocolEngineNodeTimer
{
    public:
        // factory and destructor
        OSCL_IMPORT_REF static PVMFProtocolEngineNodeTimer* create(OsclTimerObserver *aObserver);
        OSCL_IMPORT_REF ~PVMFProtocolEngineNodeTimer();

        // register and set timer id and timeout value
        // note that if aTimeout=0, that means using the internal default one
        OSCL_IMPORT_REF void set(const uint32 aTimerID, const int32 aTimeout = 0);

        // get the timeout value for specific timer id. If not set, return default value
        // if input timer id is not registered, will return 0xffffffff
        OSCL_IMPORT_REF uint32 getTimeout(const uint32 aTimerID);

        // start the timer with optional new timeout value, aTimeout=0 means using the existing one
        // if the timer id doesn't exist, it will return failure, which means set() has to be called before start()
        OSCL_IMPORT_REF bool start(const uint32 aTimerID, const int32 aTimeout = 0);

        OSCL_IMPORT_REF void cancel(const uint32 aTimerID);
        OSCL_IMPORT_REF void clear();

        // clear all the timers except the timer with the given timer ID
        OSCL_IMPORT_REF void clearExcept(const uint32 aTimerID);

    private:
        // constructor
        PVMFProtocolEngineNodeTimer() : iWatchdogTimer(NULL)
        {
            ;
        }
        bool construct(OsclTimerObserver *aObserver);

        uint32 getDefaultTimeout(const uint32 aTimerID);
        uint32 getTimerVectorIndex(const uint32 aTimerID);

    private:
        OsclTimer<PVMFProtocolEngineNodeAllocator>  *iWatchdogTimer;
        Oscl_Vector<TimerUnit, PVMFProtocolEngineNodeAllocator> iTimerVec;
};

#endif