Subversion Repositories HelenOS

Rev

Rev 4351 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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 net
  30.  *  @{
  31.  */
  32.  
  33. /** @file
  34.  *  Networking subsystem compilation configuration.
  35.  */
  36.  
  37. #ifndef __NET_NET_H__
  38. #define __NET_NET_H__
  39.  
  40. #include <ipc/ipc.h>
  41.  
  42. #include "../include/device.h"
  43.  
  44. #include "../structures/char_map.h"
  45. #include "../structures/generic_char_map.h"
  46. #include "../structures/measured_strings.h"
  47. #include "../structures/module_map.h"
  48. #include "../structures/packet/packet.h"
  49.  
  50. #define LO_NAME             "lo"
  51. #define LO_FILENAME         "/srv/lo"
  52. #define DP8390_NAME         "dp8390"
  53. #define DP8390_FILENAME     "/srv/dp8390"
  54. #define ETHERNET_NAME       "ethernet"
  55. #define ETHERNET_FILENAME   "/srv/eth"
  56. #define IP_NAME             "ip"
  57. #define IP_FILENAME         "/srv/ip"
  58.  
  59. #define CONF_NAME           "NAME"
  60. #define CONF_NETIF          "NETIF"
  61. #define CONF_NIL            "NIL"
  62. #define CONF_IL             "IL"
  63. #define CONF_IRQ            "IRQ"
  64. #define CONF_IO             "IO"
  65. #define CONF_MTU            "MTU"
  66.  
  67. typedef struct netif    netif_t;
  68. typedef netif_t *       netif_ref;
  69.  
  70. typedef struct net_globals  net_globals_t;
  71.  
  72. DEVICE_MAP_DECLARE( netifs, netif_t )
  73.  
  74. GENERIC_CHAR_MAP_DECLARE( measured_strings, measured_string_t )
  75.  
  76. /** A present network interface device.
  77.  */
  78. struct netif{
  79.     /** A system-unique network interface identifier.
  80.      */
  81.     device_id_t     id;
  82.     /** A serving network interface driver module index.
  83.      */
  84.     module_ref      driver;
  85.     /** A serving link layer module index.
  86.      */
  87.     module_ref      nil;
  88.     /** A serving internet layer module index.
  89.      */
  90.     module_ref      il;
  91.     /** A system-unique network interface name.
  92.      */
  93.     char *          name;
  94.     /** Configuration.
  95.      */
  96.     measured_strings_t  configuration;
  97. };
  98.  
  99. /** A net module global variables.
  100.  */
  101. struct net_globals{
  102.     /** Present network interfaces.
  103.      */
  104.     netifs_t        netifs;
  105.     /** Network interface structure indices by names.
  106.      */
  107.     char_map_t      netif_names;
  108.     /** Available modules.
  109.      */
  110.     modules_t       modules;
  111.     /** Global configuration.
  112.      */
  113.     measured_strings_t  configuration;
  114. };
  115.  
  116. int add_configuration( measured_strings_ref configuration, const char * name, const char * value );
  117. int net_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
  118. int net_initialize( void );
  119. int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
  120. int read_netif_configuration( char * name, netif_ref netif );
  121.  
  122. #endif
  123.  
  124. /** @}
  125.  */
  126.