1/* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18#ifndef PVMF_SOCKET_NODE_H_INCLUDED 19#define PVMF_SOCKET_NODE_H_INCLUDED 20 21#ifndef OSCL_BASE_H_INCLUDED 22#include "oscl_base.h" 23#endif 24#ifndef OSCLCONFIG_IO_H_INCLUDED 25#include "osclconfig_io.h" 26#endif 27#ifndef OSCL_FILE_IO_H_INCLUDED 28#include "oscl_file_io.h" 29#endif 30#ifndef OSCL_PRIQUEUE_H_INCLUDED 31#include "oscl_priqueue.h" 32#endif 33#ifndef OSCL_SCHEDULER_AO_H_INCLUDED 34#include "oscl_scheduler_ao.h" 35#endif 36#ifndef OSCL_SOCKET_TYPES_H_INCLUDED 37#include "oscl_socket_types.h" 38#endif 39#ifndef OSCL_SOCKET_H_INCLUDED 40#include "oscl_socket.h" 41#endif 42#ifndef OSCL_DNS_H_INCLUDED 43#include "oscl_dns.h" 44#endif 45#include "oscl_tickcount.h" 46#include "oscl_mem_mempool.h" 47 48#ifndef PVMF_FORMAT_TYPE_H_INCLUDED 49#include "pvmf_format_type.h" 50#endif 51#ifndef PVMF_SIMPLE_MEDIA_BUFFER_H_INCLUDED 52#include "pvmf_simple_media_buffer.h" 53#endif 54#ifndef PVMF_MEDIA_DATA_H_INCLUDED 55#include "pvmf_media_data.h" 56#endif 57#ifndef PVMF_NODE_INTERFACE_H_INCLUDED 58#include "pvmf_node_interface.h" 59#endif 60 61#ifndef PVMI_DATA_STREAM_INTERFACE_H_INCLUDED 62#include "pvmi_data_stream_interface.h" 63#endif 64 65#include "pvmf_node_utils.h" 66#include "pvmf_socket_port.h" 67 68#ifndef PVMF_SOCKET_NODE_EXTENSION_INTERFACE_H_INCLUDED 69#include "pvmf_socket_node_extension_interface.h" 70#endif 71 72#ifndef PVMF_SM_TUNABLES_H_INCLUDED 73#include "pvmf_sm_tunables.h" 74#endif 75#ifndef PVMF_RESIZABLE_SIMPLE_MEDIAMSG_H_INCLUDED 76#include "pvmf_resizable_simple_mediamsg.h" 77#endif 78#include "pvmf_socket_node_events.h" 79#include "pvmf_media_frag_group.h" 80 81//Enable socket node stats unless this is a release build. 82#include "osclconfig.h" 83#if(OSCL_RELEASE_BUILD) 84#define ENABLE_SOCKET_NODE_STATS 0 85#else 86#define ENABLE_SOCKET_NODE_STATS 1 87#endif 88 89//Logger macros 90#define PVMF_SOCKETNODE_LOGSTACKTRACE(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_STACK_TRACE,m); 91#define PVMF_SOCKETNODE_LOGINFO(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_INFO,m); 92#define PVMF_SOCKETNODE_LOGERROR(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_ERR,m); 93#define PVMF_SOCKETNODE_LOGWARNING(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iLogger,PVLOGMSG_WARNING,m); 94#define PVMF_SOCKETNODE_LOGDATATRAFFIC_I(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iDataPathLogger,PVLOGMSG_INFO,m); 95#define PVMF_SOCKETNODE_LOGDATATRAFFIC_E(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iDataPathLogger,PVLOGMSG_ERR,m); 96#define PVMF_SOCKETNODE_LOGDATATRAFFIC_RTP(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iDataPathLoggerRTP,PVLOGMSG_INFO,m); 97#define PVMF_SOCKETNODE_LOGDATATRAFFIC_RTCP(m) PVLOGGER_LOGMSG(PVLOGMSG_INST_REL,iDataPathLoggerRTCP,PVLOGMSG_INFO,m); 98 99//memory allocator type for this node. 100typedef OsclMemAllocator PVMFSocketNodeAllocator; 101 102//Node command type. 103typedef PVMFGenericNodeCommand<PVMFSocketNodeAllocator> PVMFSocketNodeCommandBase; 104class PVMFSocketNodeCommand: public PVMFSocketNodeCommandBase 105{ 106 public: 107 108}; 109 110//Default vector reserve size 111#define PVMF_SOCKET_NODE_COMMAND_VECTOR_RESERVE 10 112 113//Starting value for command IDs 114#define PVMF_SOCKET_NODE_COMMAND_ID_START 6000 115 116class PVLogger; 117class PVMFSocketPort; 118 119/** 120 * Mem pool class 121 */ 122class PVMFSocketNodeMemPool 123{ 124 public: 125 PVMFSocketNodeMemPool(uint32 aMemPoolNumBufs = DEFAULT_NUM_MEDIA_MSGS_IN_JITTER_BUFFER); 126 127 virtual ~PVMFSocketNodeMemPool() 128 { 129 if (iMediaDataMemPool != NULL) 130 { 131 iMediaDataMemPool->removeRef(); 132 iMediaDataMemPool = NULL; 133 } 134 }; 135 136 OsclSharedPtr<PVMFMediaDataImpl> getMediaDataImpl(uint32 size) 137 { 138 OsclSharedPtr<PVMFMediaDataImpl> mediaImpl = iMediaMsgAllocator->allocate(size); 139 return mediaImpl; 140 } 141 142 void resizeSocketDataBuffer(OsclSharedPtr<PVMFMediaDataImpl>& aSharedBuffer) 143 { 144 if (iMediaMsgAllocator != NULL) 145 { 146 iMediaMsgAllocator->ResizeMemoryFragment(aSharedBuffer); 147 } 148 } 149 150 void CreateAllocators(const OSCL_HeapString<OsclMemAllocator>& iMime, uint32 aSize, uint32 aExpectedNumberOfBlocksPerBuffer, uint32 aResizeSize, uint32 aMaxNumResizes); 151 OsclMemPoolResizableAllocator* CreateResizableDataBufferAllocator(const char* allocatorName); 152 void CreateDefaultDataBufferAllocator(const char* allocatorName); 153 void CreateUDPMultipleRecvAllocator(); 154 155 uint32 GetMaxSizeMediaMsgLen(); 156 157 void DestroyAllocators(); 158 void DestroyUDPMultipleRecvAllocator(); 159 160 class SharedDataBufferInfo 161 { 162 public: 163 SharedDataBufferInfo(): iSize(0), iResizeSize(0), iMaxNumResizes(0), iExpectedNumberOfBlocksPerBuffer(0) {} 164 void Init(uint32 aSize, uint32 aExpectedNumberOfBlocksPerBuffer, uint32 aResizeSize, uint32 aMaxNumResizes) 165 { 166 iSize = aSize; 167 iResizeSize = aResizeSize; 168 iMaxNumResizes = aMaxNumResizes; 169 iExpectedNumberOfBlocksPerBuffer = aExpectedNumberOfBlocksPerBuffer; 170 } 171 uint32 iSize; 172 uint32 iResizeSize; 173 uint32 iMaxNumResizes; 174 uint32 iExpectedNumberOfBlocksPerBuffer; 175 }; 176 SharedDataBufferInfo iSharedDataBufferInfo; 177 // Memory pool for media data objects 178 OsclMemPoolFixedChunkAllocator* iMediaDataMemPool; 179 180 // Allocators for persisting the data received from the server (on all the ports) are created in respective SocketConfig. 181 //For UDP [RTSP Based Streaming], allocators will be created before connection of port to its peer completes. 182 //For TCP [MSHTTP Streaming], size of the memory pool for Data is determined only after receiving ASF header from the streaming server 183 //therefore, to persist the response of the Server before completion of receiving the ASF header, an internal shared buffer allocator is created. 184 PVMFResizableSimpleMediaMsgAlloc* iMediaMsgAllocator; 185 OsclMemPoolResizableAllocator* iSharedBufferAlloc; 186 OsclMemPoolResizableAllocator* iInternalAlloc;//[MSHTTP Streaming Specific specific] 187 188 // Allocator for multiple receives[ for UDP only, will be created and used only when SNODE_ENABLE_UDP_MULTI_PACKET is defined]. 189 PVMFMediaFragGroupCombinedAlloc<PVMFSocketNodeAllocator>* iMediaFragGroupAlloc; 190 OsclMemPoolFixedChunkAllocator* iMediaFragGroupAllocMempool; 191 192 int32 iPortTag; 193}; 194 195/* 196** Socket address structure 197*/ 198 199enum PROTOCOL 200{ 201 INVALID_PROTOCOL, 202 INET_TCP, 203 INET_UDP 204}; 205 206struct SOCKET_ADDR 207{ 208 PROTOCOL iProtocol; 209 210 OsclNetworkAddress iLocalAdd; 211 OsclNetworkAddress iRemoteAdd; 212 213 OSCL_HeapString<PVMFSocketNodeAllocator> iRemoteHost; //could be either DNS or ip address 214 215 //each socket maps to a port, hence a port tag is needed for unique identification 216 int32 iTag; 217}; 218 219class PVMFSocketNode; 220 221/* 222** Socket activity class is used to save Oscl socket or DNS results 223*/ 224class PVMFSocketActivity 225{ 226 public: 227 PVMFSocketActivity(): iValid(false) 228 { 229 } 230 PVMFSocketActivity(PVMFStatus aStatus, int32 aId, int32 aFxn, int32 aEvent, int32 aError) 231 { 232 Set(aStatus, aId, aFxn, aEvent, aError); 233 } 234 void Set(PVMFStatus aStatus, int32 aId, int32 aFxn, int32 aEvent, int32 aError) 235 { 236 iValid = true; 237 iStatus = aStatus; 238 iId = aId; 239 iFxn = aFxn; 240 iEvent = aEvent; 241 iError = aError; 242 } 243 bool iValid; 244 PVMFStatus iStatus; 245 int32 iId; 246 int32 iFxn; 247 int32 iEvent; 248 int32 iError; 249 250 private: 251 252}; 253 254 255/* 256** The Socket port state keeps track of the Connect, Receive, and Send operations on 257** a port, including wait states. Note there may be simultaneous send & receive on 258** a port, so it is necessary to keep separate status. Connect operations cannot 259** be concurrent with either send or receive operations, but for simplicity, the 260** connect status is also maintained separately. 261** 262** The port state also contains information about sequences of operations. 263*/ 264 265//Individual asynchronous operations and wait states that make up a connect or 266//disconnect sequence. 267enum TPVSocketPortConnectOperation 268{ 269 EPVSocketPortConnectOperation_None 270 , EPVSocketPortConnectOperation_GetHostByName 271 , EPVSocketPortConnectOperation_Connect 272 , EPVSocketPortConnectOperation_Shutdown 273 , EPVSocketPortConnectOperation_WaitOnConnectedPort //for sending EOS during disconnect. 274 , EPVSocketPortConnectOperation_WaitOnSendRecvIdle //for shutdown & cleanup. 275 , EPVSocketPortConnectOperation_Last 276}; 277 278//Individual asynchronous operations and wait states that make up a send sequence. 279enum TPVSocketPortSendOperation 280{ 281 EPVSocketPortSendOperation_None 282 , EPVSocketPortSendOperation_Send 283 , EPVSocketPortSendOperation_SendTo 284 , EPVSocketPortSendOperation_Last 285}; 286 287//Individual asynchronous operations and wait states that make up a receive sequence. 288enum TPVSocketPortRecvOperation 289{ 290 EPVSocketPortRecvOperation_None 291 , EPVSocketPortRecvOperation_Recv 292 , EPVSocketPortRecvOperation_RecvFrom 293 , EPVSocketPortRecvOperation_WaitOnConnectedPort 294 , EPVSocketPortRecvOperation_WaitOnMemory 295 , EPVSocketPortRecvOperation_Last 296}; 297 298//Sequences that may require multiple asynchronous operations 299//and/or wait states. There can only be one of these sequences active 300//on a port at a time. For definitions of the operations that make 301//up these sequences, please see the comments in the StartSequence 302//implementation. 303enum TPVSocketPortSequence 304{ 305 EPVSocketPortSequence_None 306 , EPVSocketPortSequence_RequestPort 307 , EPVSocketPortSequence_InputConnectMsg 308 , EPVSocketPortSequence_InputDataMsg 309 , EPVSocketPortSequence_InputDisconnectMsg 310 , EPVSocketPortSequence_SocketCleanup 311 , EPVSocketPortSequence_Last 312}; 313 314class SocketNodePortStats; 315 316class SocketPortState 317{ 318 public: 319 SocketPortState(): iSequence(EPVSocketPortSequence_None) 320 , iSequenceStatus(PVMFSuccess) 321 , iConnectOperation(EPVSocketPortConnectOperation_None) 322 , iConnectOperationStatus(PVMFSuccess) 323 , iConnectOperationCanceled(false) 324 , iSendOperation(EPVSocketPortSendOperation_None) 325 , iSendOperationStatus(PVMFSuccess) 326 , iSendOperationCanceled(false) 327 , iRecvOperation(EPVSocketPortRecvOperation_None) 328 , iRecvOperationStatus(PVMFSuccess) 329 , iRecvOperationCanceled(false) 330 {} 331 332 TPVSocketPortSequence iSequence; 333 PVMFStatus iSequenceStatus; 334 335 TPVSocketPortConnectOperation iConnectOperation; 336 PVMFStatus iConnectOperationStatus; 337 bool iConnectOperationCanceled; 338 339 TPVSocketPortSendOperation iSendOperation; 340 PVMFStatus iSendOperationStatus; 341 bool iSendOperationCanceled; 342 343 TPVSocketPortRecvOperation iRecvOperation; 344 PVMFStatus iRecvOperationStatus; 345 bool iRecvOperationCanceled; 346}; 347 348#if(ENABLE_SOCKET_NODE_STATS) 349/* 350** SocketNodeStats and SocketNodePortStats are used for tracking performance 351** of socket node. 352*/ 353 354//SocketNodePortStats contains all data that is maintained on a per-port basis. 355class SocketNodePortStats 356{ 357 public: 358 SocketNodePortStats() 359 { 360 oscl_memset(this, 0, sizeof(SocketNodePortStats)); 361 } 362 //port events. 363 uint32 iNumPortEventConnectedPortReady; 364 uint32 iNumPortEventConnect; 365 uint32 iNumPortEventIncomingMsg; 366 367 //incoming messages 368 uint32 iNumDequeueIncomingConnectMsg; 369 uint32 iNumDequeueIncomingDisconnectMsg; 370 uint32 iNumDequeueIncomingDataMsg; 371 372 //outgoing messages 373 uint32 iNumQueueOutgoingUDPMsg; 374 uint32 iNumQueueOutgoingTCPMsg; 375 uint32 iNumQueueOutgoingEOSMsg; 376 377 //socket receive results that had to be queued while 378 //waiting on connected port 379 uint32 iNumQueueSocketRecv; 380 381 //number of times wait states were entered. 382 uint32 iNumWaitOnMemory; 383 uint32 iNumWaitOnConnectedPort; 384 uint32 iNumWaitOnSendRecvIdle; 385 386 //memory pool callbacks. 387 uint32 iNumFreeChunkCallback; 388 389 //Oscl socket & OScl DNS callbacks 390 uint32 iNumSocketCallback; 391 uint32 iNumDNSCallback; 392 393 //number of Oscl socket and Oscl DNS calls. 394 uint32 iNumSend; 395 uint32 iNumSendTo; 396 uint32 iNumRecv; 397 uint32 iNumRecvFrom; 398 uint32 iNumRecvFromPackets; 399 uint32 iMaxRecvFromPackets; 400 uint32 iNumGetHostByName; 401 uint32 iNumConnect; 402 uint32 iNumShutdown; 403 404 //Latency times through this node. 405 uint32 iMaxConnectOperationTime[EPVSocketPortConnectOperation_Last]; 406 uint32 iMaxSendOperationTime[EPVSocketPortSendOperation_Last]; 407 uint32 iMaxRecvOperationTime[EPVSocketPortRecvOperation_Last]; 408 409 uint32 iConnectOperationTime[EPVSocketPortConnectOperation_Last]; 410 uint32 iSendOperationTime[EPVSocketPortSendOperation_Last]; 411 uint32 iRecvOperationTime[EPVSocketPortRecvOperation_Last]; 412 413 void StartConnectTime(TPVSocketPortConnectOperation aOp) 414 { 415 iConnectOperationTime[aOp] = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); 416 } 417 void EndConnectTime(TPVSocketPortConnectOperation aOp) 418 { 419 uint32 delta = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()) - iConnectOperationTime[aOp]; 420 if (delta > iMaxConnectOperationTime[aOp]) 421 iMaxConnectOperationTime[aOp] = delta; 422 } 423 void StartRecvTime(TPVSocketPortRecvOperation aOp) 424 { 425 iRecvOperationTime[aOp] = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); 426 } 427 void EndRecvTime(TPVSocketPortRecvOperation aOp) 428 { 429 uint32 delta = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()) - iRecvOperationTime[aOp]; 430 if (delta > iMaxRecvOperationTime[aOp]) 431 iMaxRecvOperationTime[aOp] = delta; 432 } 433 void StartSendTime(TPVSocketPortSendOperation aOp) 434 { 435 iSendOperationTime[aOp] = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); 436 } 437 void EndSendTime(TPVSocketPortSendOperation aOp) 438 { 439 uint32 delta = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()) - iSendOperationTime[aOp]; 440 if (delta > iMaxSendOperationTime[aOp]) 441 iMaxSendOperationTime[aOp] = delta; 442 } 443 void Log(PVLogger* iLogger, OSCL_String& aMime) 444 { 445 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 446 (0, "SocketNodeStats:PORT '%s'", aMime.get_cstr())); 447 448 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 449 (0, "SocketNodeStats: %8d Num PortEventConnectedPortReady", iNumPortEventConnectedPortReady)); 450 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 451 (0, "SocketNodeStats: %8d Num PortEventConnect", iNumPortEventConnect)); 452 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 453 (0, "SocketNodeStats: %8d Num PortEventIncomingMsg", iNumPortEventIncomingMsg)); 454 455 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 456 (0, "SocketNodeStats: %8d Num DequeueIncomingConnectMsg", iNumDequeueIncomingConnectMsg)); 457 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 458 (0, "SocketNodeStats: %8d Num DequeueIncomingDisconnectMsg", iNumDequeueIncomingDisconnectMsg)); 459 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 460 (0, "SocketNodeStats: %8d Num DequeueIncomingDataMsg", iNumDequeueIncomingDataMsg)); 461 462 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 463 (0, "SocketNodeStats: %8d Num QueueOutgoingUDPMsg", iNumQueueOutgoingUDPMsg)); 464 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 465 (0, "SocketNodeStats: %8d Num QueueOutgoingTCPMsg", iNumQueueOutgoingTCPMsg)); 466 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 467 (0, "SocketNodeStats: %8d Num QueueOutgoingEOSMsg", iNumQueueOutgoingEOSMsg)); 468 469 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 470 (0, "SocketNodeStats: %8d Num QueueSocketRecv", iNumQueueSocketRecv)); 471 472 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 473 (0, "SocketNodeStats: %8d Num WaitOnMemory", iNumWaitOnMemory)); 474 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 475 (0, "SocketNodeStats: %8d Num WaitOnConnectedPort", iNumWaitOnConnectedPort)); 476 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 477 (0, "SocketNodeStats: %8d Num WaitOnSendRecvIdle", iNumWaitOnSendRecvIdle)); 478 479 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 480 (0, "SocketNodeStats: %8d Num FreeChunkCallback", iNumFreeChunkCallback)); 481 482 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 483 (0, "SocketNodeStats: %8d Num SocketCallback", iNumSocketCallback)); 484 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 485 (0, "SocketNodeStats: %8d Num DNSCallback", iNumDNSCallback)); 486 487 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 488 (0, "SocketNodeStats: %8d Num Send", iNumSend)); 489 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 490 (0, "SocketNodeStats: %8d Num SendTo", iNumSendTo)); 491 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 492 (0, "SocketNodeStats: %8d Num Recv", iNumRecv)); 493 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 494 (0, "SocketNodeStats: %8d Num RecvFrom", iNumRecvFrom)); 495 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 496 (0, "SocketNodeStats: %8d Num RecvFrom Packets", iNumRecvFromPackets)); 497 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 498 (0, "SocketNodeStats: %8d Max RecvFrom Packets", iMaxRecvFromPackets)); 499 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 500 (0, "SocketNodeStats: %8d Num GetHostByName", iNumGetHostByName)); 501 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 502 (0, "SocketNodeStats: %8d Num Connect", iNumConnect)); 503 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 504 (0, "SocketNodeStats: %8d Num Shutdown", iNumShutdown)); 505 506 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 507 (0, "SocketNodeStats: %8d Max Connect GetHostByName Time (msec)", iMaxConnectOperationTime[EPVSocketPortConnectOperation_GetHostByName])); 508 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 509 (0, "SocketNodeStats: %8d Max Connect Time (msec)", iMaxConnectOperationTime[EPVSocketPortConnectOperation_Connect])); 510 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 511 (0, "SocketNodeStats: %8d Max Connect Shutdown Time (msec)", iMaxConnectOperationTime[EPVSocketPortConnectOperation_Shutdown])); 512 513 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 514 (0, "SocketNodeStats: %8d Max Send Time (msec)", iMaxSendOperationTime[EPVSocketPortSendOperation_Send])); 515 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 516 (0, "SocketNodeStats: %8d Max SendTo Time (msec)", iMaxSendOperationTime[EPVSocketPortSendOperation_SendTo])); 517 518 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 519 (0, "SocketNodeStats: %8d Max Recv Time (msec)", iMaxRecvOperationTime[EPVSocketPortRecvOperation_Recv])); 520 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 521 (0, "SocketNodeStats: %8d Max RecvFrom Time (msec)", iMaxRecvOperationTime[EPVSocketPortRecvOperation_RecvFrom])); 522 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 523 (0, "SocketNodeStats: %8d Max Recv Wait On Connected Port Time (msec)", iMaxRecvOperationTime[EPVSocketPortRecvOperation_WaitOnConnectedPort])); 524 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 525 (0, "SocketNodeStats: %8d Max Recv Wait On Memory Time (msec)", iMaxRecvOperationTime[EPVSocketPortRecvOperation_WaitOnMemory])); 526 527 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_ERR, 528 (0, "SocketNodeStats:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")); 529 } 530}; 531 532//SocketNodeStats contains all data that is maintained on a per-node basis. 533class SocketNodeStats 534{ 535 public: 536 SocketNodeStats() 537 { 538 oscl_memset(this, 0, sizeof(SocketNodeStats)); 539 } 540 541 PVLogger* iLogger; 542 bool iLogged; 543 void Init() 544 { 545 iLogged = false; 546 iLogger = PVLogger::GetLoggerObject("pvplayerdiagnostics.socketnode"); 547 } 548 void Logoff() 549 { 550 iLogger = NULL; 551 } 552 553 //Run calls 554 uint32 iNumRun; 555 556 //Node cmds. 557 uint32 iNumQueueNodeCmd; 558 559 //Number of UDP bind operations. 560 uint32 iNumBind; 561 562 void Log(PVMFPortVector<PVMFSocketPort, PVMFSocketNodeAllocator>& aPortVec); 563}; 564#endif 565 566/* 567** SocketPortConfig contains all the information associated with a port including 568** the Oscl socket, memory pool, and status. 569*/ 570class SocketPortConfig : public OsclMemPoolFixedChunkAllocatorObserver, public OsclMemPoolResizableAllocatorObserver 571{ 572 public: 573 SocketPortConfig() 574 { 575 iPVMFPort = NULL; 576 iSockId = 0; 577 iUDPSocket = NULL; 578 iTCPSocket = NULL; 579 iDNS = NULL; 580 iMemPool = NULL; 581 iContainer = NULL; 582 iTag = PVMF_SOCKET_NODE_PORT_TYPE_UNKNOWN; 583 iRTP = false; 584 iRTCP = false; 585 }; 586 void CleanupMemPools(Oscl_DefAlloc& aAlloc); 587 void CreateAllocators(uint32 aSize, uint32 aExpectedNumberOfBlocksPerBuffer, uint32 aResizeSize, uint32 aMaxNumResizes); 588 589 void freechunkavailable(OsclAny* aContextData); 590 void freeblockavailable(OsclAny* aContextData); 591 592 SocketPortState iState; 593 594 PVMFSocketPort *iPVMFPort; 595 SOCKET_ADDR iAddr; 596 uint32 iSockId; 597 OsclUDPSocket* iUDPSocket; 598 OsclTCPSocket* iTCPSocket; 599 OsclDNS *iDNS; 600 OsclNetworkAddress iSourceAddr;//arg for recv from calls. 601 Oscl_Vector<uint32, OsclMemAllocator> iRecvFromPacketLen;//arg for recv from calls. 602 603 //socket pending request and state 604 PVMFSharedMediaDataPtr iPendingRecvMediaData, iPendingSendMediaData; 605 606 //Fixed chunk memory pool for media messages 607 PVMFSocketNodeMemPool *iMemPool; 608 609 PVMFSocketNode* iContainer; 610 int32 iTag; 611 612 PVMFSocketActivity iSocketRecvActivity; 613 614 OSCL_HeapString<OsclMemAllocator> iMime; 615 bool iRTP; 616 bool iRTCP; 617 618#if(ENABLE_SOCKET_NODE_STATS) 619 SocketNodePortStats iPortStats; 620#endif 621}; 622 623/* 624** DnsCache is used to cache DNS lookup results to avoid unnecessary lookups of a previously 625** used host. 626*/ 627class PVMFDnsCache 628{ 629 public: 630 PVMFDnsCache(uint32 aNumOfRecords = 4): iNumOfRecords(aNumOfRecords), iAddrIP(NULL), iAddrDNS(NULL) 631 { 632 }; 633 ~PVMFDnsCache() 634 { 635 for (uint32 i = 0; i < iNumOfRecords; i++) 636 { 637 if (iAddrDNS) 638 { 639 if (NULL != iAddrDNS[i]) 640 { 641 OSCL_ARRAY_DELETE(iAddrDNS[i]); 642 iAddrDNS[i] = NULL; 643 } 644 } 645 if (iAddrIP) 646 { 647 if (NULL != iAddrIP[i]) 648 { 649 OSCL_ARRAY_DELETE(iAddrIP[i]); 650 iAddrIP[i] = NULL; 651 } 652 } 653 } 654 OSCL_ARRAY_DELETE(iAddrIP); 655 OSCL_ARRAY_DELETE(iAddrDNS); 656 } 657 void NewL(void) 658 { 659 iAddrIP = OSCL_ARRAY_NEW(char*, iNumOfRecords); 660 iAddrDNS = OSCL_ARRAY_NEW(char*, iNumOfRecords); 661 if ((NULL == iAddrIP) || (NULL == iAddrIP)) 662 { 663 OSCL_ARRAY_DELETE(iAddrIP); 664 OSCL_ARRAY_DELETE(iAddrDNS); 665 OSCL_LEAVE(OsclErrNoMemory); 666 } 667 for (uint32 i = 0; i < iNumOfRecords; i++) 668 iAddrDNS[i] = iAddrIP[i] = NULL; 669 }; 670 671 //if name is not in record, add one; if it does, update it 672 bool UpdateCacheRecord(char *name, char *ipAddr) 673 { 674 for (uint32 i = 0; i < iNumOfRecords; i++) 675 { 676 if (NULL == iAddrDNS[i]) 677 {//new record 678 int32 tmpLen = oscl_strlen(name); 679 iAddrDNS[i] = OSCL_ARRAY_NEW(char, tmpLen + 4); 680 oscl_strncpy(iAddrDNS[i], name, tmpLen + 2); 681 iAddrIP[i] = OSCL_ARRAY_NEW(char, 32); 682 oscl_strncpy(iAddrIP[i], ipAddr, 30); 683 return true; 684 } 685 if (0 == oscl_strcmp(iAddrDNS[i], name)) 686 {//update record 687 if (oscl_strlen(ipAddr) + 1 > 32) 688 { 689 return false; 690 } 691 oscl_strncpy(iAddrIP[i], ipAddr, 30); 692 return true; 693 } 694 } 695 return false; 696 } 697 //find the ip address corresponds to name. len is the size of ipAddr bufferr 698 bool QueryGetHostByName(const char *name, char *ipAddr, const uint32 len) 699 { 700 for (uint32 i = 0; i < iNumOfRecords; i++) 701 { 702 if (NULL == iAddrDNS[i]) 703 return false; 704 if (0 == oscl_strcmp(iAddrDNS[i], name)) 705 { 706 if (oscl_strlen(iAddrIP[i]) + 1 > len) 707 { 708 return false; 709 } 710 oscl_strncpy(ipAddr, iAddrIP[i], 30); 711 return true; 712 } 713 } 714 return false; 715 } 716 private: 717 uint32 iNumOfRecords; 718 char** iAddrIP; 719 char** iAddrDNS; 720}; 721 722/* 723** Memory pool sizes. 724*/ 725#define SIMPLE_MEDIA_BUF_CLASS_SIZE 128 /*oscl_mem_aligned_size(sizeof(PVMFSimpleMediaBuffer) + oscl_mem_aligned_size(sizeof(OsclRefCounterSA<SimpleMediaBufferCombinedCleanupSA>)*/ 726#define MEDIA_DATA_CLASS_SIZE 128 /*oscl_mem_aligned_size(sizeof(PVMFMediaData)) + oscl_mem_aligned_size(sizeof(OsclRefCounterDA)) + oscl_mem_aligned_size(sizeof(MediaDataCleanupDA)) + sizeof(PVMFMediaMsgHeader))*/ 727 728/* 729** The Socket Node 730*/ 731class PVMFSocketNode 732 : public PVInterface 733 , public PVMFNodeInterface 734 , public OsclActiveObject 735 , public OsclSocketObserver 736 , public OsclDNSObserver 737{ 738 public: 739 OSCL_IMPORT_REF PVMFSocketNode(int32 aPriority); 740 OSCL_IMPORT_REF ~PVMFSocketNode(); 741 742 //************ begin OsclSocketObserver 743 OSCL_IMPORT_REF void HandleSocketEvent(int32 aId, TPVSocketFxn aFxn, TPVSocketEvent aEvent, int32 aError); 744 //************ end OsclSocketObserver 745 746 //************ begin OsclDNSObserver 747 OSCL_IMPORT_REF void HandleDNSEvent(int32 aId, TPVDNSFxn aFxn, TPVDNSEvent aEvent, int32 aError); 748 //************ end OsclDNSObserver 749 750 //from PVMFNodeInterface 751 OSCL_IMPORT_REF PVMFStatus ThreadLogon(); 752 OSCL_IMPORT_REF PVMFStatus ThreadLogoff(); 753 OSCL_IMPORT_REF PVMFStatus GetCapability(PVMFNodeCapability& aNodeCapability); 754 OSCL_IMPORT_REF PVMFPortIter* GetPorts(const PVMFPortFilter* aFilter = NULL); 755 OSCL_IMPORT_REF PVMFCommandId QueryUUID(PVMFSessionId, const PvmfMimeString& aMimeType, 756 Oscl_Vector<PVUuid, PVMFSocketNodeAllocator>& aUuids, 757 bool aExactUuidsOnly = false, 758 const OsclAny* aContext = NULL); 759 OSCL_IMPORT_REF PVMFCommandId QueryInterface(PVMFSessionId, const PVUuid& aUuid, 760 PVInterface*& aInterfacePtr, 761 const OsclAny* aContext = NULL); 762 763 OSCL_IMPORT_REF PVMFCommandId RequestPort(PVMFSessionId aSession 764 , int32 aPortTag 765 , const PvmfMimeString* aPortConfig = NULL 766 , const OsclAny* aContext = NULL); 767 768 OSCL_IMPORT_REF PVMFCommandId ReleasePort(PVMFSessionId, PVMFPortInterface& aPort, const OsclAny* aContext = NULL); 769 OSCL_IMPORT_REF PVMFCommandId Init(PVMFSessionId, const OsclAny* aContext = NULL); 770 OSCL_IMPORT_REF PVMFCommandId Prepare(PVMFSessionId, const OsclAny* aContext = NULL); 771 OSCL_IMPORT_REF PVMFCommandId Start(PVMFSessionId, const OsclAny* aContext = NULL); 772 OSCL_IMPORT_REF PVMFCommandId Stop(PVMFSessionId, const OsclAny* aContext = NULL); 773 OSCL_IMPORT_REF PVMFCommandId Flush(PVMFSessionId, const OsclAny* aContext = NULL); 774 OSCL_IMPORT_REF PVMFCommandId Pause(PVMFSessionId, const OsclAny* aContext = NULL); 775 OSCL_IMPORT_REF PVMFCommandId Reset(PVMFSessionId, const OsclAny* aContext = NULL); 776 OSCL_IMPORT_REF PVMFCommandId CancelAllCommands(PVMFSessionId, const OsclAny* aContextData = NULL); 777 OSCL_IMPORT_REF PVMFCommandId CancelCommand(PVMFSessionId, PVMFCommandId aCmdId, const OsclAny* aContextData = NULL); 778 779 //from PVMFPortActivityHandler 780 void HandlePortActivity(const PVMFPortActivity& aActivity); 781 782 //These are some extra APIs that are used by Streaming Manager and are unique to socket node. 783 OSCL_IMPORT_REF bool GetPortConfig(PVMFPortInterface &aPort, OsclNetworkAddress &aLocalAdd, OsclNetworkAddress &aRemoteAdd); 784 OSCL_IMPORT_REF bool SetPortConfig(PVMFPortInterface &aPort, OsclNetworkAddress aLocalAdd, OsclNetworkAddress aRemoteAdd); 785 786 virtual void addRef() 787 { 788 } 789 790 virtual void removeRef() 791 { 792 } 793 794 virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface); 795 796 //**********begin PVMFSocketNodeExtensionInterface 797 PVMFStatus AllocateConsecutivePorts(PvmfMimeString* aPortConfig, 798 uint32& aLowerPortNum, 799 uint32& aHigherPortNum, uint32& aStartPortNum); 800 OSCL_IMPORT_REF PVMFStatus SetMaxTCPRecvBufferSize(uint32 aBufferSize); 801 OSCL_IMPORT_REF PVMFStatus GetMaxTCPRecvBufferSize(uint32& aSize); 802 OSCL_IMPORT_REF PVMFStatus SetMaxTCPRecvBufferCount(uint32 aBufferSize); 803 OSCL_IMPORT_REF PVMFStatus GetMaxTCPRecvBufferCount(uint32& aSize); 804 OsclMemPoolResizableAllocator* CreateSharedBuffer(const PVMFPortInterface* aPort , uint32 aBufferSize, uint32 aExpectedNumberOfBlocksPerBuffer, uint32 aResizeSize, uint32 aMaxNumResizes); 805 //**********end PVMFSocketNodeExtensionInterface 806 807 private: 808 friend class SocketPortConfig; 809 810 //from OsclActiveObject 811 void Run(); 812 813 /********************************************* 814 * Command Processing and Event Notification 815 **********************************************/ 816 //Command queue type 817 typedef PVMFNodeCommandQueue<PVMFSocketNodeCommand, PVMFSocketNodeAllocator> PVMFSocketNodeCmdQ; 818 819 PVMFSocketNodeCmdQ iPendingCmdQueue; 820 PVMFSocketNodeCmdQ iCurrentCmdQueue; 821 PVMFSocketNodeCmdQ iCancelCmdQueue; 822 823 void MoveCmdToCancelQueue(PVMFSocketNodeCommand& aCmd); 824 825 void CommandComplete(PVMFSocketNodeCmdQ&, 826 PVMFSocketNodeCommand&, 827 PVMFStatus, 828 OsclAny* aData = NULL, 829 PVUuid* aEventUUID = NULL, 830 int32* aEventCode = NULL); 831 832 void ReportErrorEvent(PVMFEventType aEventType, 833 OsclAny* aEventData = NULL, 834 PVUuid* aEventUUID = NULL, 835 int32* aEventCode = NULL); 836 837 void ReportInfoEvent(PVMFEventType aEventType, 838 OsclAny* aEventData = NULL, 839 PVUuid* aEventUUID = NULL, 840 int32* aEventCode = NULL); 841 842 PVMFCommandId QueueCommandL(PVMFSocketNodeCommand& aCmd); 843 844 bool CanProcessCommand(); 845 void ProcessCommand(PVMFSocketNodeCmdQ& aCmdQ, PVMFSocketNodeCommand&); 846 847 //Command handlers. 848 PVMFStatus DoRequestPort(PVMFSocketNodeCommand& aCmd, PVMFSocketPort* &port); 849 PVMFStatus DoReset(PVMFSocketNodeCommand&); 850 PVMFStatus DoQueryUuid(PVMFSocketNodeCommand&); 851 PVMFStatus DoQueryInterface(PVMFSocketNodeCommand&); 852 PVMFStatus DoReleasePort(PVMFSocketNodeCommand&); 853 PVMFStatus DoInit(PVMFSocketNodeCommand&); 854 PVMFStatus DoPrepare(PVMFSocketNodeCommand&); 855 PVMFStatus DoStart(PVMFSocketNodeCommand&); 856 PVMFStatus DoStop(PVMFSocketNodeCommand&); 857 PVMFStatus DoFlush(PVMFSocketNodeCommand&); 858 PVMFStatus DoPause(PVMFSocketNodeCommand&); 859 PVMFStatus DoCancelAllCommands(PVMFSocketNodeCommand&); 860 PVMFStatus DoCancelCommand(PVMFSocketNodeCommand&); 861 862 PVMFStatus DoCancelCurrentCommand(PVMFSocketNodeCmdQ& aCmdQ, PVMFSocketNodeCommand& aCmd); 863 PVMFStatus DoStopNodeActivity(); 864 int32 SocketPlacementNew(PVMFSocketNodeMemPool*&, OsclAny*, int32); 865 int32 CreateMediaData(SocketPortConfig&, OsclSharedPtr<PVMFMediaDataImpl>&); 866 int32 Allocate(SocketPortConfig&, OsclSharedPtr<PVMFMediaDataImpl>&); 867 int32 GetMediaDataImpl(SocketPortConfig&, OsclSharedPtr<PVMFMediaDataImpl>&, int32); 868 869 PVMFSocketPort* iRequestedPort; 870 871 //node state 872 void ChangeExternalState(TPVMFNodeInterfaceState aNewState) 873 { 874 iInterfaceState = aNewState; 875 } 876 877 //node capability 878 PVMFNodeCapability iCapability; 879 880 //for error messages. 881 int32 iCommandErrorCode; 882 int32 iErrorEventErrorCode; 883 void ReportSocketNodeError(PVMFStatus aStatus, PVMFSocketNodeErrorEventType aEvent) 884 { 885 PVUuid eventuuid = PVMFSocketNodeEventTypeUUID; 886 iErrorEventErrorCode = aEvent; 887 ReportErrorEvent(aStatus, NULL, &eventuuid, &iErrorEventErrorCode); 888 } 889 890 //Used to stop all port activity, this var counts down from N to 0, or 891 //has a value of (-1) to indicate it's inactive 892 int32 iNumStopPortActivityPending; 893 894 /********************************************* 895 * Oscl Socket Handling 896 **********************************************/ 897 898 void HandleRecvComplete(SocketPortConfig& tmpSockConfig, PVMFStatus, PVMFSocketActivity*, bool); 899 void HandleRecvFromComplete(SocketPortConfig& tmpSockConfig, PVMFStatus, PVMFSocketActivity*, bool); 900 901 OsclSocketServ *iSockServ; 902 903 const int TIMEOUT_CONNECT; 904 const int TIMEOUT_SEND; 905 const int TIMEOUT_SENDTO; 906 const int TIMEOUT_RECV; 907 const int TIMEOUT_RECVFROM; 908 const int TIMEOUT_SHUTDOWN; 909 const int UDP_PORT_RANGE; 910 const int MAX_UDP_PACKET_SIZE; 911 const int MIN_UDP_PACKET_SIZE; 912 913 int32 iMaxTcpRecvBufferSize; 914 int32 iMaxTcpRecvBufferCount; 915 916 /********************************************* 917 * Oscl DNS Handling 918 **********************************************/ 919 920 PVMFDnsCache iDnsCache; 921 922 /********************************************* 923 * Port Data Handling 924 **********************************************/ 925 926 bool CanProcessIncomingMsg(SocketPortConfig& aSockConfig); 927 928 void ProcessIncomingMsg(SocketPortConfig& aSockConfig); 929 930 bool ParseTransportConfig(OSCL_String *aPortConfig, 931 SOCKET_ADDR &aSockConfig, 932 OSCL_String& aMime); 933 bool ParseTransportConfig(char *aPortConfig, 934 int32 aLen, 935 SOCKET_ADDR &aSockConfig, 936 OSCL_String& aMime); 937 938 /********************************************* 939 * Port & Socket Creation 940 **********************************************/ 941 942 PVMFStatus AllocatePortMemPool(int32 tag, PVMFSocketNodeMemPool* & aMemPool); 943 PVMFStatus AddPort(int32 tag, PVMFSocketPort* &port); 944 void CleanupTCP(SocketPortConfig& tmpSockConfig); 945 void CleanupUDP(SocketPortConfig& tmpSockConfig); 946 void CleanupDNS(SocketPortConfig& tmpSockConfig); 947 void CleanupPorts(); 948 949 OsclAny* CreateOsclSocketAndBind(SOCKET_ADDR &, uint32); 950 951 uint32 iSocketID; 952 bool iInSocketCallback; 953 954 Oscl_Vector<OsclTCPSocket*, OsclMemAllocator> iClosedTCPSocketVector; 955 void CleanupClosedTCPSockets(); 956 Oscl_Vector<OsclUDPSocket*, OsclMemAllocator> iClosedUDPSocketVector; 957 void CleanupClosedUDPSockets(); 958 Oscl_Vector<OsclDNS*, OsclMemAllocator> iClosedDNSVector; 959 void CleanupClosedDNS(); 960 961 /********************************************* 962 * Port Data 963 **********************************************/ 964 965 PVMFPortVector<PVMFSocketPort, PVMFSocketNodeAllocator> iPortVector; 966 Oscl_Vector<SocketPortConfig*, PVMFSocketNodeAllocator> iAllocatedPortVector; 967 968 SocketPortConfig* FindSocketPortConfig(SOCKET_ADDR& aSockConfig); 969 bool MatchSocketAddr(SOCKET_ADDR& aSockAddr, SocketPortConfig& aSockConfig); 970 SocketPortConfig* FindSocketPortConfig(uint32 aId); 971 972 /********************************************* 973 * Operation and Sequence Handlers 974 **********************************************/ 975 976 PVMFStatus StartSequence(SocketPortConfig&, TPVSocketPortSequence, OsclAny* param = NULL); 977 void SequenceComplete(SocketPortConfig& tmpSockConfig, PVMFStatus); 978 979 bool CanReceive(SocketPortConfig& aConfig); 980 981 PVMFStatus StartConnectOperation(SocketPortConfig& aSockConfig, TPVSocketPortConnectOperation aOperation); 982 PVMFStatus StartRecvOperation(SocketPortConfig& aSockConfig); 983 PVMFStatus StartSendOperation(SocketPortConfig& aSockConfig, PVMFSharedMediaMsgPtr& aMsg); 984 void StartRecvWaitOnMemory(SocketPortConfig& aSockConfig, int32 aSize = 0); 985 void StartRecvWaitOnConnectedPort(SocketPortConfig& aSockConfig, PVMFSocketActivity& aSocketActivity); 986 987 PVMFStatus ConnectOperationComplete(SocketPortConfig& tmpSockConfig, PVMFStatus, PVMFSocketActivity*); 988 PVMFStatus SendOperationComplete(SocketPortConfig& tmpSockConfig, PVMFStatus, PVMFSocketActivity*); 989 PVMFStatus RecvOperationComplete(SocketPortConfig& tmpSockConfig, PVMFStatus, PVMFSocketActivity*); 990 991 PVMFStatus CancelSendOperation(SocketPortConfig& tmpSockConfig); 992 PVMFStatus CancelRecvOperation(SocketPortConfig& tmpSockConfig); 993 PVMFStatus CancelConnectOperation(SocketPortConfig& tmpSockConfig); 994 995 /********************************************* 996 * Loggers, Error Trap, Allocator 997 **********************************************/ 998 999 PVLogger *iLogger; 1000 PVLogger *iDataPathLogger; 1001 PVLogger *iDataPathLoggerRTP; 1002 PVLogger *iDataPathLoggerRTCP; 1003 1004 void LogRTPHeaderFields(SocketPortConfig& aSockConfig, 1005 OsclRefCounterMemFrag& memFragIn); 1006 1007 void LogRTCPHeaderFields(SocketPortConfig& aSockConfig, 1008 OsclRefCounterMemFrag& memFragIn); 1009 1010 OsclErrorTrapImp* iOsclErrorTrapImp; 1011 1012 PVMFSocketNodeAllocator iAlloc; 1013 PVMFSocketNodeExtensionInterface* iExtensionInterface; 1014#if(ENABLE_SOCKET_NODE_STATS) 1015 SocketNodeStats iSocketNodeStats; 1016#endif 1017}; 1018 1019class PVMFSocketNodeExtensionInterfaceImpl: public PVInterfaceImpl<PVMFSocketNodeAllocator>, public PVMFSocketNodeExtensionInterface 1020{ 1021 public: 1022 PVMFSocketNodeExtensionInterfaceImpl(PVMFSocketNode* iContainer); 1023 ~PVMFSocketNodeExtensionInterfaceImpl(); 1024 virtual void addRef(); 1025 virtual void removeRef(); 1026 virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface); //From PVInterface 1027 OSCL_IMPORT_REF virtual PVMFStatus AllocateConsecutivePorts(PvmfMimeString* aPortConfig, 1028 uint32& aLowerPortNum, 1029 uint32& aHigherPortNum, uint32& aStartPortNum); 1030 1031 OSCL_IMPORT_REF virtual PVMFStatus SetMaxTCPRecvBufferSize(uint32 aBufferSize); 1032 OSCL_IMPORT_REF virtual PVMFStatus GetMaxTCPRecvBufferSize(uint32& aSize); 1033 OSCL_IMPORT_REF virtual PVMFStatus SetMaxTCPRecvBufferCount(uint32 aCount); 1034 OSCL_IMPORT_REF virtual PVMFStatus GetMaxTCPRecvBufferCount(uint32& aCount); 1035 OSCL_IMPORT_REF virtual OsclMemPoolResizableAllocator* CreateSharedBuffer(const PVMFPortInterface* aPort , uint32 aBufferSize, uint32 aExpectedNumberOfBlocksPerBuffer, uint32 aResizeSize, uint32 aMaxNumResizes); 1036 private: 1037 PVMFSocketNode *iContainer; 1038}; 1039 1040#endif //PVMF_SOCKET_NODE_H_INCLUDED 1041 1042