1 | /*
|
---|
2 | * Copyright (c) 2012 Jakub Jermar
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup genericipc
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | */
|
---|
34 |
|
---|
35 | #include <ipc/sysipc_ops.h>
|
---|
36 | #include <abi/ipc/methods.h>
|
---|
37 | #include <abi/errno.h>
|
---|
38 |
|
---|
39 | /* Forward declarations. */
|
---|
40 | sysipc_ops_t ipc_m_connection_clone_ops;
|
---|
41 | sysipc_ops_t ipc_m_clone_establish_ops;
|
---|
42 | sysipc_ops_t ipc_m_connect_to_me_ops;
|
---|
43 | sysipc_ops_t ipc_m_connect_me_to_ops;
|
---|
44 | sysipc_ops_t ipc_m_page_in_ops;
|
---|
45 | sysipc_ops_t ipc_m_share_out_ops;
|
---|
46 | sysipc_ops_t ipc_m_share_in_ops;
|
---|
47 | sysipc_ops_t ipc_m_data_write_ops;
|
---|
48 | sysipc_ops_t ipc_m_data_read_ops;
|
---|
49 | sysipc_ops_t ipc_m_state_change_authorize_ops;
|
---|
50 | sysipc_ops_t ipc_m_debug_ops;
|
---|
51 |
|
---|
52 | static sysipc_ops_t *sysipc_ops[] = {
|
---|
53 | [IPC_M_CONNECTION_CLONE] = &ipc_m_connection_clone_ops,
|
---|
54 | [IPC_M_CLONE_ESTABLISH] = &ipc_m_clone_establish_ops,
|
---|
55 | [IPC_M_CONNECT_TO_ME] = &ipc_m_connect_to_me_ops,
|
---|
56 | [IPC_M_CONNECT_ME_TO] = &ipc_m_connect_me_to_ops,
|
---|
57 | [IPC_M_PAGE_IN] = &ipc_m_page_in_ops,
|
---|
58 | [IPC_M_SHARE_OUT] = &ipc_m_share_out_ops,
|
---|
59 | [IPC_M_SHARE_IN] = &ipc_m_share_in_ops,
|
---|
60 | [IPC_M_DATA_WRITE] = &ipc_m_data_write_ops,
|
---|
61 | [IPC_M_DATA_READ] = &ipc_m_data_read_ops,
|
---|
62 | [IPC_M_STATE_CHANGE_AUTHORIZE] = &ipc_m_state_change_authorize_ops,
|
---|
63 | [IPC_M_DEBUG] = &ipc_m_debug_ops
|
---|
64 | };
|
---|
65 |
|
---|
66 | static sysipc_ops_t null_ops = {
|
---|
67 | .request_preprocess = null_request_preprocess,
|
---|
68 | .request_forget = null_request_forget,
|
---|
69 | .request_process = null_request_process,
|
---|
70 | .answer_cleanup = null_answer_cleanup,
|
---|
71 | .answer_preprocess = null_answer_preprocess,
|
---|
72 | .answer_process = null_answer_process,
|
---|
73 | };
|
---|
74 |
|
---|
75 | int null_request_preprocess(call_t *call, phone_t *phone)
|
---|
76 | {
|
---|
77 | return EOK;
|
---|
78 | }
|
---|
79 |
|
---|
80 | int null_request_forget(call_t *call)
|
---|
81 | {
|
---|
82 | return EOK;
|
---|
83 | }
|
---|
84 |
|
---|
85 | int null_request_process(call_t *call, answerbox_t *box)
|
---|
86 | {
|
---|
87 | return EOK;
|
---|
88 | }
|
---|
89 |
|
---|
90 | int null_answer_cleanup(call_t *call, ipc_data_t *data)
|
---|
91 | {
|
---|
92 | return EOK;
|
---|
93 | }
|
---|
94 |
|
---|
95 | int null_answer_preprocess(call_t *call, ipc_data_t *data)
|
---|
96 | {
|
---|
97 | return EOK;
|
---|
98 | }
|
---|
99 |
|
---|
100 | int null_answer_process(call_t *call)
|
---|
101 | {
|
---|
102 | return EOK;
|
---|
103 | }
|
---|
104 |
|
---|
105 | sysipc_ops_t *sysipc_ops_get(sysarg_t imethod)
|
---|
106 | {
|
---|
107 | if (imethod < sizeof(sysipc_ops) / (sizeof(sysipc_ops_t *)))
|
---|
108 | return sysipc_ops[imethod] ? sysipc_ops[imethod] : &null_ops;
|
---|
109 |
|
---|
110 | return &null_ops;
|
---|
111 | }
|
---|
112 |
|
---|
113 | /** @}
|
---|
114 | */
|
---|