• 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 #ifndef OSCL_IP_SOCKET_H_INCLUDED
20 #define OSCL_IP_SOCKET_H_INCLUDED
21 
22 #include "oscl_socket_types.h"
23 #include "oscl_vector.h"
24 #include "oscl_mem.h"
25 
26 /** OsclIPSocketI is the base class for UDP and TCP socket implementations.
27 */
28 class OsclSocketServ;
29 class OsclSocketI;
30 class OsclSocketServI;
31 class PVLogger;
32 class OsclIPSocketI
33 {
34     public:
35         //Synchronous methods.
36         int32 Bind(OsclNetworkAddress& aAddress);
37         int32 Join(OsclNetworkAddress& aAddress);
38         int32 SetRecvBufferSize(uint32 size);
39         virtual int32 Close() = 0;
40         virtual uint8 *GetRecvData(int32 *aLength) = 0;
41         virtual uint8 *GetSendData(int32 *aLength) = 0;
~OsclIPSocketI()42         virtual ~OsclIPSocketI() {}
43 
SocketServ()44         OsclSocketServI* SocketServ()
45         {
46             return iSocketServ;
47         }
Alloc()48         Oscl_DefAlloc& Alloc()
49         {
50             return iAlloc;
51         }
52 
53     protected:
54         Oscl_DefAlloc &iAlloc;
55 
56         OsclNetworkAddress iAddress;
57         uint32 iId;
58         OsclSocketObserver *iObserver;
59         OsclSocketI *iSocket;
60         OsclSocketServI *iSocketServ;
61         PVLogger* iLogger;
62 
63         friend class OsclSocketRequestAO;
64         friend class OsclSocketMethod;
65 
OsclIPSocketI(Oscl_DefAlloc & a)66         OsclIPSocketI(Oscl_DefAlloc& a): iAlloc(a)
67                 , iId(0)
68                 , iObserver(NULL)
69                 , iSocket(NULL)
70                 , iSocketServ(NULL)
71                 , iLogger(NULL)
72         {}
73 
74         void ConstructL(OsclSocketObserver *aObs, OsclSocketI* aSock, OsclSocketServI* aServ, uint32 aId);
75 
76 };
77 
78 
79 
80 #endif
81 
82 
83