|
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: IPC interface |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TRANSPORT_H |
|
19 #define TRANSPORT_H |
|
20 |
|
21 #include "javaosheaders.h" |
|
22 |
|
23 namespace java |
|
24 { |
|
25 namespace comms |
|
26 { |
|
27 |
|
28 typedef struct ipcHeader_s |
|
29 { |
|
30 int messageId; |
|
31 int length; |
|
32 int receiver; |
|
33 int sender; |
|
34 int moduleId; |
|
35 int messageRef; |
|
36 int permissions; |
|
37 } ipcHeader_t; |
|
38 |
|
39 typedef struct ipcMessage_s |
|
40 { |
|
41 ipcHeader_t ipcHeader; |
|
42 char data[1]; |
|
43 } ipcMessage_t; |
|
44 |
|
45 class IpcListener |
|
46 { |
|
47 public: |
|
48 virtual void processMessage(const ipcMessage_t* aMsg) = 0; |
|
49 virtual void onStart() = 0; |
|
50 virtual void onExit() = 0; |
|
51 }; |
|
52 |
|
53 class IpcConnectionInterface |
|
54 { |
|
55 public: |
|
56 virtual ~IpcConnectionInterface() {}; |
|
57 virtual int connect(int aAddr) = 0; |
|
58 virtual void disconnect() = 0; |
|
59 virtual int send(ipcMessage_t* aMsg) = 0; |
|
60 }; |
|
61 |
|
62 class IpcServerConnectionInterface |
|
63 { |
|
64 public: |
|
65 virtual ~IpcServerConnectionInterface() {}; |
|
66 virtual int start(int aAddr) = 0; |
|
67 virtual void stop() = 0; |
|
68 virtual int send(ipcMessage_t* aMsg) = 0; |
|
69 }; |
|
70 |
|
71 |
|
72 class IpcConnectionFactory |
|
73 { |
|
74 public: |
|
75 OS_IMPORT static IpcConnectionInterface* createConnection(IpcListener* aListener); |
|
76 OS_IMPORT static IpcServerConnectionInterface* createServerConnection(IpcListener* aListener); |
|
77 }; |
|
78 |
|
79 } // namespace comms |
|
80 } // namespace java |
|
81 |
|
82 #endif // TRANSPORT_H |