source: mainline/uspace/lib/net/netif/netif_nil_bundle.c@ 692c40cb

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 692c40cb was 14f1db0, checked in by Martin Decky <martin@…>, 16 years ago

networking overhaul:

  • separation of conserns
  • removal of (almost all) overlaping symbols, libnetif is not needed anymore
  • again, it is possible to build the networking in multiple architecture configurations (however, currently only the bundling netif and nil layers is supported, more to come)
  • code style updates and fixes (still a huge amount of work to do)
  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
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 netif
30 * @{
31 */
32
33/** @file
34 * Wrapper for the bundled network interface and network interface layer module.
35 * Distributes messages and initializes both module parts.
36 */
37
38#include <async.h>
39#include <ipc/ipc.h>
40
41#include <net_messages.h>
42#include <packet/packet.h>
43#include <netif_nil_bundle.h>
44#include <netif_local.h>
45#include <nil_local.h>
46
47/** Distribute the messages between the module parts.
48 *
49 * @param[in] name Module name.
50 * @param[in] callid The message identifier.
51 * @param[in] call The message parameters.
52 * @param[out] answer The message answer parameters.
53 * @param[out] answer_count The last parameter for the actual
54 * answer in the answer parameter.
55 *
56 * @return EOK on success.
57 * @return ENOTSUP if the message is not known.
58 * @return Other error codes as defined for each specific module message function.
59 *
60 */
61int netif_nil_module_message(const char *name, ipc_callid_t callid,
62 ipc_call_t *call, ipc_call_t *answer, int *answer_count)
63{
64 if ((IS_NET_NIL_MESSAGE(call))
65 || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME))
66 return nil_message_standalone(name, callid, call, answer,
67 answer_count);
68 else
69 return netif_module_message_standalone(name, callid, call, answer,
70 answer_count);
71}
72
73/** Start the bundle network interface module.
74 *
75 * Initialize the client connection serving function, initialize
76 * both module parts, register the module service and start the
77 * async manager, processing IPC messages in an infinite loop.
78 *
79 * @param[in] client_connection The client connection processing
80 * function. The module skeleton propagates
81 * its own one.
82 *
83 * @return EOK on success.
84 * @return Other error codes as defined for each specific module message
85 * function.
86 *
87 */
88int netif_nil_module_start(async_client_conn_t client_connection)
89{
90 ERROR_DECLARE;
91
92 ERROR_PROPAGATE(netif_init_module(client_connection));
93 if (ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))) {
94 pm_destroy();
95 return ERROR_CODE;
96 }
97
98 async_manager();
99
100 pm_destroy();
101 return EOK;
102}
103
104/** @}
105 */
Note: See TracBrowser for help on using the repository browser.