source: mainline/uspace/srv/net/nil/nildummy/nildummy.h@ 66e0186b

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

remove unnecessary include

  • Property mode set to 100644
File size: 3.2 KB
Line 
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 nildummy
31 * @{
32 */
33
34/** @file
35 * Dummy network interface layer module.
36 */
37
38#ifndef NET_NILDUMMY_H_
39#define NET_NILDUMMY_H_
40
41#include <async.h>
42#include <fibril_synch.h>
43#include <ipc/services.h>
44#include <ipc/devman.h>
45#include <net/device.h>
46
47/** Type definition of the dummy nil global data.
48 *
49 * @see nildummy_globals
50 *
51 */
52typedef struct nildummy_globals nildummy_globals_t;
53
54/** Type definition of the dummy nil device specific data.
55 *
56 * @see nildummy_device
57 *
58 */
59typedef struct nildummy_device nildummy_device_t;
60
61/** Type definition of the dummy nil protocol specific data.
62 *
63 * @see nildummy_proto
64 *
65 */
66typedef struct nildummy_proto nildummy_proto_t;
67
68/** Dummy nil device map.
69 *
70 * Map devices to the dummy nil device specific data.
71 * @see device.h
72 *
73 */
74DEVICE_MAP_DECLARE(nildummy_devices, nildummy_device_t);
75
76/** Dummy nil device specific data. */
77struct nildummy_device {
78 /** Device identifier. */
79 nic_device_id_t device_id;
80 /** Device driver handle. */
81 devman_handle_t handle;
82 /** Driver session. */
83 async_sess_t *sess;
84
85 /** Maximal transmission unit. */
86 size_t mtu;
87
88 /** Actual device hardware address. */
89 nic_address_t addr;
90 /** Actual device hardware address length. */
91 size_t addr_len;
92};
93
94/** Dummy nil protocol specific data. */
95struct nildummy_proto {
96 /** Protocol service. */
97 services_t service;
98
99 /** Protocol module session. */
100 async_sess_t *sess;
101};
102
103/** Dummy nil global data. */
104struct nildummy_globals {
105 /** Networking module session. */
106 async_sess_t *net_sess;
107
108 /** Lock for devices. */
109 fibril_rwlock_t devices_lock;
110
111 /** All known Ethernet devices. */
112 nildummy_devices_t devices;
113
114 /** Safety lock for protocols. */
115 fibril_rwlock_t protos_lock;
116
117 /** Default protocol. */
118 nildummy_proto_t proto;
119};
120
121#endif
122
123/** @}
124 */
Note: See TracBrowser for help on using the repository browser.