Ignore:
File:
1 edited

Legend:

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

    rf772bc55 r9cd8165  
    3232
    3333/** @file
    34  * Device identifier, state and usage statistics.
     34 * Network device.
    3535 */
    3636
    37 #ifndef LIBC_DEVICE_ID_TYPE_H_
    38 #define LIBC_DEVICE_ID_TYPE_H_
     37#ifndef LIBC_NET_DEVICE_H_
     38#define LIBC_NET_DEVICE_H_
    3939
    4040#include <adt/int_map.h>
     41#include <nic/nic.h>
    4142
    4243/** Device identifier to generic type map declaration. */
    43 #define DEVICE_MAP_DECLARE      INT_MAP_DECLARE
     44#define DEVICE_MAP_DECLARE  INT_MAP_DECLARE
    4445
    4546/** Device identifier to generic type map implementation. */
    46 #define DEVICE_MAP_IMPLEMENT    INT_MAP_IMPLEMENT
     47#define DEVICE_MAP_IMPLEMENT  INT_MAP_IMPLEMENT
     48
     49/** Device identifier type. */
     50typedef int nic_device_id_t;
    4751
    4852/** Invalid device identifier. */
    49 #define DEVICE_INVALID_ID       (-1)
    50 
    51 /** Device identifier type. */
    52 typedef int device_id_t;
    53 
    54 /** Device state type. */
    55 typedef enum device_state device_state_t;
    56 
    57 /** Type definition of the device usage statistics.
    58  * @see device_stats
    59  */
    60 typedef struct device_stats device_stats_t;
    61 
    62 /** Device state. */
    63 enum 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. */
    75 struct 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 };
     53#define NIC_DEVICE_INVALID_ID  (-1)
    13254
    13355#endif
Note: See TracChangeset for help on using the changeset viewer.