00001 /* 00002 * Copyright (c) 2009 Lukas Mejdrech 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * - The name of the author may not be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00019 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00020 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00037 #ifndef LIBC_DEVICE_ID_TYPE_H_ 00038 #define LIBC_DEVICE_ID_TYPE_H_ 00039 00040 #include <adt/int_map.h> 00041 00043 #define DEVICE_MAP_DECLARE INT_MAP_DECLARE 00044 00046 #define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT 00047 00049 #define DEVICE_INVALID_ID (-1) 00050 00052 typedef int device_id_t; 00053 00055 typedef enum device_state device_state_t; 00056 00060 typedef struct device_stats device_stats_t; 00061 00063 enum device_state { 00065 NETIF_NULL = 0, 00067 NETIF_STOPPED, 00069 NETIF_ACTIVE, 00071 NETIF_CARRIER_LOST 00072 }; 00073 00075 struct device_stats { 00077 unsigned long receive_packets; 00079 unsigned long send_packets; 00081 unsigned long receive_bytes; 00083 unsigned long send_bytes; 00085 unsigned long receive_errors; 00087 unsigned long send_errors; 00089 unsigned long receive_dropped; 00091 unsigned long send_dropped; 00093 unsigned long multicast; 00095 unsigned long collisions; 00096 00097 /* detailed receive_errors */ 00098 00100 unsigned long receive_length_errors; 00102 unsigned long receive_over_errors; 00104 unsigned long receive_crc_errors; 00106 unsigned long receive_frame_errors; 00108 unsigned long receive_fifo_errors; 00110 unsigned long receive_missed_errors; 00111 00112 /* detailed send_errors */ 00113 00115 unsigned long send_aborted_errors; 00117 unsigned long send_carrier_errors; 00119 unsigned long send_fifo_errors; 00121 unsigned long send_heartbeat_errors; 00123 unsigned long send_window_errors; 00124 00125 /* for cslip etc */ 00126 00128 unsigned long receive_compressed; 00130 unsigned long send_compressed; 00131 }; 00132 00133 #endif 00134