• 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_ACCEPT_H_INCLUDED
20 #define OSCL_SOCKET_ACCEPT_H_INCLUDED
21 
22 
23 #include "oscl_socket_imp.h"
24 #include "oscl_socket_serv_imp.h"
25 #include "oscl_socket_method.h"
26 
27 /**
28   Internal implementation of Accept
29   */
30 class OsclAcceptRequest;
31 
32 class OsclAcceptMethod : public OsclSocketMethod
33 {
34     public:
35         static OsclAcceptMethod *NewL(OsclIPSocketI& c);
36 
37         ~OsclAcceptMethod();
38 
39         TPVSocketEvent Accept(int32 aTimeout);
40 
41         void DiscardAcceptedSocket();
42         OsclSocketI *GetAcceptedSocket();
43 
44     private:
45 
OsclAcceptMethod(OsclIPSocketI & c)46         OsclAcceptMethod(OsclIPSocketI &c)
47                 : OsclSocketMethod(c, "osclacceptmethod", EPVSocketAccept)
48                 , iAcceptedSocket(NULL)
49         {}
50 
51         void ConstructL();
52 
53         void Run();
54 
SocketServ()55         OsclSocketServI *SocketServ()
56         {
57             return iContainer.SocketServ();
58         }
59     public:
AcceptRequest()60         OsclAcceptRequest *AcceptRequest()
61         {
62             return (OsclAcceptRequest*)iSocketRequestAO;
63         }
64     private:
65         OsclSocketI *iAcceptedSocket;
66 };
67 
68 /**
69   This is the AO that interacts with the socket server
70   */
71 class AcceptParam;
72 
73 class OsclAcceptRequest : public OsclSocketRequestAO
74 {
75     public:
OsclAcceptRequest(OsclSocketMethod & c)76         OsclAcceptRequest(OsclSocketMethod& c)
77                 : OsclSocketRequestAO(c, "osclacceptreq")
78         {}
79 
80         void Accept(OsclSocketI &aSocket);
81 
82     private:
83         void Run();
84 
Param()85         AcceptParam*Param()
86         {
87             return(AcceptParam*)iParam;
88         }
89 };
90 
91 
92 
93 
94 #endif
95 
96