Rev 2873 | Rev 2877 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2873 | Rev 2874 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | #include <stdio.h> |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
8 | #include <stdlib.h> |
9 | #include <libadt/hash_table.h> |
9 | #include <libadt/hash_table.h> |
10 | 10 | ||
11 | #include "ipc_desc.h" |
11 | #include "ipc_desc.h" |
12 | #include "ipc.h" |
12 | #include "ipcp.h" |
- | 13 | ||
- | 14 | typedef struct { |
|
- | 15 | int phone_hash; |
|
- | 16 | ipc_call_t question; |
|
- | 17 | ||
- | 18 | int call_hash; |
|
- | 19 | ||
- | 20 | link_t link; |
|
- | 21 | } pending_call_t; |
|
13 | 22 | ||
14 | typedef struct { |
23 | typedef struct { |
15 | int server; |
24 | int server; |
16 | proto_t *proto; |
25 | proto_t *proto; |
17 | } connection_t; |
26 | } connection_t; |
Line 91... | Line 100... | ||
91 | void ipcp_cleanup(void) |
100 | void ipcp_cleanup(void) |
92 | { |
101 | { |
93 | hash_table_destroy(&pending_calls); |
102 | hash_table_destroy(&pending_calls); |
94 | } |
103 | } |
95 | 104 | ||
96 | void ipc_parse_call_out(int phone, ipc_call_t *call, ipc_callid_t hash) |
105 | void ipcp_call_out(int phone, ipc_call_t *call, ipc_callid_t hash) |
97 | { |
106 | { |
98 | pending_call_t *pcall; |
107 | pending_call_t *pcall; |
99 | 108 | ||
100 | // printf("ipc_parse_call_out()\n"); |
109 | // printf("ipcp_call_out()\n"); |
101 | printf("call id: 0x%x, phone: %d, method: ", hash, phone); |
110 | printf("call id: 0x%x, phone: %d, method: ", hash, phone); |
102 | ipc_m_print(IPC_GET_METHOD(*call)); |
111 | ipc_m_print(IPC_GET_METHOD(*call)); |
103 | printf(" args: (%u, %u, %u, %u, %u)\n", |
112 | printf(" args: (%u, %u, %u, %u, %u)\n", |
104 | IPC_GET_ARG1(*call), |
113 | IPC_GET_ARG1(*call), |
105 | IPC_GET_ARG2(*call), |
114 | IPC_GET_ARG2(*call), |
Line 116... | Line 125... | ||
116 | pcall->call_hash = hash; |
125 | pcall->call_hash = hash; |
117 | 126 | ||
118 | hash_table_insert(&pending_calls, &pcall->call_hash, &pcall->link); |
127 | hash_table_insert(&pending_calls, &pcall->call_hash, &pcall->link); |
119 | } |
128 | } |
120 | 129 | ||
121 | void ipc_parse_call_in(ipc_call_t *call, ipc_callid_t hash) |
130 | void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash) |
122 | { |
131 | { |
123 | link_t *item; |
132 | link_t *item; |
124 | pending_call_t *pcall; |
133 | pending_call_t *pcall; |
125 | 134 | ||
126 | // printf("ipc_parse_call_in()\n"); |
135 | // printf("ipcp_call_in()\n"); |
127 | /* printf("phone: %d, method: ", call->in_phone_hash); |
136 | /* printf("phone: %d, method: ", call->in_phone_hash); |
128 | ipc_m_print(IPC_GET_METHOD(*call)); |
137 | ipc_m_print(IPC_GET_METHOD(*call)); |
129 | printf(" args: (%u, %u, %u, %u, %u)\n", |
138 | printf(" args: (%u, %u, %u, %u, %u)\n", |
130 | IPC_GET_ARG1(*call), |
139 | IPC_GET_ARG1(*call), |
131 | IPC_GET_ARG2(*call), |
140 | IPC_GET_ARG2(*call), |
Line 149... | Line 158... | ||
149 | 158 | ||
150 | printf("response matched to question\n"); |
159 | printf("response matched to question\n"); |
151 | hash_table_remove(&pending_calls, &hash, 1); |
160 | hash_table_remove(&pending_calls, &hash, 1); |
152 | } |
161 | } |
153 | 162 | ||
154 | void ipc_parse_call_sync(int phone, ipc_call_t *call, ipc_call_t *answer) |
163 | void ipcp_call_sync(int phone, ipc_call_t *call, ipc_call_t *answer) |
155 | { |
164 | { |
156 | ipc_parse_call_out(phone, call, 0); |
165 | ipcp_call_out(phone, call, 0); |
157 | ipc_parse_call_in(answer, 0); |
166 | ipcp_call_in(answer, 0); |
158 | } |
167 | } |
159 | 168 | ||
160 | void ipc_parse_hangup(int phone, int rc) |
169 | void ipcp_hangup(int phone, int rc) |
161 | { |
170 | { |
162 | printf("hangup phone %d -> %d\n", phone, rc); |
171 | printf("hangup phone %d -> %d\n", phone, rc); |
163 | } |
172 | } |
164 | 173 | ||
165 | /** @} |
174 | /** @} |