equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef SOCKETCONNECTION_H |
|
19 #define SOCKETCONNECTION_H |
|
20 |
|
21 #include <pthread.h> |
|
22 |
|
23 #include "javaosheaders.h" |
|
24 #include "scopedlocks.h" |
|
25 |
|
26 #include "socket.h" |
|
27 #include "transport.h" |
|
28 |
|
29 namespace java |
|
30 { |
|
31 namespace comms |
|
32 { |
|
33 |
|
34 OS_NONSHARABLE_CLASS(SocketConnection) : public IpcConnectionInterface |
|
35 { |
|
36 public: |
|
37 SocketConnection(IpcListener* aListener); |
|
38 SocketConnection(IpcListener* aListener, int aSocketFd); |
|
39 virtual ~SocketConnection(); |
|
40 |
|
41 // IpcConnectionInterface methods |
|
42 virtual int connect(int aPort); |
|
43 virtual void disconnect(); |
|
44 virtual int send(ipcMessage_t* aMsg); |
|
45 |
|
46 int receive(); |
|
47 int getSocket() const; |
|
48 |
|
49 private: |
|
50 static void* messageLoop(void* aThis); |
|
51 void init(); |
|
52 void close(); |
|
53 |
|
54 pthread_t mThreadId; |
|
55 java::util::ScopedMutex mSendMutex; |
|
56 |
|
57 Socket mSocket; |
|
58 IpcListener* mListener; |
|
59 int mPort; |
|
60 }; |
|
61 |
|
62 } // namespace comms |
|
63 } // namespace java |
|
64 |
|
65 #endif // SOCKETCONNECTION_H |