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 ** Socket implementation base class 20 */ 21 22 #include "oscl_socket_imp_base.h" 23 OsclSocketIBase(Oscl_DefAlloc & a)24OsclSocketIBase::OsclSocketIBase(Oscl_DefAlloc &a): iAlloc(a) 25 {} 26 ~OsclSocketIBase()27OsclSocketIBase::~OsclSocketIBase() 28 { 29 } 30 CancelFxn(TPVSocketFxn aType)31void OsclSocketIBase::CancelFxn(TPVSocketFxn aType) 32 { 33 switch (aType) 34 { 35 case EPVSocketConnect: 36 CancelConnect(); 37 break; 38 case EPVSocketAccept: 39 CancelAccept(); 40 break; 41 case EPVSocketShutdown: 42 CancelShutdown(); 43 break; 44 case EPVSocketSend: 45 CancelSend(); 46 break; 47 case EPVSocketRecv: 48 CancelRecv(); 49 break; 50 case EPVSocketSendTo: 51 CancelSendTo(); 52 break; 53 case EPVSocketRecvFrom: 54 CancelRecvFrom(); 55 break; 56 case EPVSocketBind: 57 CancelBind(); 58 break; 59 case EPVSocketListen: 60 CancelListen(); 61 break; 62 default: 63 OSCL_ASSERT(false); 64 break; 65 } 66 } 67 GetShutdown(TPVSocketShutdown aOsclVal)68int OsclSocketIBase::GetShutdown(TPVSocketShutdown aOsclVal) 69 //map socket API value to platform-specific value. 70 { 71 switch (aOsclVal) 72 { 73 case EPVSocketRecvShutdown: 74 return OSCL_SD_RECEIVE; 75 case EPVSocketSendShutdown: 76 return OSCL_SD_SEND; 77 case EPVSocketBothShutdown: 78 return OSCL_SD_BOTH; 79 default: 80 OSCL_ASSERT(0); 81 } 82 return 0; 83 } 84 85 86 87 88 89 90 91 92 93