Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/net/device.h

    r9cd8165 rf772bc55  
    3232
    3333/** @file
    34  * Network device.
     34 * Device identifier, state and usage statistics.
    3535 */
    3636
    37 #ifndef LIBC_NET_DEVICE_H_
    38 #define LIBC_NET_DEVICE_H_
     37#ifndef LIBC_DEVICE_ID_TYPE_H_
     38#define LIBC_DEVICE_ID_TYPE_H_
    3939
    4040#include <adt/int_map.h>
    41 #include <nic/nic.h>
    4241
    4342/** Device identifier to generic type map declaration. */
    44 #define DEVICE_MAP_DECLARE  INT_MAP_DECLARE
     43#define DEVICE_MAP_DECLARE      INT_MAP_DECLARE
    4544
    4645/** Device identifier to generic type map implementation. */
    47 #define DEVICE_MAP_IMPLEMENT  INT_MAP_IMPLEMENT
     46#define DEVICE_MAP_IMPLEMENT    INT_MAP_IMPLEMENT
     47
     48/** Invalid device identifier. */
     49#define DEVICE_INVALID_ID       (-1)
    4850
    4951/** Device identifier type. */
    50 typedef int nic_device_id_t;
     52typedef int device_id_t;
    5153
    52 /** Invalid device identifier. */
    53 #define NIC_DEVICE_INVALID_ID  (-1)
     54/** Device state type. */
     55typedef enum device_state device_state_t;
     56
     57/** Type definition of the device usage statistics.
     58 * @see device_stats
     59 */
     60typedef struct device_stats device_stats_t;
     61
     62/** Device state. */
     63enum device_state {
     64        /** Device not present or not initialized. */
     65        NETIF_NULL = 0,
     66        /** Device present and stopped. */
     67        NETIF_STOPPED,
     68        /** Device present and active. */
     69        NETIF_ACTIVE,
     70        /** Device present but unable to transmit. */
     71        NETIF_CARRIER_LOST
     72};
     73
     74/** Device usage statistics. */
     75struct device_stats {
     76        /** Total packets received. */
     77        unsigned long receive_packets;
     78        /** Total packets transmitted. */
     79        unsigned long send_packets;
     80        /** Total bytes received. */
     81        unsigned long receive_bytes;
     82        /** Total bytes transmitted. */
     83        unsigned long send_bytes;
     84        /** Bad packets received counter. */
     85        unsigned long receive_errors;
     86        /** Packet transmition problems counter. */
     87        unsigned long send_errors;
     88        /** No space in buffers counter. */
     89        unsigned long receive_dropped;
     90        /** No space available counter. */
     91        unsigned long send_dropped;
     92        /** Total multicast packets received. */
     93        unsigned long multicast;
     94        /** The number of collisions due to congestion on the medium. */
     95        unsigned long collisions;
     96
     97        /* detailed receive_errors */
     98
     99        /** Received packet length error counter. */
     100        unsigned long receive_length_errors;
     101        /** Receiver buffer overflow counter. */
     102        unsigned long receive_over_errors;
     103        /** Received packet with crc error counter. */
     104        unsigned long receive_crc_errors;
     105        /** Received frame alignment error counter. */
     106        unsigned long receive_frame_errors;
     107        /** Receiver fifo overrun counter. */
     108        unsigned long receive_fifo_errors;
     109        /** Receiver missed packet counter. */
     110        unsigned long receive_missed_errors;
     111
     112        /* detailed send_errors */
     113
     114        /** Transmitter aborted counter. */
     115        unsigned long send_aborted_errors;
     116        /** Transmitter carrier errors counter. */
     117        unsigned long send_carrier_errors;
     118        /** Transmitter fifo overrun counter. */
     119        unsigned long send_fifo_errors;
     120        /** Transmitter carrier errors counter. */
     121        unsigned long send_heartbeat_errors;
     122        /** Transmitter window errors counter. */
     123        unsigned long send_window_errors;
     124
     125        /* for cslip etc */
     126       
     127        /** Total compressed packets received. */
     128        unsigned long receive_compressed;
     129        /** Total compressed packet transmitted. */
     130        unsigned long send_compressed;
     131};
    54132
    55133#endif
Note: See TracChangeset for help on using the changeset viewer.