~vojtech-horky/helenos/numa

« back to all changes in this revision

Viewing changes to uspace/srv/net/net/net.h

  • Committer: Vojtech Horky
  • Date: 2012-08-13 19:23:12 UTC
  • mfrom: (538.1.1058 HelenOS.mainline)
  • Revision ID: vojtechhorky@users.sourceforge.net-20120813192312-1zdx1rc8l917sxy5
MergeĀ mainlineĀ changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2009 Lukas Mejdrech
3
 
 * Copyright (c) 2011 Radim Vansa
4
 
 * All rights reserved.
5
 
 *
6
 
 * Redistribution and use in source and binary forms, with or without
7
 
 * modification, are permitted provided that the following conditions
8
 
 * are met:
9
 
 *
10
 
 * - Redistributions of source code must retain the above copyright
11
 
 *   notice, this list of conditions and the following disclaimer.
12
 
 * - Redistributions in binary form must reproduce the above copyright
13
 
 *   notice, this list of conditions and the following disclaimer in the
14
 
 *   documentation and/or other materials provided with the distribution.
15
 
 * - The name of the author may not be used to endorse or promote products
16
 
 *   derived from this software without specific prior written permission.
17
 
 *
18
 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
 
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
 
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
 
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 
 */
29
 
 
30
 
/** @addtogroup net
31
 
 * @{
32
 
 */
33
 
 
34
 
#ifndef NET_NET_H_
35
 
#define NET_NET_H_
36
 
 
37
 
#include <net/device.h>
38
 
#include <adt/char_map.h>
39
 
#include <adt/generic_char_map.h>
40
 
#include <adt/measured_strings.h>
41
 
#include <adt/module_map.h>
42
 
#include <net/packet.h>
43
 
#include <devman.h>
44
 
 
45
 
#define NAME  "net"
46
 
 
47
 
#define ETHERNET_FILENAME  "/srv/eth"
48
 
#define ETHERNET_NAME      "eth"
49
 
 
50
 
#define IP_FILENAME  "/srv/ip"
51
 
#define IP_NAME      "ip"
52
 
 
53
 
#define NILDUMMY_FILENAME  "/srv/nildummy"
54
 
#define NILDUMMY_NAME      "nildummy"
55
 
 
56
 
/** @}
57
 
 */
58
 
 
59
 
/** @name Configuration setting names definitions
60
 
 * @{
61
 
 */
62
 
 
63
 
#define CONF_IL     "IL"     /**< Internet protocol module name configuration label. */
64
 
#define CONF_IO     "IO"     /**< Device input/output address configuration label. */
65
 
#define CONF_IRQ    "IRQ"    /**< Interrupt number configuration label. */
66
 
#define CONF_MTU    "MTU"    /**< Maximum transmission unit configuration label. */
67
 
#define CONF_NAME   "NAME"   /**< Network interface name configuration label. */
68
 
#define CONF_HWPATH "HWPATH" /**< Network interface hardware pathname label. */
69
 
#define CONF_NIL    "NIL"    /**< Network interface layer module name configuration label. */
70
 
 
71
 
/** @}
72
 
 */
73
 
 
74
 
#define CONF_DIR           "/cfg/net"  /**< Configuration directory. */
75
 
#define CONF_GENERAL_FILE  "general"   /**< General configuration file. */
76
 
#define CONF_EXT           ".nic"      /**< Extension for NIC's configuration files. */
77
 
 
78
 
/** Configuration settings.
79
 
 *
80
 
 * Maps setting names to the values.
81
 
 * @see generic_char_map.h
82
 
 *
83
 
 */
84
 
GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t);
85
 
 
86
 
/** Present network interface device.
87
 
 *
88
 
 */
89
 
typedef struct {
90
 
        /** System-unique network interface name. */
91
 
        uint8_t *name;
92
 
        /** System-unique network interface identifier. */
93
 
        nic_device_id_t id;
94
 
        /** Configuration. */
95
 
        measured_strings_t configuration;
96
 
        
97
 
        /** Serving network interface driver module index. */
98
 
        devman_handle_t handle;  /**< Handle for devman */
99
 
        async_sess_t *sess;      /**< Driver session. */
100
 
        
101
 
        module_t *nil;  /**< Serving link layer module index. */
102
 
        module_t *il;   /**< Serving internet layer module index. */
103
 
} netif_t;
104
 
 
105
 
/** Present network interfaces.
106
 
 *
107
 
 * Maps devices to the networking device specific data.
108
 
 * @see device.h
109
 
 *
110
 
 */
111
 
DEVICE_MAP_DECLARE(netifs, netif_t);
112
 
 
113
 
/** Networking module global data.
114
 
 *
115
 
 */
116
 
typedef struct {
117
 
        measured_strings_t configuration;  /**< Global configuration. */
118
 
        modules_t modules;                 /**< Available modules. */
119
 
        
120
 
        /** Network interface structure indices by hardware path. */
121
 
        char_map_t netif_hwpaths;
122
 
        
123
 
        /** Present network interfaces. */
124
 
        netifs_t netifs;
125
 
} net_globals_t;
126
 
 
127
 
#endif
128
 
 
129
 
/** @}
130
 
 */