source: mainline/uspace/srv/net/inetsrv/inetcfg.c@ eec201d

Last change on this file since eec201d was f5837524, checked in by Jakub Jermar <jakub@…>, 7 years ago

Use user-defined labels instead of phone hashes

This commit changes the way how the async framework maps incomming calls
to connections. Instead of abusing the kernel addresses of attached
phones as identifiers, the IPC_M_CONNECT_TO_ME and IPC_M_CONNECT_ME_TO
messages allow the server to specify an arbitrary label which is
remembered in the connected phone and consequently imprinted on each
call which is routed through this phone.

The async framework uses the address of the connection structure as the
label. This removes the need for a connection hash table because each
incoming call already remembers the connection in its label.

To disambiguate this new label and the other user-defined label used for
answers, the call structure now has the request_label member for the
former and answer_label member for the latter.

This commit also moves the kernel definition of ipc_data_t to abi/ and
removes the uspace redefinition thereof. Finally, when forwarding the
IPC_M_CONNECT_TO_ME call, the phone capability and the kernel object
allocated in request_process are now correctly disposed of.

  • Property mode set to 100644
File size: 17.3 KB
Line 
1/*
2 * Copyright (c) 2013 Jiri Svoboda
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 inet
30 * @{
31 */
32/**
33 * @file
34 * @brief
35 */
36
37#include <async.h>
38#include <errno.h>
39#include <macros.h>
40#include <io/log.h>
41#include <ipc/inet.h>
42#include <loc.h>
43#include <stdlib.h>
44#include <str.h>
45#include <stddef.h>
46#include <types/inetcfg.h>
47
48#include "addrobj.h"
49#include "inetsrv.h"
50#include "inet_link.h"
51#include "inetcfg.h"
52#include "sroute.h"
53
54static errno_t inetcfg_addr_create_static(char *name, inet_naddr_t *naddr,
55 sysarg_t link_id, sysarg_t *addr_id)
56{
57 inet_link_t *ilink;
58 inet_addrobj_t *addr;
59 inet_addr_t iaddr;
60 errno_t rc;
61
62 ilink = inet_link_get_by_id(link_id);
63 if (ilink == NULL) {
64 log_msg(LOG_DEFAULT, LVL_DEBUG, "Link %lu not found.",
65 (unsigned long) link_id);
66 return ENOENT;
67 }
68
69 addr = inet_addrobj_new();
70 if (addr == NULL) {
71 *addr_id = 0;
72 return ENOMEM;
73 }
74
75 addr->naddr = *naddr;
76 addr->ilink = ilink;
77 addr->name = str_dup(name);
78 rc = inet_addrobj_add(addr);
79 if (rc != EOK) {
80 log_msg(LOG_DEFAULT, LVL_DEBUG, "Duplicate address name '%s'.", addr->name);
81 inet_addrobj_delete(addr);
82 return rc;
83 }
84
85 inet_naddr_addr(&addr->naddr, &iaddr);
86 rc = iplink_addr_add(ilink->iplink, &iaddr);
87 if (rc != EOK) {
88 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed setting IP address on internet link.");
89 inet_addrobj_remove(addr);
90 inet_addrobj_delete(addr);
91 return rc;
92 }
93
94 return EOK;
95}
96
97static errno_t inetcfg_addr_delete(sysarg_t addr_id)
98{
99 inet_addrobj_t *addr;
100
101 addr = inet_addrobj_get_by_id(addr_id);
102 if (addr == NULL)
103 return ENOENT;
104
105 inet_addrobj_remove(addr);
106 inet_addrobj_delete(addr);
107
108 return EOK;
109}
110
111static errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
112{
113 inet_addrobj_t *addr;
114
115 addr = inet_addrobj_get_by_id(addr_id);
116 if (addr == NULL)
117 return ENOENT;
118
119 ainfo->naddr = addr->naddr;
120 ainfo->ilink = addr->ilink->svc_id;
121 ainfo->name = str_dup(addr->name);
122
123 return EOK;
124}
125
126static errno_t inetcfg_addr_get_id(char *name, sysarg_t link_id, sysarg_t *addr_id)
127{
128 inet_link_t *ilink;
129 inet_addrobj_t *addr;
130
131 ilink = inet_link_get_by_id(link_id);
132 if (ilink == NULL) {
133 log_msg(LOG_DEFAULT, LVL_DEBUG, "Link %zu not found.", (size_t) link_id);
134 return ENOENT;
135 }
136
137 addr = inet_addrobj_find_by_name(name, ilink);
138 if (addr == NULL) {
139 log_msg(LOG_DEFAULT, LVL_DEBUG, "Address '%s' not found.", name);
140 return ENOENT;
141 }
142
143 *addr_id = addr->id;
144 return EOK;
145}
146
147static errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
148{
149 return inet_addrobj_get_id_list(addrs, count);
150}
151
152static errno_t inetcfg_get_link_list(sysarg_t **addrs, size_t *count)
153{
154 return inet_link_get_id_list(addrs, count);
155}
156
157static errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
158{
159 return inet_sroute_get_id_list(sroutes, count);
160}
161
162static errno_t inetcfg_link_add(sysarg_t link_id)
163{
164 return inet_link_open(link_id);
165}
166
167static errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
168{
169 inet_link_t *ilink;
170
171 ilink = inet_link_get_by_id(link_id);
172 if (ilink == NULL) {
173 return ENOENT;
174 }
175
176 linfo->name = str_dup(ilink->svc_name);
177 linfo->def_mtu = ilink->def_mtu;
178 if (ilink->mac_valid) {
179 addr48(ilink->mac, linfo->mac_addr);
180 } else {
181 memset(linfo->mac_addr, 0, sizeof(linfo->mac_addr));
182 }
183
184 return EOK;
185}
186
187static errno_t inetcfg_link_remove(sysarg_t link_id)
188{
189 return ENOTSUP;
190}
191
192static errno_t inetcfg_sroute_create(char *name, inet_naddr_t *dest,
193 inet_addr_t *router, sysarg_t *sroute_id)
194{
195 inet_sroute_t *sroute;
196
197 sroute = inet_sroute_new();
198 if (sroute == NULL) {
199 *sroute_id = 0;
200 return ENOMEM;
201 }
202
203 sroute->dest = *dest;
204 sroute->router = *router;
205 sroute->name = str_dup(name);
206 inet_sroute_add(sroute);
207
208 *sroute_id = sroute->id;
209 return EOK;
210}
211
212static errno_t inetcfg_sroute_delete(sysarg_t sroute_id)
213{
214 inet_sroute_t *sroute;
215
216 sroute = inet_sroute_get_by_id(sroute_id);
217 if (sroute == NULL)
218 return ENOENT;
219
220 inet_sroute_remove(sroute);
221 inet_sroute_delete(sroute);
222
223 return EOK;
224}
225
226static errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
227{
228 inet_sroute_t *sroute;
229
230 sroute = inet_sroute_get_by_id(sroute_id);
231 if (sroute == NULL)
232 return ENOENT;
233
234 srinfo->dest = sroute->dest;
235 srinfo->router = sroute->router;
236 srinfo->name = str_dup(sroute->name);
237
238 return EOK;
239}
240
241static errno_t inetcfg_sroute_get_id(char *name, sysarg_t *sroute_id)
242{
243 inet_sroute_t *sroute;
244
245 sroute = inet_sroute_find_by_name(name);
246 if (sroute == NULL) {
247 log_msg(LOG_DEFAULT, LVL_DEBUG, "Static route '%s' not found.", name);
248 return ENOENT;
249 }
250
251 *sroute_id = sroute->id;
252 return EOK;
253}
254
255static void inetcfg_addr_create_static_srv(ipc_call_t *icall)
256{
257 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()");
258
259 sysarg_t link_id = IPC_GET_ARG1(*icall);
260
261 ipc_call_t call;
262 size_t size;
263 if (!async_data_write_receive(&call, &size)) {
264 async_answer_0(&call, EINVAL);
265 async_answer_0(icall, EINVAL);
266 return;
267 }
268
269 if (size != sizeof(inet_naddr_t)) {
270 async_answer_0(&call, EINVAL);
271 async_answer_0(icall, EINVAL);
272 return;
273 }
274
275 inet_naddr_t naddr;
276 errno_t rc = async_data_write_finalize(&call, &naddr, size);
277 if (rc != EOK) {
278 async_answer_0(&call, rc);
279 async_answer_0(icall, rc);
280 return;
281 }
282
283 char *name;
284 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
285 0, NULL);
286 if (rc != EOK) {
287 async_answer_0(icall, rc);
288 return;
289 }
290
291 sysarg_t addr_id = 0;
292 rc = inetcfg_addr_create_static(name, &naddr, link_id, &addr_id);
293 free(name);
294 async_answer_1(icall, rc, addr_id);
295}
296
297static void inetcfg_addr_delete_srv(ipc_call_t *call)
298{
299 sysarg_t addr_id;
300 errno_t rc;
301
302 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_delete_srv()");
303
304 addr_id = IPC_GET_ARG1(*call);
305
306 rc = inetcfg_addr_delete(addr_id);
307 async_answer_0(call, rc);
308}
309
310static void inetcfg_addr_get_srv(ipc_call_t *icall)
311{
312 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()");
313
314 sysarg_t addr_id = IPC_GET_ARG1(*icall);
315
316 inet_addr_info_t ainfo;
317
318 inet_naddr_any(&ainfo.naddr);
319 ainfo.ilink = 0;
320 ainfo.name = NULL;
321
322 errno_t rc = inetcfg_addr_get(addr_id, &ainfo);
323 if (rc != EOK) {
324 async_answer_0(icall, rc);
325 return;
326 }
327
328 ipc_call_t call;
329 size_t size;
330 if (!async_data_read_receive(&call, &size)) {
331 async_answer_0(&call, EREFUSED);
332 async_answer_0(icall, EREFUSED);
333 return;
334 }
335
336 if (size != sizeof(inet_naddr_t)) {
337 async_answer_0(&call, EINVAL);
338 async_answer_0(icall, EINVAL);
339 return;
340 }
341
342 rc = async_data_read_finalize(&call, &ainfo.naddr, size);
343 if (rc != EOK) {
344 async_answer_0(&call, rc);
345 async_answer_0(icall, rc);
346 return;
347 }
348
349 if (!async_data_read_receive(&call, &size)) {
350 async_answer_0(&call, EREFUSED);
351 async_answer_0(icall, EREFUSED);
352 return;
353 }
354
355 rc = async_data_read_finalize(&call, ainfo.name,
356 min(size, str_size(ainfo.name)));
357 free(ainfo.name);
358
359 if (rc != EOK) {
360 async_answer_0(&call, rc);
361 async_answer_0(icall, rc);
362 return;
363 }
364
365 async_answer_1(icall, rc, ainfo.ilink);
366}
367
368static void inetcfg_addr_get_id_srv(ipc_call_t *call)
369{
370 char *name;
371 sysarg_t link_id;
372 sysarg_t addr_id;
373 errno_t rc;
374
375 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_id_srv()");
376
377 link_id = IPC_GET_ARG1(*call);
378
379 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
380 0, NULL);
381 if (rc != EOK) {
382 async_answer_0(call, rc);
383 return;
384 }
385
386 addr_id = 0;
387 rc = inetcfg_addr_get_id(name, link_id, &addr_id);
388 free(name);
389 async_answer_1(call, rc, addr_id);
390}
391
392static void inetcfg_get_addr_list_srv(ipc_call_t *call)
393{
394 ipc_call_t rcall;
395 size_t count;
396 size_t max_size;
397 size_t act_size;
398 size_t size;
399 sysarg_t *id_buf;
400 errno_t rc;
401
402 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
403
404 if (!async_data_read_receive(&rcall, &max_size)) {
405 async_answer_0(&rcall, EREFUSED);
406 async_answer_0(call, EREFUSED);
407 return;
408 }
409
410 rc = inetcfg_get_addr_list(&id_buf, &count);
411 if (rc != EOK) {
412 async_answer_0(&rcall, rc);
413 async_answer_0(call, rc);
414 return;
415 }
416
417 act_size = count * sizeof(sysarg_t);
418 size = min(act_size, max_size);
419
420 errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
421 free(id_buf);
422
423 async_answer_1(call, retval, act_size);
424}
425
426static void inetcfg_get_link_list_srv(ipc_call_t *call)
427{
428 ipc_call_t rcall;
429 size_t count;
430 size_t max_size;
431 size_t act_size;
432 size_t size;
433 sysarg_t *id_buf;
434 errno_t rc;
435
436 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
437
438 if (!async_data_read_receive(&rcall, &max_size)) {
439 async_answer_0(&rcall, EREFUSED);
440 async_answer_0(call, EREFUSED);
441 return;
442 }
443
444 rc = inetcfg_get_link_list(&id_buf, &count);
445 if (rc != EOK) {
446 async_answer_0(&rcall, rc);
447 async_answer_0(call, rc);
448 return;
449 }
450
451 act_size = count * sizeof(sysarg_t);
452 size = min(act_size, max_size);
453
454 errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
455 free(id_buf);
456
457 async_answer_1(call, retval, act_size);
458}
459
460static void inetcfg_get_sroute_list_srv(ipc_call_t *call)
461{
462 ipc_call_t rcall;
463 size_t count;
464 size_t max_size;
465 size_t act_size;
466 size_t size;
467 sysarg_t *id_buf;
468 errno_t rc;
469
470 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_sroute_list_srv()");
471
472 if (!async_data_read_receive(&rcall, &max_size)) {
473 async_answer_0(&rcall, EREFUSED);
474 async_answer_0(call, EREFUSED);
475 return;
476 }
477
478 rc = inetcfg_get_sroute_list(&id_buf, &count);
479 if (rc != EOK) {
480 async_answer_0(&rcall, rc);
481 async_answer_0(call, rc);
482 return;
483 }
484
485 act_size = count * sizeof(sysarg_t);
486 size = min(act_size, max_size);
487
488 errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
489 free(id_buf);
490
491 async_answer_1(call, retval, act_size);
492}
493
494static void inetcfg_link_add_srv(ipc_call_t *call)
495{
496 sysarg_t link_id;
497 errno_t rc;
498
499 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_add_srv()");
500
501 link_id = IPC_GET_ARG1(*call);
502
503 rc = inetcfg_link_add(link_id);
504 async_answer_0(call, rc);
505}
506
507static void inetcfg_link_get_srv(ipc_call_t *call)
508{
509 ipc_call_t name;
510 ipc_call_t laddr;
511 size_t name_max_size;
512 size_t laddr_max_size;
513
514 sysarg_t link_id;
515 inet_link_info_t linfo;
516 errno_t rc;
517
518 link_id = IPC_GET_ARG1(*call);
519 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_get_srv()");
520
521 linfo.name = NULL;
522
523 if (!async_data_read_receive(&name, &name_max_size)) {
524 async_answer_0(&name, EREFUSED);
525 async_answer_0(call, EREFUSED);
526 return;
527 }
528
529 if (!async_data_read_receive(&laddr, &laddr_max_size)) {
530 async_answer_0(&laddr, EREFUSED);
531 async_answer_0(&name, EREFUSED);
532 async_answer_0(call, EREFUSED);
533 return;
534 }
535
536 rc = inetcfg_link_get(link_id, &linfo);
537 if (rc != EOK) {
538 async_answer_0(&laddr, rc);
539 async_answer_0(&name, rc);
540 async_answer_0(call, rc);
541 return;
542 }
543
544 errno_t retval = async_data_read_finalize(&name, linfo.name,
545 min(name_max_size, str_size(linfo.name)));
546 if (retval != EOK) {
547 free(linfo.name);
548 async_answer_0(&laddr, retval);
549 async_answer_0(call, retval);
550 return;
551 }
552
553 retval = async_data_read_finalize(&laddr, &linfo.mac_addr,
554 min(laddr_max_size, sizeof(linfo.mac_addr)));
555
556 free(linfo.name);
557
558 async_answer_1(call, retval, linfo.def_mtu);
559}
560
561static void inetcfg_link_remove_srv(ipc_call_t *call)
562{
563 sysarg_t link_id;
564 errno_t rc;
565
566 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_remove_srv()");
567
568 link_id = IPC_GET_ARG1(*call);
569
570 rc = inetcfg_link_remove(link_id);
571 async_answer_0(call, rc);
572}
573
574static void inetcfg_sroute_create_srv(ipc_call_t *icall)
575{
576 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
577
578 ipc_call_t call;
579 size_t size;
580 if (!async_data_write_receive(&call, &size)) {
581 async_answer_0(&call, EINVAL);
582 async_answer_0(icall, EINVAL);
583 return;
584 }
585
586 if (size != sizeof(inet_naddr_t)) {
587 async_answer_0(&call, EINVAL);
588 async_answer_0(icall, EINVAL);
589 return;
590 }
591
592 inet_naddr_t dest;
593 errno_t rc = async_data_write_finalize(&call, &dest, size);
594 if (rc != EOK) {
595 async_answer_0(&call, rc);
596 async_answer_0(icall, rc);
597 return;
598 }
599
600 if (!async_data_write_receive(&call, &size)) {
601 async_answer_0(&call, EINVAL);
602 async_answer_0(icall, EINVAL);
603 return;
604 }
605
606 if (size != sizeof(inet_addr_t)) {
607 async_answer_0(&call, EINVAL);
608 async_answer_0(icall, EINVAL);
609 return;
610 }
611
612 inet_addr_t router;
613 rc = async_data_write_finalize(&call, &router, size);
614 if (rc != EOK) {
615 async_answer_0(&call, rc);
616 async_answer_0(icall, rc);
617 return;
618 }
619
620 char *name;
621 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
622 0, NULL);
623 if (rc != EOK) {
624 async_answer_0(icall, rc);
625 return;
626 }
627
628 sysarg_t sroute_id = 0;
629 rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id);
630 free(name);
631 async_answer_1(icall, rc, sroute_id);
632}
633
634static void inetcfg_sroute_delete_srv(ipc_call_t *call)
635{
636 sysarg_t sroute_id;
637 errno_t rc;
638
639 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_delete_srv()");
640
641 sroute_id = IPC_GET_ARG1(*call);
642
643 rc = inetcfg_sroute_delete(sroute_id);
644 async_answer_0(call, rc);
645}
646
647static void inetcfg_sroute_get_srv(ipc_call_t *icall)
648{
649 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");
650
651 sysarg_t sroute_id = IPC_GET_ARG1(*icall);
652
653 inet_sroute_info_t srinfo;
654
655 inet_naddr_any(&srinfo.dest);
656 inet_addr_any(&srinfo.router);
657 srinfo.name = NULL;
658
659 errno_t rc = inetcfg_sroute_get(sroute_id, &srinfo);
660 if (rc != EOK) {
661 async_answer_0(icall, rc);
662 return;
663 }
664
665 ipc_call_t call;
666 size_t size;
667 if (!async_data_read_receive(&call, &size)) {
668 async_answer_0(&call, EREFUSED);
669 async_answer_0(icall, EREFUSED);
670 return;
671 }
672
673 if (size != sizeof(inet_naddr_t)) {
674 async_answer_0(&call, EINVAL);
675 async_answer_0(icall, EINVAL);
676 return;
677 }
678
679 rc = async_data_read_finalize(&call, &srinfo.dest, size);
680 if (rc != EOK) {
681 async_answer_0(&call, rc);
682 async_answer_0(icall, rc);
683 return;
684 }
685
686 if (!async_data_read_receive(&call, &size)) {
687 async_answer_0(&call, EREFUSED);
688 async_answer_0(icall, EREFUSED);
689 return;
690 }
691
692 if (size != sizeof(inet_addr_t)) {
693 async_answer_0(&call, EINVAL);
694 async_answer_0(icall, EINVAL);
695 return;
696 }
697
698 rc = async_data_read_finalize(&call, &srinfo.router, size);
699 if (rc != EOK) {
700 async_answer_0(&call, rc);
701 async_answer_0(icall, rc);
702 return;
703 }
704
705 if (!async_data_read_receive(&call, &size)) {
706 async_answer_0(&call, EREFUSED);
707 async_answer_0(icall, EREFUSED);
708 return;
709 }
710
711 rc = async_data_read_finalize(&call, srinfo.name,
712 min(size, str_size(srinfo.name)));
713 free(srinfo.name);
714
715 async_answer_0(icall, rc);
716}
717
718static void inetcfg_sroute_get_id_srv(ipc_call_t *call)
719{
720 char *name;
721 sysarg_t sroute_id;
722 errno_t rc;
723
724 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_id_srv()");
725
726 rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
727 0, NULL);
728 if (rc != EOK) {
729 async_answer_0(call, rc);
730 return;
731 }
732
733 sroute_id = 0;
734 rc = inetcfg_sroute_get_id(name, &sroute_id);
735 free(name);
736 async_answer_1(call, rc, sroute_id);
737}
738
739void inet_cfg_conn(ipc_call_t *icall, void *arg)
740{
741 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_cfg_conn()");
742
743 /* Accept the connection */
744 async_answer_5(icall, EOK, 0, 0, 0, 0, async_get_label());
745
746 while (true) {
747 ipc_call_t call;
748 async_get_call(&call);
749 sysarg_t method = IPC_GET_IMETHOD(call);
750
751 log_msg(LOG_DEFAULT, LVL_DEBUG, "method %d", (int)method);
752 if (!method) {
753 /* The other side has hung up */
754 async_answer_0(&call, EOK);
755 return;
756 }
757
758 switch (method) {
759 case INETCFG_ADDR_CREATE_STATIC:
760 inetcfg_addr_create_static_srv(&call);
761 break;
762 case INETCFG_ADDR_DELETE:
763 inetcfg_addr_delete_srv(&call);
764 break;
765 case INETCFG_ADDR_GET:
766 inetcfg_addr_get_srv(&call);
767 break;
768 case INETCFG_ADDR_GET_ID:
769 inetcfg_addr_get_id_srv(&call);
770 break;
771 case INETCFG_GET_ADDR_LIST:
772 inetcfg_get_addr_list_srv(&call);
773 break;
774 case INETCFG_GET_LINK_LIST:
775 inetcfg_get_link_list_srv(&call);
776 break;
777 case INETCFG_GET_SROUTE_LIST:
778 inetcfg_get_sroute_list_srv(&call);
779 break;
780 case INETCFG_LINK_ADD:
781 inetcfg_link_add_srv(&call);
782 break;
783 case INETCFG_LINK_GET:
784 inetcfg_link_get_srv(&call);
785 break;
786 case INETCFG_LINK_REMOVE:
787 inetcfg_link_remove_srv(&call);
788 break;
789 case INETCFG_SROUTE_CREATE:
790 inetcfg_sroute_create_srv(&call);
791 break;
792 case INETCFG_SROUTE_DELETE:
793 inetcfg_sroute_delete_srv(&call);
794 break;
795 case INETCFG_SROUTE_GET:
796 inetcfg_sroute_get_srv(&call);
797 break;
798 case INETCFG_SROUTE_GET_ID:
799 inetcfg_sroute_get_id_srv(&call);
800 break;
801 default:
802 async_answer_0(&call, EINVAL);
803 }
804 }
805}
806
807/** @}
808 */
Note: See TracBrowser for help on using the repository browser.