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

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

networking: streamline NIL skeleton and NIL modules (nildummy, eth)

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