Rev 3452 | Rev 3456 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3452 | Rev 3454 | ||
|---|---|---|---|
| Line 42... | Line 42... | ||
| 42 | #include "ipcp.h" |
42 | #include "ipcp.h" |
| 43 | 43 | ||
| 44 | #define IPCP_CALLID_SYNC 0 |
44 | #define IPCP_CALLID_SYNC 0 |
| 45 | 45 | ||
| 46 | typedef struct { |
46 | typedef struct { |
| 47 | int phone_hash; |
47 | ipcarg_t phone_hash; |
| 48 | ipc_call_t question; |
48 | ipc_call_t question; |
| 49 | oper_t *oper; |
49 | oper_t *oper; |
| 50 | 50 | ||
| 51 | int call_hash; |
51 | ipc_callid_t call_hash; |
| 52 | 52 | ||
| 53 | link_t link; |
53 | link_t link; |
| 54 | } pending_call_t; |
54 | } pending_call_t; |
| 55 | 55 | ||
| 56 | typedef struct { |
56 | typedef struct { |
| Line 95... | Line 95... | ||
| 95 | pending_call_t *hs; |
95 | pending_call_t *hs; |
| 96 | 96 | ||
| 97 | // printf("pending_call_compare\n"); |
97 | // printf("pending_call_compare\n"); |
| 98 | hs = hash_table_get_instance(item, pending_call_t, link); |
98 | hs = hash_table_get_instance(item, pending_call_t, link); |
| 99 | 99 | ||
| - | 100 | // FIXME: this will fail if sizeof(long) < sizeof(void *). |
|
| 100 | return key[0] == hs->call_hash; |
101 | return key[0] == hs->call_hash; |
| 101 | } |
102 | } |
| 102 | 103 | ||
| 103 | static void pending_call_remove_callback(link_t *item) |
104 | static void pending_call_remove_callback(link_t *item) |
| 104 | { |
105 | { |
| Line 132... | Line 133... | ||
| 132 | /* Not a system method, try the user protocol. */ |
133 | /* Not a system method, try the user protocol. */ |
| 133 | oper = proto_get_oper(proto, method); |
134 | oper = proto_get_oper(proto, method); |
| 134 | } |
135 | } |
| 135 | 136 | ||
| 136 | if (oper != NULL) { |
137 | if (oper != NULL) { |
| 137 | printf("%s (%d)", oper->name, method); |
138 | printf("%s (%ld)", oper->name, method); |
| 138 | return; |
139 | return; |
| 139 | } |
140 | } |
| 140 | 141 | ||
| 141 | printf("%d", method); |
142 | printf("%ld", method); |
| 142 | } |
143 | } |
| 143 | 144 | ||
| 144 | void ipcp_init(void) |
145 | void ipcp_init(void) |
| 145 | { |
146 | { |
| 146 | ipc_m_desc_t *desc; |
147 | ipc_m_desc_t *desc; |
| Line 196... | Line 197... | ||
| 196 | else proto = NULL; |
197 | else proto = NULL; |
| 197 | 198 | ||
| 198 | args = call->args; |
199 | args = call->args; |
| 199 | 200 | ||
| 200 | if ((display_mask & DM_IPC) != 0) { |
201 | if ((display_mask & DM_IPC) != 0) { |
| 201 | printf("Call ID: 0x%x, phone: %d, proto: %s, method: ", hash, |
202 | printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash, |
| 202 | phone, (proto ? proto->name : "n/a")); |
203 | phone, (proto ? proto->name : "n/a")); |
| 203 | ipc_m_print(proto, IPC_GET_METHOD(*call)); |
204 | ipc_m_print(proto, IPC_GET_METHOD(*call)); |
| 204 | printf(" args: (%u, %u, %u, %u, %u)\n", args[1], args[2], |
205 | printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2], |
| 205 | args[3], args[4], args[5]); |
206 | args[3], args[4], args[5]); |
| 206 | } |
207 | } |
| 207 | 208 | ||
| 208 | 209 | ||
| 209 | if ((display_mask & DM_USER) != 0) { |
210 | if ((display_mask & DM_USER) != 0) { |
| Line 255... | Line 256... | ||
| 255 | } |
256 | } |
| 256 | 257 | ||
| 257 | static void parse_answer(ipc_callid_t hash, pending_call_t *pcall, |
258 | static void parse_answer(ipc_callid_t hash, pending_call_t *pcall, |
| 258 | ipc_call_t *answer) |
259 | ipc_call_t *answer) |
| 259 | { |
260 | { |
| 260 | int phone; |
261 | ipcarg_t phone; |
| 261 | ipcarg_t method; |
262 | ipcarg_t method; |
| 262 | ipcarg_t service; |
263 | ipcarg_t service; |
| 263 | int retval; |
264 | ipcarg_t retval; |
| 264 | proto_t *proto; |
265 | proto_t *proto; |
| 265 | int cphone; |
266 | int cphone; |
| 266 | 267 | ||
| 267 | ipcarg_t *resp; |
268 | ipcarg_t *resp; |
| 268 | oper_t *oper; |
269 | oper_t *oper; |
| Line 275... | Line 276... | ||
| 275 | retval = IPC_GET_RETVAL(*answer); |
276 | retval = IPC_GET_RETVAL(*answer); |
| 276 | 277 | ||
| 277 | resp = answer->args; |
278 | resp = answer->args; |
| 278 | 279 | ||
| 279 | if ((display_mask & DM_IPC) != 0) { |
280 | if ((display_mask & DM_IPC) != 0) { |
| 280 | printf("Response to 0x%x: retval=%d, args = (%u, %u, %u, %u, %u)\n", |
281 | printf("Response to 0x%lx: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n", |
| 281 | hash, retval, IPC_GET_ARG1(*answer), |
282 | hash, retval, IPC_GET_ARG1(*answer), |
| 282 | IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), |
283 | IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), |
| 283 | IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); |
284 | IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); |
| 284 | } |
285 | } |
| 285 | 286 | ||
| Line 330... | Line 331... | ||
| 330 | unsigned long key[1]; |
331 | unsigned long key[1]; |
| 331 | 332 | ||
| 332 | // printf("ipcp_call_in()\n"); |
333 | // printf("ipcp_call_in()\n"); |
| 333 | /* printf("phone: %d, method: ", call->in_phone_hash); |
334 | /* printf("phone: %d, method: ", call->in_phone_hash); |
| 334 | ipc_m_print(IPC_GET_METHOD(*call)); |
335 | ipc_m_print(IPC_GET_METHOD(*call)); |
| 335 | printf(" args: (%u, %u, %u, %u, %u)\n", |
336 | printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", |
| 336 | IPC_GET_ARG1(*call), |
337 | IPC_GET_ARG1(*call), |
| 337 | IPC_GET_ARG2(*call), |
338 | IPC_GET_ARG2(*call), |
| 338 | IPC_GET_ARG3(*call), |
339 | IPC_GET_ARG3(*call), |
| 339 | IPC_GET_ARG4(*call), |
340 | IPC_GET_ARG4(*call), |
| 340 | IPC_GET_ARG5(*call) |
341 | IPC_GET_ARG5(*call) |
| 341 | );*/ |
342 | );*/ |
| 342 | 343 | ||
| 343 | if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) { |
344 | if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) { |
| 344 | /* Not a response */ |
345 | /* Not a response */ |
| 345 | if ((display_mask & DM_IPC) != 0) { |
346 | if ((display_mask & DM_IPC) != 0) { |
| 346 | printf("Not a response (hash %d)\n", hash); |
347 | printf("Not a response (hash 0x%lx)\n", hash); |
| 347 | } |
348 | } |
| 348 | return; |
349 | return; |
| 349 | } |
350 | } |
| 350 | 351 | ||
| 351 | hash = hash & ~IPC_CALLID_ANSWERED; |
352 | hash = hash & ~IPC_CALLID_ANSWERED; |