source: mainline/uspace/srv/net/include/device.h@ 2d68c72

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2d68c72 was 21580dd, checked in by Lukas Mejdrech <lukas@…>, 16 years ago

Merged with network branch svn://svn.helenos.org/HelenOS/branches/network revision 4759; ipc_share_* and ipc_data_* changed to async_*; client connection in module.c returns on IPC_M_PHONE_HUNGUP; * Qemu scripts renamed to net-qe.*; (the dp8390 does not respond)

  • Property mode set to 100644
File size: 4.4 KB
Line 
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 netif
30 * @{
31 */
32
33/** @file
34 * Device identifier, state and usage statistics.
35 */
36
37#ifndef __NET_DEVICE_ID_TYPE_H__
38#define __NET_DEVICE_ID_TYPE_H__
39
40#include "../structures/int_map.h"
41
42/** Device identifier to generic type map declaration.
43 */
44#define DEVICE_MAP_DECLARE INT_MAP_DECLARE
45
46/** Device identifier to generic type map implementation.
47 */
48#define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT
49
50/** Device identifier type.
51 */
52typedef int device_id_t;
53
54/** Device state type.
55 */
56typedef enum device_state device_state_t;
57
58/** Type definition of the device usage statistics.
59 * @see device_stats
60 */
61typedef struct device_stats device_stats_t;
62
63/** Type definition of the device usage statistics pointer.
64 * @see device_stats
65 */
66typedef device_stats_t * device_stats_ref;
67
68/** Device state.
69 */
70enum device_state{
71 /** Device not present or not initialized.
72 */
73 NETIF_NULL = 0,
74 /** Device present and stopped.
75 */
76 NETIF_STOPPED,
77 /** Device present and active.
78 */
79 NETIF_ACTIVE,
80 /** Device present but unable to transmit.
81 */
82 NETIF_CARRIER_LOST
83};
84
85/** Device usage statistics.
86 */
87struct device_stats{
88 /** Total packets received.
89 */
90 unsigned long receive_packets;
91 /** Total packets transmitted.
92 */
93 unsigned long send_packets;
94 /** Total bytes received.
95 */
96 unsigned long receive_bytes;
97 /** Total bytes transmitted.
98 */
99 unsigned long send_bytes;
100 /** Bad packets received counter.
101 */
102 unsigned long receive_errors;
103 /** Packet transmition problems counter.
104 */
105 unsigned long send_errors;
106 /** No space in buffers counter.
107 */
108 unsigned long receive_dropped;
109 /** No space available counter.
110 */
111 unsigned long send_dropped;
112 /** Total multicast packets received.
113 */
114 unsigned long multicast;
115 /** The number of collisions due to congestion on the medium.
116 */
117 unsigned long collisions;
118
119 /* detailed receive_errors: */
120 /** Received packet length error counter.
121 */
122 unsigned long receive_length_errors;
123 /** Receiver buffer overflow counter.
124 */
125 unsigned long receive_over_errors;
126 /** Received packet with crc error counter.
127 */
128 unsigned long receive_crc_errors;
129 /** Received frame alignment error counter.
130 */
131 unsigned long receive_frame_errors;
132 /** Receiver fifo overrun counter.
133 */
134 unsigned long receive_fifo_errors;
135 /** Receiver missed packet counter.
136 */
137 unsigned long receive_missed_errors;
138
139 /* detailed send_errors */
140 /** Transmitter aborted counter.
141 */
142 unsigned long send_aborted_errors;
143 /** Transmitter carrier errors counter.
144 */
145 unsigned long send_carrier_errors;
146 /** Transmitter fifo overrun counter.
147 */
148 unsigned long send_fifo_errors;
149 /** Transmitter carrier errors counter.
150 */
151 unsigned long send_heartbeat_errors;
152 /** Transmitter window errors counter.
153 */
154 unsigned long send_window_errors;
155
156 /* for cslip etc */
157 /** Total compressed packets received.
158 */
159 unsigned long receive_compressed;
160 /** Total compressed packet transmitted.
161 */
162 unsigned long send_compressed;
163};
164
165#endif
166
167/** @}
168 */
169
Note: See TracBrowser for help on using the repository browser.