• 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 // ----------------------------------------------------------------------
19 //
20 // This Software is an original work of authorship of PacketVideo Corporation.
21 // Portions of the Software were developed in collaboration with NTT  DoCoMo,
22 // Inc. or were derived from the public domain or materials licensed from
23 // third parties.  Title and ownership, including all intellectual property
24 // rights in and to the Software shall remain with PacketVideo Corporation
25 // and NTT DoCoMo, Inc.
26 //
27 // -----------------------------------------------------------------------
28 /*****************************************************************************/
29 /*  file name            : tscmain.h                                         */
30 /*  file contents        :                                                   */
31 /*  draw                 : '96.10.09                                         */
32 /*---------------------------------------------------------------------------*/
33 /*  amendment                                                                */
34 /*              Copyright (C) 1996 NTT DoCoMo                                */
35 /*****************************************************************************/
36 
37 #ifndef TSCMAIN_H_INCLUDED
38 #define TSCMAIN_H_INCLUDED
39 #ifndef OSCL_BASE_H_INCLUDED
40 #include "oscl_base.h"
41 #endif
42 
43 #ifndef OSCL_MEM_H_INCLUDED
44 #include "oscl_mem.h"
45 #endif
46 
47 #ifndef OSCLCONFIG_IO_H_INCLUDED
48 #include "osclconfig_io.h"
49 #endif
50 
51 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED
52 #include "oscl_scheduler_ao.h"
53 #endif
54 
55 #ifndef OSCL_FILE_IO_H_INCLUDED
56 #include "oscl_file_io.h"
57 #endif
58 
59 #ifndef OSCL_PRIQUEUE_H_INCLUDED
60 #include "oscl_priqueue.h"
61 #endif
62 
63 #ifndef PVMF_MEDIA_DATA_H_INCLUDED
64 #include "pvmf_media_data.h"
65 #endif
66 
67 #ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED
68 #include "pvmf_simple_media_buffer.h"
69 #endif
70 
71 #ifndef OSCL_TIMER_H_INCLUDED
72 #include "oscl_timer.h"
73 #endif
74 
75 #ifndef PVLOGGER_H_INCLUDED
76 #include "pvlogger.h"
77 #endif
78 #include "pvmf_video.h"
79 
80 #include "tsc.h"
81 #include "cpvh223multiplex.h"
82 #include "srp.h"
83 #include "h245.h"
84 #include "h245def.h"
85 #include "h245pri.h"
86 #include "h223types.h"
87 #include "h324utils.h"
88 #include "tscsrpbuffer.h"
89 #include "tsc_node_interface.h"
90 #include "pv_common_types.h"
91 #include "tsc_statemanager.h"
92 #include "tsc_lc.h"
93 #include "tsc_blc.h"
94 #include "tsc_clc.h"
95 #include "tsc_mt.h"
96 #include "tsc_capability.h"
97 #include "tsc_componentregistry.h"
98 
99 class SimpleStackElement;
100 
101 #define PVUidH324Interface  PVUuid(0x2b0b54e2,0x7079,0x46c6,0xb2,0x3e,0x04,0xff,0xd3,0x0e,0x14,0x36)
102 
103 
104 /* Directional indicators */
105 #define     UNI             1
106 #define     BI              2
107 
108 /* Values for MUXTABLE_CHANGE */
109 #define     WAIT_IDLE       0
110 #define     WAIT_RES1       1
111 #define     WAIT_RES2       2
112 
113 
114 #define PV_TSC_RTD_TIMER_ID 2
115 #define PV_TSC_DISCONNECT_TIMER_ID 3
116 #define PV_TSC_WAITING_FOR_OBLC_TIMER_ID 4
117 #define PV_TSC_TCS_RECEIVE_TIMER_ID 5
118 #define PV_TSC_LEVEL_SETUP_TIMER_ID 6
119 #define FIRST_OUTGOING_LCN 6
120 #define DEFAULT_AUDIO_AL_INDEX 4
121 #define DEFAULT_VIDEO_AL_INDEX 5
122 #define DEFAULT_AL3_CONTROL_FIELD_OCTETS 1
123 #define DEFAULT_END_SESSION_TIMEOUT 5
124 #define WAITING_FOR_OBLC_TIMEOUT_SECONDS 15
125 #define PV_TSC_MAX_COMMAND_ID 65535
126 #define TSC_SE_TIMEOUT_DEFAULT 30
127 #define T401_DEFAULT 8
128 #define N401_DEFAULT 100
129 
130 #define FIRST_MUX_ENTRY_NUMBER TSC_FM_MAX_MTE+1
131 #define LAST_MUX_ENTRY_NUMBER 14
132 #define TSC_WNSRP_MUX_ENTRY_NUMBER 15
133 #define TSC_INCOMING_CHANNEL_MASK (1<<16)
134 
135 // For requesting ports
136 #define PVMF_AUDIO_OUTGOING_MIMETYPE    "x-pvmf/audio;dir=outgoing"
137 #define PVMF_VIDEO_OUTGOING_MIMETYPE    "x-pvmf/video;dir=outgoing"
138 #define PVMF_INCOMING_MIMETYPE          "x-pvmf/dir=incoming"
139 #define PVMF_OUTGOING_MIMETYPE          "x-pvmf/dir=outgoing"
140 
141 /*---------------------------------------------------------------------------*/
142 /*  Constant Definition                                                      */
143 /*---------------------------------------------------------------------------*/
144 
145 
146 // H.245 Miscellaneous Commands
147 typedef enum _TCmdMisc
148 {
149     EVideoFastUpdatePicture,
150     EVideoTemporalSpatialTradeOff,
151     EMaxH223MUXPDUsize
152 } TCmdMisc;
153 
154 class TSC_324mObserver
155 {
156     public:
157         virtual void IncomingVendorId(TPVH245Vendor* vendor, const uint8* pn, uint16 pn_len, const uint8* vn, uint16 vn_len) = 0;
158         virtual void UserInputReceived(CPVUserInput* aUI) = 0;
159         virtual void UserInputCapability(int formats) = 0;
160         virtual void VideoSpatialTemporalTradeoffCommandReceived(TPVChannelId id, uint8 tradeoff) = 0;
161         virtual void VideoSpatialTemporalTradeoffIndicationReceived(TPVChannelId id, uint8 tradeoff) = 0;
162         virtual void SkewIndicationReceived(TPVChannelId lcn1, TPVChannelId lcn2, uint16 skew) = 0;
163 };
164 
165 class TSC_component;
166 
167 
168 class TSC_324m : public TSC,
169         public PVMFNodeInterface,
170         public OsclActiveObject,
171         public CPVH223MultiplexObserver,
172         public H245Observer,
173         public MSDObserver,
174         public CEObserver,
175         public SRPObserver,
176         public OsclTimerObserver
177 {
178     public:
179         OSCL_IMPORT_REF TSC_324m(TPVLoopbackMode aLoopbackMode);
180         ~TSC_324m();
181         void SetTSC_324mObserver(TSC_324mObserver* aObserver);
182 
183         void SetInitialValues();
184         void InitComponent();
185         bool ProcessCommand(Tsc324mNodeCommand& aCmd);
186         void ReceivedFormatSpecificInfo(TPVChannelId lcn, uint8* fsi, uint32 fsi_len);
187         bool IsEstablishedLogicalChannel(TPVDirection aDir, TPVChannelId aChannelId);
188 
189         /********************************/
190         /** node virtuals              **/
191         /********************************/
192         OSCL_IMPORT_REF PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability);
193 
194         OSCL_IMPORT_REF PVMFCommandId Init(PVMFSessionId aSession, const OsclAny* aContext = NULL);
195         void DoInit(Tsc324mNodeCommand& cmd);
196 
197         PVMFCommandId Prepare(PVMFSessionId aSession
198                               , const OsclAny* aContext = NULL);
199         void DoPrepare(Tsc324mNodeCommand& cmd);
200 
201         OSCL_IMPORT_REF PVMFCommandId Start(PVMFSessionId aSession, const OsclAny* aContext = NULL);
202         void DoStart(Tsc324mNodeCommand& cmd);
203 
204         OSCL_IMPORT_REF PVMFCommandId Stop(PVMFSessionId aSession, const OsclAny* aContext = NULL);
205         void StartDisconnect(Tsc324mNodeCommand& cmd);
206         void DoStop(Tsc324mNodeCommand& cmd);
207 
208         OSCL_IMPORT_REF PVMFCommandId Pause(PVMFSessionId aSession, const OsclAny* aContext = NULL);
DoPause(Tsc324mNodeCommand & cmd)209         void DoPause(Tsc324mNodeCommand& cmd)
210         {
211             OSCL_UNUSED_ARG(cmd);
212         }
213 
214         OSCL_IMPORT_REF PVMFCommandId Reset(PVMFSessionId aSession, const OsclAny* aContext = NULL);
215         void DoReset(Tsc324mNodeCommand& cmd);
216 
217         OSCL_IMPORT_REF PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL);
218 
219         OSCL_IMPORT_REF PVMFCommandId RequestPort(PVMFSessionId aSession
220                 , int32 aPortTag
221                 , const PvmfMimeString* aPortConfig = NULL
222                                                       , const OsclAny* aContext = NULL);
223 
224         void DoRequestPort(Tsc324mNodeCommand& cmd);
225 
226         OSCL_IMPORT_REF PVMFCommandId ReleasePort(PVMFSessionId aSession, PVMFPortInterface& aPort, const OsclAny* aContext = NULL);
227         void DoReleasePort(Tsc324mNodeCommand& cmd);
228 
229         // Port iterator virtuals
NumPorts()230         OSCL_IMPORT_REF uint16 NumPorts()
231         {
232             return 1;
233         }
234 
GetNext()235         OSCL_IMPORT_REF PVMFPortInterface* GetNext()
236         {
237             return NULL;
238         }
239 
240         OSCL_IMPORT_REF PVMFCommandId QueryUUID(PVMFSessionId aSession, const PvmfMimeString& aMimeType,
241                                                 Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
242                                                 bool aExactUuidsOnly = false,
243                                                 const OsclAny* aContext = NULL);
244         OSCL_IMPORT_REF PVMFCommandId QueryInterface(PVMFSessionId aSession, const PVUuid& aUuid,
245                 PVInterface*& aInterfacePtr,
246                 const OsclAny* aContext = NULL);
247         void DoQueryInterface(Tsc324mNodeCommand& cmd);
248         void DoQueryUuid(Tsc324mNodeCommand& cmd);
249 
250         OSCL_IMPORT_REF PVMFCommandId CancelAllCommands(PVMFSessionId aSession, const OsclAny* aContextData = NULL);
DoCancelAllCommands(Tsc324mNodeCommand & cmd)251         void DoCancelAllCommands(Tsc324mNodeCommand& cmd)
252         {
253             OSCL_UNUSED_ARG(cmd);
254         }
255 
256         OSCL_IMPORT_REF PVMFCommandId CancelCommand(PVMFSessionId aSession, PVMFCommandId aCmdId, const OsclAny* aContextData = NULL);
257         void DoCancelCommand(Tsc324mNodeCommand& cmd);
258 
259         PVMFStatus ThreadLogon();
260         PVMFStatus ThreadLogoff();
261         void HandlePortActivity(const PVMFPortActivity& aActivity);
262         PVMFCommandId Flush(PVMFSessionId aSession , const OsclAny* aContext = NULL);
DoFlush(Tsc324mNodeCommand & cmd)263         void DoFlush(Tsc324mNodeCommand& cmd)
264         {
265             OSCL_UNUSED_ARG(cmd);
266         }
267 
268         /* PVInterface virtuals */
addRef()269         void addRef() {}
removeRef()270         void removeRef() {}
queryInterface(const PVUuid & uuid,PVInterface * & iface)271         bool queryInterface(const PVUuid& uuid, PVInterface*& iface)
272         {
273             OSCL_UNUSED_ARG(uuid);
274             OSCL_UNUSED_ARG(iface);
275             return false;
276         }
277 
278         /********************************/
279         /** TSC virtuals               **/
280         /********************************/
281         virtual void Tsc_UII_DTMF(uint8 dtmf_value, uint16 dtmf_duration);
282         virtual void Tsc_UII_Alphanumeric(const uint8* str, uint16 str_len);
283 
284         OSCL_IMPORT_REF TPVStatusCode SetVendorIdInfo(TPVH245Vendor* vendor, const uint8* pn, uint16 pn_len, const uint8* vn, uint16 vn_len);
285 
286         /* Initializes the TSC with reference to mux and controls */
287         virtual TPVStatusCode InitTsc();
288 
289         TPVStatusCode SetTimerRes(uint32 timer_res);
290 
291         //virtual TPVStatusCode SetCapability(CapabilitySet* capabilities) = 0;
292         virtual TPVStatusCode ResetTsc();
293         virtual TPVStatusCode Connect(uint16 info_len = 0, uint8* info_buf = NULL);
294         virtual TPVStatusCode Disconnect();
295         //Network is already disconnected, no need to send out any messages, just shutdown (synchronous call).
296         virtual TPVStatusCode Abort();
297 
298         /* Channel specific commands */
299         virtual TPVStatusCode SetChannelParam(CPVParam* params, TPVChannelId channel_id = CHANNEL_ID_UNKNOWN)
300         {
301             OSCL_UNUSED_ARG(channel_id);
302             OSCL_UNUSED_ARG(params);
303             return EPVT_Success;
304         }
305         virtual TPVStatusCode SetTerminalParam(CPVTerminalParam* params);
306         virtual CPVTerminalParam* GetTerminalParam();
307         virtual TPVStatusCode SetOutgoingBitrate(int32 bitrate);
308 
309 
310         virtual TPVStatusCode RequestFrameUpdate(PVMFPortInterface* port);
311         const uint8* GetFormatSpecificInfo(PVMFPortInterface* port, uint32* len);
312         TPVStatusCode RequestMaxMuxPduSize(unsigned aPduSize);
313         OSCL_IMPORT_REF TPVStatusCode SetTerminalType(uint8 aTType);
314         void SetDatapathLatency(TPVDirection aDir, PVMFPortInterface* aPort, uint32 aLatency);
315         void SetSkewReference(PVMFPortInterface* aPort, PVMFPortInterface* aReferencePort);
316         OSCL_IMPORT_REF void SetMultiplexingDelayMs(uint16 aDelay);
317 
318         /* CPVMultiplexiObserver virtuals */
319         void DataReceptionStart();
320         void MuxSetupComplete(PVMFStatus aStatus, TPVH223Level aLevel);
321         void MuxCloseComplete();
322         void MuxErrorOccurred(TPVDirection direction, TPVMuxComponent component, PVMFStatus error,
323                               uint8* info = NULL, uint info_len = 0);
324         void SkewDetected(TPVChannelId lcn1, TPVChannelId lcn2, uint32 skew);
325         void LcnDataDetected(TPVChannelId lcn);
326 
327         /* H245Observer virtuals */
328         void Handle(PS_ControlMsgHeader msg);
329 
330         // MSD User
331         MSD *Msd;
332         void MSDStart();
333         // Observer functions
334         void MSDDetermineConfirm(MSDStatus type);
335         void MSDDetermineIndication(MSDStatus type);
336         void MSDRejectIndication();
337         void MSDErrorIndication(MSDErrCode errCode);
338 
339         // CE User
340         CE *Ce;
341         void CEStart();
342         // Observer functions
343         void CETransferIndication(OsclSharedPtr<S_TerminalCapabilitySet> tcs);
344         void CETransferConfirm();
345         void CERejectIndication(CESource source, CECause cause, CEDirection direction);
SetLoopbackMode(TPVLoopbackMode aLoopbackMode)346         void SetLoopbackMode(TPVLoopbackMode aLoopbackMode)
347         {
348             iLoopbackMode = aLoopbackMode;
349             if (iH223) iH223->SetLoopbackMode(iLoopbackMode);
350         }
351 
352         //SRP observer functions
TransmissionFailure()353         void TransmissionFailure()
354         {
355             if (iObserver)
356             {
357                 StopData();
358                 iObserver->InternalError();
359             }
360         }
361 
SetWnsrp(bool aEnableWnsrp)362         void SetWnsrp(bool aEnableWnsrp)
363         {
364             iEnableWnsrp = aEnableWnsrp;
365         }
366         void UseWNSRP(bool aUse);
367 
368         LogicalChannelInfo* GetLogicalChannelInfo(PVMFPortInterface& port);
369 
370 
371         /* OsclTimer observer virtuals */
372         void TimeoutOccurred(int32 timerID, int32 timeoutInfo);
373 
374         void ResetStats();
375         void LogStats(TPVDirection dir);
376 
377         /* Set muliplex level.  Can be called when the node is in the Initialized state */
378         OSCL_IMPORT_REF void SetMultiplexLevel(TPVH223Level muxLevel);
379         OSCL_IMPORT_REF void SetSduSize(TPVDirection direction, uint16 size, TPVAdaptationLayer al);
380         OSCL_IMPORT_REF void SetAl2Sn(int width);
381         OSCL_IMPORT_REF void SetAl3ControlFieldOctets(unsigned cfo);
382         OSCL_IMPORT_REF void SetMaxOutgoingPduSize(uint16 size);
383         OSCL_IMPORT_REF void SetMaxMuxPduSize(uint16 size);
384         OSCL_IMPORT_REF void SetMaxCcsrlSduSize(int size);
385         OSCL_IMPORT_REF void SetOutgoingMuxPduType(TPVH223MuxPduType outgoingPduType);
386         /**
387           Sets the list of outgoing channel types to open and the b/w associated with them.
388           Leaves if the media types, number of channels or the bandwidth is not supported
389           **/
390         OSCL_IMPORT_REF void SetOutgoingChannelConfig(Oscl_Vector<H324ChannelParameters, PVMFTscAlloc>& out_channel_config);
391         OSCL_IMPORT_REF void SetIncomingChannelConfig(Oscl_Vector<H324ChannelParameters, PVMFTscAlloc>& in_channel_config);
392         OSCL_IMPORT_REF void SetEndSessionTimeout(uint32 timeout);
393         OSCL_IMPORT_REF void SetAlConfig(PV2WayMediaType media_type,
394                                          TPVAdaptationLayer layer,
395                                          bool allow);
396         OSCL_IMPORT_REF void SetTimerCounter(TPVH324TimerCounter aTimerCounter,
397                                              uint8 aSeries, uint32 aSeriesOffset, uint32 aValue);
398         OSCL_IMPORT_REF void SetVideoResolutions(TPVDirection dir, Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator>& resolutions);
399         OSCL_IMPORT_REF void RmeSendReq(void);
400         void EndSessionCommand(void);          /* Change or End Session         */
401         void Tsc_IdcVi(void);
402         void SendVideoTemporalSpatialTradeoffCommand(TPVChannelId aLogicalChannel, uint8 aTradeoff);
403         void SendVideoTemporalSpatialTradeoffIndication(TPVChannelId aLogicalChannel, uint8 aTradeoff);
404         void SendSkewIndication(TPVChannelId aLogicalChannel1, TPVChannelId aLogicalChannel2, uint16 aSkew);
405         OSCL_IMPORT_REF void  SetLogicalChannelBufferingMs(uint32 aInBufferingMs,
406                 uint32 aOutBufferingMs);
407         void RtdTrfReq(void);
408         OSCL_IMPORT_REF void GetChannelFormatAndCapabilities(TPVDirection dir,
409                 Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>& formats);
410         OSCL_IMPORT_REF void SendTerminalCapabilitySetCommand(void);
411         OSCL_IMPORT_REF void SendModeRequestCommand();
412 
413         void CmdMisc(TCmdMisc type, TPVChannelId channelId, uint32 param = 0);
414 
415         CPvtTerminalCapability* GetRemoteCapability();
416         void SetClock(PVMFMediaClock* aClock);
417         void SetMioLatency(int32 aLatency, bool aAudio);
418 
419     private:
420         /* Function Prototypes */
421         void CommandComplete(Tsc324mNodeCmdQ& aCmdQ, Tsc324mNodeCommand& aCmd, PVMFStatus aStatus, OsclAny* aEventData = NULL);
422 
423         /* Sets the dispatch table entries */
424         void SetDispatchTable();
425         void initVarsLocal();
426         void initVarsSession();
427 
428         OsclAny TcsMsdComplete();
429         OsclAny SignalCsupComplete(PVMFStatus status);
430 
431         /* TSC Handling */
432         /* ------------------------------------ */
433         /*        CALL SETUP Prototypes         */
434         /* ------------------------------------ */
435         uint32 OpenSession(void);
436         uint32 LcEtbIdc(PS_ControlMsgHeader  pReceiveInf);
437         uint32 LcEtbCfm(PS_ControlMsgHeader  pReceiveInf);
438         uint32 LcRlsIdc(PS_ControlMsgHeader  pReceiveInf);
439         uint32 LcErrIdc(PS_ControlMsgHeader  pReceiveInf);
440         uint32 BlcEtbIdc(PS_ControlMsgHeader  pReceiveInf);
441         uint32 BlcEtbCfm(PS_ControlMsgHeader  pReceiveInf);
442         uint32 BlcRlsIdc(PS_ControlMsgHeader  pReceiveInf);
443         uint32 BlcErrIdc(PS_ControlMsgHeader  pReceiveInf);
444         uint32 Status04Event22(PS_ControlMsgHeader  pReceiveInf);
445         uint32 Status04Event23(PS_ControlMsgHeader  pReceiveInf);
446         uint32 Status04Event24(PS_ControlMsgHeader  pReceiveInf);
447         uint32 BlcEtbCfm2(PS_ControlMsgHeader  pReceiveInf);      /* WWU_BLC */
448         uint32 SessionClose_CSUP();
449         uint32 InternalError_CSUP(PS_ControlMsgHeader  pReceiveInf);
450         uint32 MuxTableTransferIndication(PS_ControlMsgHeader  pReceiveInf);
451 
452         /* ------------------------------------ */
453         /*       ONGOING COMM Prototypes        */
454         /* ------------------------------------ */
455         uint32 Status08Event11(PS_ControlMsgHeader  pReceiveInf);
456         uint32 LcRlsCfm(PS_ControlMsgHeader  pReceiveInf);       /* WWU BGFX1 */
457         uint32 BlcRlsCfm(PS_ControlMsgHeader  pReceiveInf);       /* RAN BGFX1 Bi-Dir OLCAck */
458         uint32 Status08Event19(PS_ControlMsgHeader  pReceiveInf);
459         uint32 Status08Event20(PS_ControlMsgHeader  pReceiveInf);
460         uint32 Status08Event21(PS_ControlMsgHeader  pReceiveInf);
461         uint32 Status08Event22(PS_ControlMsgHeader  pReceiveInf);
462         uint32 Status08Event23(PS_ControlMsgHeader  pReceiveInf);
463         uint32 Status08Event24(PS_ControlMsgHeader  pReceiveInf);
464         uint32 Status08Event25(PS_ControlMsgHeader  pReceiveInf);
465         uint32 Status08Event26(PS_ControlMsgHeader  pReceiveInf);
466         uint32 Status08Event27(PS_ControlMsgHeader  pReceiveInf);
467         uint32 ModeRequestIndication(PS_ControlMsgHeader  pReceiveInf);
468         uint32 Status08Event29(PS_ControlMsgHeader  pReceiveInf);
469         uint32 Status08Event30(PS_ControlMsgHeader  pReceiveInf);
470         uint32 Status08Event31(PS_ControlMsgHeader  pReceiveInf);
471         uint32 Status08Event32(PS_ControlMsgHeader  pReceiveInf);
472         uint32 Status08User03(PS_ControlMsgHeader  pReceiveInf);
473         uint32 Status08User04(PS_ControlMsgHeader  pReceiveInf);
474         uint32 SendTerminalCapabilitySet(PS_ControlMsgHeader  pReceiveInf);    /* RAN STCS */
475         uint32 FlowControlCommandReceived(PS_ControlMsgHeader  pReceiveInf);        /* AR FC */
476         uint32 FlowControlIndicationReceived(PS_ControlMsgHeader  pReceiveInf);        /* AR FC */
477         void SendFlowControlIndication();
478         uint32 MiscCmdRecv(PS_ControlMsgHeader  pReceiveInf);        /* RAN MSCL */
479         uint32 Status08Event55(PS_ControlMsgHeader  pReceiveInf);        /* RAN HMR */
480         uint32 Status08User06(PS_ControlMsgHeader  pReceiveInf);        /* RAN RME */
481         uint32 Status08User07(PS_ControlMsgHeader  pReceiveInf);        /* RAN STCS */
482         uint32 Status08User08(PS_ControlMsgHeader  pReceiveInf);        /* RAN HMR */
483         uint32 Status08User09(PS_ControlMsgHeader  pReceiveInf);        /* RAN RCC */
484         uint32 Status08User10(PS_ControlMsgHeader  pReceiveInf);    /* RAN CLC */
485         uint32 SessionClose_Comm();
486         uint32 InternalError_Comm(PS_ControlMsgHeader  pReceiveInf);
487         uint32 EndSessionRecv(PS_ControlMsgHeader  pReceiveInf);
488         uint32 VendorIdRecv(PS_ControlMsgHeader  pReceiveInf);
489         uint32 UserInputIndicationRecv(PS_ControlMsgHeader  pReceiveInf);
490         uint32 MiscIndicationRecv(PS_ControlMsgHeader  pReceiveInf);
491         uint32 SkewIndicationRecv(PS_ControlMsgHeader  pReceiveInf);
492         uint32 FunctionNotSupportedIndicationReceived(PS_ControlMsgHeader  pReceiveInf);
493         void StopData();  /* RAN CLC */
494 
495         uint32 NonProcedure_Ui(PS_ControlMsgHeader  pReceiveInf);
496         uint32 NonProcedure_Se(PS_ControlMsgHeader  pReceiveInf);
497 
498         /* ------------------------------------ */
499         /*           MISC Prototypes            */
500         /* ------------------------------------ */
501         int32 GetReceivedAudioCodec(void);                      // (RAN-TD)
502         int32 GetReceivedVideoCodec(void);                      // (RAN-TD)
503 
504         uint32 CheckAltCapSet(PS_AlternativeCapabilitySet pAltCapSet, uint32 entry, uint32* preference_index);
505         void ExtractTcsParameters(PS_TerminalCapabilitySet pCap);
506         void ParseTcsCapabilities(S_Capability &aCapability);
507 
508         void CmdEcrpt(void);                   /* Encryption                    */
509         void CmdFc(void);                      /* Flow Control                  */
510         PVMFPortInterface* FindOutgoingPort(TPVMediaType_t mediaType);
511 //  void CmdCnf            ( void );       /* Conference Commands           */
512 //  void CmdCm             ( void );       /* Communication Mode Commands   */
513         void CmdHmr(int32);                    /* H223MultiplexReconfiguration  */
514 
515         /* RME */
516         void RmeSendRps(void);
517         void RmeRjtReq(void);
518 
519         /* Mode Request */
520         void getModeRequestInfo(PS_ControlMsgHeader pReceiveInf, int *param1, int *param2);
521         void MrRjtReq(void);
522 
523         // H.245 Miscellaneous Indications
524         typedef enum _TIndicationMisc
525         {
526             EVideoTemporalSpatialTradeOffIdc,
527         } TIndicationMisc;
528         void IndicationMisc(TIndicationMisc type, TPVChannelId channelId, uint32 param = 0, OsclAny* param1 = NULL);
529         void Tsc_IdcSkew(TPVChannelId lcn1, TPVChannelId lcn2, uint16 skew);
530         void SendFunctionNotSupportedIndication(uint16 cause, uint8* function = NULL, uint16 len = 0);
531         // utility functions
532 
533         void ShowTsc(uint16 tag, uint16 indent, char* inString);
534         void IgnoreH245Callbacks();
535         void ConfigureSrp(TPVH223Level aLevel);
536         void StopSrp();
537 
538 #ifdef MEM_TRACK
539         void MemStats();
540 #endif
541         /* member variables */
542         /* The SRP Instance */
543         SRP* iSrp;
544 
545         /* The H245 instance */
546         H245* iH245;
547 
548         /* The H223 instance */
549         H223* iH223;
550 
551         uint32 iTerminalStatus;     /* Terminal Status */
552         uint32 iCeRetries;
553 
554 
555         TPVH245Vendor* iVendor;
556         uint8* iProductNumber;
557         uint32 iProductNumberLen;
558         uint8*  iVersionNumber;
559         uint32 iVersionNumberLen;
560         TPVH245Vendor* iVendorR;
561         uint8* iProductNumberR;
562         uint32 iProductNumberLenR;
563         uint8*  iVersionNumberR;
564         uint32 iVersionNumberLenR;
565 
566         unsigned iSendRme; /* Send RME to remote */
567         unsigned iCsupSeq; /* Order of sending TCS, MSD, VID */
568         unsigned iRequestMaxMuxPduSize; /* Requests maxMuxPduSize to the remote terminal if > 0.  This is done after TCS
569                                              if the remote terminal supports the maxMuxPduCapability */
570         bool iMaxMuxPduCapabilityR;  /* Does the remote terminal suport maxMuxPduCapability ? */
571 
572 
573 
574         // Additional global variables.
575         S_MobileOperationTransmitCapability* iTransmitCaps;
576 
577 
578         /* Who initiated disconnect ? 0 - None, 1 - Local, 2 - Remote */
579         unsigned iDisconnectInitiator;
580 
581         /* Why did the Connect fail ? */
582         TPVStatusCode iConnectFailReason;
583 
584         /* Supplementary Connect info.  We shall use it for now for the case of 2-stage dialling.
585             Here the supplementary info, specifies the url of the person to be dialled */
586         uint8* iSuppInfo;
587         uint32 iSuppInfoLen;
588         // --------------------------------------
589         //  Dispatch table structure definition
590         // --------------------------------------
591         typedef uint32(TSC_324m::*DISPATCH_PTR)(PS_ControlMsgHeader);           /* function pointer              */
592 
593         typedef struct _dispatchtable
594         {
595             DISPATCH_PTR Module;      /* function pointer              */
596             uint32    Status;                         /* Status of terminal            */
597             uint32    Event;                          /* Event                         */
598         } S_DispatchTable;
599         S_DispatchTable     iDispatchTable[100];
600 
601         // ----------------------------------------------------------
602         // Original dispatch table for (Se<->Tsc) events
603         // ----------------------------------------------------------
604         H223ChannelParam* iUnusedChannels[MAX_LCNS];
605         TPVLoopbackMode iLoopbackMode;
606 
607         OsclTimer<OsclMemAllocator>* iTimer;
608     private:
609         // OsclActiveObject virtuals
610         void DoCancel();
611         void Run();
612 
613         Tsc324mNodeCommand* FindPendingStartCmd();
614         int32 FindPendingPortCmd(TPVMFGenericNodeCommand aCmdType,  int32 aPortTag, Tsc324mNodeCommand& cmd);
615         Tsc324mNodeCommand* FindPendingStopCmd();
616 
617         int FindPendingCmd(PVMFCommandId aCommandId);
618         PVMFCommandId QueueCommandL(Tsc324mNodeCommand& aCmd);
619 
620         int32 GetPortTagForLcn(TPVDirection aDir, TPVChannelId aId, PVCodecType_t aCodecType);
621         uint32 GetMaxBitrateForOutgoingChannel(PVCodecType_t codecType);
622         PS_DataType GetDataType(PVCodecType_t codecType, uint32 bitrate, const uint8* dci, uint16 dci_len);
623 
624         PVMFCommandId iCurrentCmdId;
625         // Priority queue of commands
626         Tsc324mNodeCmdQ iCmdQueue;
627         Tsc324mNodeCmdQ iPendingCmdQueue;
628 
629         // SRP ports
630         PVMFPortInterface* iOutgoingSrpPort;
631         PVMFPortInterface* iIncomingSrpPort;
632         TscSrpBuffer* iTscSrpBuffer;
633 
634         /* Mux level */
635         TPVH223Level iH223Level;
636 
637         /* Outgoing pdu type - audio only, video only OR Audio+Video */
638         TPVH223MuxPduType iOutgoingPduType;
639         /* Configuration of incoming channels */
640         Oscl_Vector<H223ChannelParam*, PVMFTscAlloc> iIncomingChannels;
641         /* Pending OLCs:  This includes pending and established uni- and bi- directional, incoming and outgoing OLCs. */
642         PVLogger *iLogger;
643         bool iMuxTableUpdateRequired;
644         uint32 iEndSessionTimeout;
645         Tsc324mNodeCommand *iStopCmd;
646         OsclAny* iStopContext;
647         /* Timer/counter values */
648         H245TimerValues iTimerValues;
649         uint32 iT401; /* SRP */
650         uint32 iN100; /* H245 */
651         uint32 iN401; /* SRP */
652         uint32 iMultiplexingDelayMs;
653         uint32 iInLogicalChannelBufferingMs;
654         uint32 iOutLogicalChannelBufferingMs;
655         TSC_324mObserver* iTSC_324mObserver;
656         Oscl_Map<PVMFPortInterface*, H223IncomingChannelPtr, OsclMemAllocator> iRequestedIncomingChannels;
657         Oscl_Map<PVMFPortInterface*, H223OutgoingChannelPtr, OsclMemAllocator> iRequestedOutgoingChannels;
658         uint32 iNumRtdRequests;
659         uint32 iRtdMin;
660         uint32 iRtdMax;
661         uint32 iRtdAve;
662 
663         bool iEnableWnsrp;
664         bool iInitialized;
665         bool iInitializedComponent;
666 
667         TSC_statemanager iTSCstatemanager;
668         TSC_component* iTSCcomponent;
669         TSC_clc iTSCclc;
670         TSC_blc iTSCblc;
671         TSC_lc  iTSClc;
672         TSC_mt  iTSCmt;
673         TSC_capability iTSCcapability;
674         TSCComponentRegistry iComponentRegistry;
675         PVMFMediaClock* iClock;
676 };
677 
678 #define TSC_TIMER_RES 1000
679 #endif
680 
681