Rev 2877 | Rev 2880 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2877 | Rev 2878 | ||
---|---|---|---|
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 "proto.h" |
|
12 | #include "ipcp.h" |
13 | #include "ipcp.h" |
13 | 14 | ||
14 | #define IPCP_CALLID_SYNC 0 |
15 | #define IPCP_CALLID_SYNC 0 |
15 | 16 | ||
16 | typedef struct { |
17 | typedef struct { |
Line 137... | Line 138... | ||
137 | 138 | ||
138 | static void parse_answer(pending_call_t *pcall, ipc_call_t *answer) |
139 | static void parse_answer(pending_call_t *pcall, ipc_call_t *answer) |
139 | { |
140 | { |
140 | int phone; |
141 | int phone; |
141 | ipcarg_t method; |
142 | ipcarg_t method; |
- | 143 | ipcarg_t service; |
|
142 | int retval; |
144 | int retval; |
143 | static proto_t proto = { .name = "unknown" }; |
145 | static proto_t proto_unknown = { .name = "unknown" }; |
- | 146 | proto_t *proto; |
|
144 | int cphone; |
147 | int cphone; |
145 | 148 | ||
146 | // printf("parse_answer\n"); |
149 | // printf("parse_answer\n"); |
147 | 150 | ||
148 | phone = pcall->phone_hash; |
151 | phone = pcall->phone_hash; |
Line 151... | Line 154... | ||
151 | printf("phone=%d, method=%d, retval=%d\n", |
154 | printf("phone=%d, method=%d, retval=%d\n", |
152 | phone, method, retval); |
155 | phone, method, retval); |
153 | 156 | ||
154 | if (phone == 0 && method == IPC_M_CONNECT_ME_TO && retval == 0) { |
157 | if (phone == 0 && method == IPC_M_CONNECT_ME_TO && retval == 0) { |
155 | /* Connected to a service (through NS) */ |
158 | /* Connected to a service (through NS) */ |
- | 159 | service = IPC_GET_ARG1(pcall->question); |
|
- | 160 | proto = proto_get_by_srv(service); |
|
- | 161 | if (proto == NULL) proto = &proto_unknown; |
|
- | 162 | ||
156 | cphone = IPC_GET_ARG5(*answer); |
163 | cphone = IPC_GET_ARG5(*answer); |
157 | printf("registering connection (phone %d)\n", cphone); |
164 | printf("registering connection (phone %d, protocol: %s)\n", cphone, |
- | 165 | proto->name); |
|
158 | connection_set(cphone, 0, &proto); |
166 | connection_set(cphone, 0, proto); |
159 | } else { |
- | |
160 | printf("unrecognized connection\n"); |
- | |
161 | } |
167 | } |
162 | } |
168 | } |
163 | 169 | ||
164 | void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash) |
170 | void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash) |
165 | { |
171 | { |