source: mainline/uspace/srv/net/tl/icmp/icmp_module.c@ 45019865

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 45019865 was 774e6d1a, checked in by martin@…>, 14 years ago

partial networking stack overhaul

  • a lot of coding style changes (comments, indentation, etc.)
  • convert several ints to unsigned ints or size_t values
  • streamline many of the IPC-related macros (they no longer dereference the call structure by themselves)
  • get rid of netif_interface.h (containing only aliases for remote functions and not serving any purpose)
  • rename netif_local.{c|h} to netif_skel.{c|h} (it is really just a skeleton)
  • drop the "_remote" and "_standalone" suffixes from most of the netif_ functions (they do not serve any purpose anymore)
  • implement netif_client_connection() as a common framework function for all netif modules
    • update the lo module accordingly
  • ip module now reports the default gateway to the user whenever it is being set
  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[21580dd]1/*
2 * Copyright (c) 2008 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 icmp
[edc5a985]30 * @{
[21580dd]31 */
32
33/** @file
[edc5a985]34 * ICMP standalone module implementation.
35 * Contains skeleton module functions mapping.
36 * The functions are used by the module skeleton as module specific entry points.
37 * @see module.c
[21580dd]38 */
39
[edc5a985]40#include "icmp.h"
41#include "icmp_module.h"
42
[21580dd]43#include <async.h>
44#include <stdio.h>
[d8f95529]45#include <errno.h>
[21580dd]46#include <ipc/ipc.h>
47#include <ipc/services.h>
48
[c7a8442]49#include <net/modules.h>
[c69d327]50#include <net/packet.h>
[849ed54]51#include <net_interface.h>
[edc5a985]52
[14f1db0]53#include <tl_local.h>
[21580dd]54
[edc5a985]55/** ICMP module global data. */
56extern icmp_globals_t icmp_globals;
[21580dd]57
[edc5a985]58int tl_module_start_standalone(async_client_conn_t client_connection)
59{
[96b02eb9]60 sysarg_t phonehash;
[d8f95529]61 int rc;
[21580dd]62
[aadf01e]63 async_set_client_connection(client_connection);
[614d065]64 icmp_globals.net_phone = net_connect_module();
[edc5a985]65 if (icmp_globals.net_phone < 0)
[21580dd]66 return icmp_globals.net_phone;
[edc5a985]67
[d8f95529]68 rc = pm_init();
69 if (rc != EOK)
70 return rc;
71
72 rc = icmp_initialize(client_connection);
73 if (rc != EOK)
74 goto out;
75
[f87c900]76 rc = ipc_connect_to_me(PHONE_NS, SERVICE_ICMP, 0, 0, &phonehash);
[d8f95529]77 if (rc != EOK)
78 goto out;
[21580dd]79
80 async_manager();
81
[d8f95529]82out:
[21580dd]83 pm_destroy();
[d8f95529]84 return rc;
[21580dd]85}
86
[fb04cba8]87int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
[774e6d1a]88 ipc_call_t *answer, size_t *count)
[edc5a985]89{
[774e6d1a]90 return icmp_message_standalone(callid, call, answer, count);
[21580dd]91}
92
93/** @}
94 */
Note: See TracBrowser for help on using the repository browser.