• 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_SOCKET_RECV_FROM_H_INCLUDED
20 #define OSCL_SOCKET_RECV_FROM_H_INCLUDED
21 
22 #include "oscl_socket_serv_imp.h"
23 #include "oscl_socket_imp.h"
24 #include "oscl_socket_method.h"
25 
26 /**
27   Internal implementation of RecvFrom
28   */
29 class OsclRecvFromRequest;
30 
31 class OsclRecvFromMethod : public OsclSocketMethod
32 {
33     public:
34         static OsclRecvFromMethod *NewL(OsclIPSocketI& c);
35 
36         ~OsclRecvFromMethod();
37 
38         TPVSocketEvent RecvFrom(uint8* &aPtr, uint32 aMaxLen,
39                                 OsclNetworkAddress &aAddress,
40                                 int32 aTimeout,
41                                 uint32 aMultiMax,
42                                 Oscl_Vector<uint32, OsclMemAllocator>* aPacketLen,
43                                 Oscl_Vector<OsclNetworkAddress, OsclMemAllocator>* aPacketSource);
44 
45         uint8 *GetRecvData(int32 *aLength);
46 
47     private:
OsclRecvFromMethod(OsclIPSocketI & c)48         OsclRecvFromMethod(OsclIPSocketI& c)
49                 : OsclSocketMethod(c, "osclrecvfrommethod", EPVSocketRecvFrom)
50         {}
51 
52         void ConstructL();
53 
54     public:
RecvFromRequest()55         OsclRecvFromRequest *RecvFromRequest()
56         {
57             return (OsclRecvFromRequest*)iSocketRequestAO;
58         }
59 };
60 
61 /**
62   This is the AO that interacts with the socket server
63   */
64 class OsclRecvFromRequest : public OsclSocketRequestAO
65 {
66     public:
67         uint8 *GetRecvData(int32 *aLength);
68 
OsclRecvFromRequest(OsclSocketMethod & c)69         OsclRecvFromRequest(OsclSocketMethod& c)
70                 : OsclSocketRequestAO(c, "osclRecvFromRequest")
71         {}
72 
73         void RecvFrom(uint8* &aPtr, uint32 aMaxLen,
74                       OsclNetworkAddress& aAddress, uint32 aMultiMax,
75                       Oscl_Vector<uint32, OsclMemAllocator>* aPacketLen,
76                       Oscl_Vector<OsclNetworkAddress, OsclMemAllocator>* aPacketSource);
77         void Success();
78 
79     private:
Param()80         RecvFromParam*Param()
81         {
82             return(RecvFromParam*)iParam;
83         }
84 };
85 
86 
87 #endif
88 
89