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_CLIENTSERVER_SOCKET_NODE_FACTORY_H_INCLUDED 19 #define PVMF_CLIENTSERVER_SOCKET_NODE_FACTORY_H_INCLUDED 20 21 #ifndef OSCL_SOCKET_TYPES_H_INCLUDED 22 #include "oscl_socket_types.h" 23 #endif 24 #ifndef OSCL_SOCKET_H_INCLUDED 25 #include "oscl_socket.h" 26 #endif 27 #ifndef PVMF_CLIENTSERVER_SOCKET_NODE_H_INCLUDED 28 #include "pvmf_clientserver_socket_node.h" 29 #endif 30 #ifndef OSCL_SCHEDULER_AO_H_INCLUDED 31 #include "oscl_scheduler_ao.h" 32 #endif 33 34 // Forward declaration 35 class PVMFNodeInterface; 36 37 /** 38 * PVMFClientServerSocketNodeFactory Class 39 * 40 * PVMFClientServerSocketNodeFactory class is a singleton class which instantiates and provides 41 * access to PVMF socket node. It returns a PVMFNodeInterface 42 * reference, the interface class of the PVMFClientServerSocketNode. 43 * 44 * The client is expected to contain and maintain a pointer to the instance created 45 * while the node is active. 46 */ 47 class PVMFClientServerSocketNodeFactory 48 { 49 public: 50 /** 51 * Creates an instance of a PVMFClientServerSocketNode. If the creation fails, this function will leave. 52 * 53 * @param aPriority The active object priority for the node. Default is standard priority if not specified 54 * @returns A pointer to an instance of PVMFClientServerSocketNode as PVMFNodeInterface reference or leaves if instantiation fails 55 **/ 56 OSCL_IMPORT_REF static PVMFNodeInterface* CreateClientServerSocketNode(OsclTCPSocket* aSocketHandle, int32 aPriority = OsclActiveObject::EPriorityNominal); 57 58 /** 59 * Deletes an instance of PVMFClientServerSocketNode 60 * and reclaims all allocated resources. An instance can be deleted only in 61 * the idle state. An attempt to delete in any other state will fail and return false. 62 * 63 * @param aNode The PVMFClientServerSocketNode instance to be deleted 64 * @returns A status code indicating success or failure of deletion 65 **/ 66 OSCL_IMPORT_REF static bool DeleteClientServerSocketNode(PVMFNodeInterface* aNode); 67 }; 68 69 #endif // PVMF_CLIENTSERVER_SOCKET_NODE_FACTORY_H_INCLUDED 70