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 #ifndef OSCL_SOCKET_SERV_IMP_BASE_H_INCLUDED 20 #define OSCL_SOCKET_SERV_IMP_BASE_H_INCLUDED 21 22 #include "oscl_base.h" 23 #include "oscl_socket_stats.h" 24 25 class PVLogger; 26 27 /** Socket Server implemenation 28 */ 29 30 /** Base class common to all implementations 31 */ 32 class OsclSocketServIBase 33 { 34 public: ~OsclSocketServIBase()35 virtual ~OsclSocketServIBase() 36 {} 37 38 virtual int32 Connect(uint32 aMessageSlots) = 0; 39 virtual void Close(bool) = 0; 40 41 protected: OsclSocketServIBase(Oscl_DefAlloc & a)42 OsclSocketServIBase(Oscl_DefAlloc &a) 43 : iAlloc(a) 44 { 45 iServError = 0; 46 iServState = ESocketServ_Idle; 47 iLogger = NULL; 48 } 49 50 Oscl_DefAlloc &iAlloc; 51 52 //server state 53 enum TSocketServState 54 { 55 ESocketServ_Idle 56 , ESocketServ_Connected 57 , ESocketServ_Error 58 }; 59 TSocketServState iServState; 60 State()61 TSocketServState State()const 62 { 63 return iServState; 64 } 65 IsServConnected()66 bool IsServConnected()const 67 { 68 return iServState == ESocketServ_Connected; 69 } 70 int iServError; 71 72 #if(PV_OSCL_SOCKET_STATS_LOGGING) 73 //server stats 74 OsclSocketServStats iServStats; 75 #endif 76 77 public: 78 PVLogger* iLogger; 79 }; 80 81 82 83 #endif 84 85 86 87