Subversion Repositories HelenOS

Rev

Rev 3666 | Rev 3846 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3666 Rev 3685
Line 37... Line 37...
37
#ifndef __NET_NETIF_H__
37
#ifndef __NET_NETIF_H__
38
#define __NET_NETIF_H__
38
#define __NET_NETIF_H__
39
 
39
 
40
#include "netif_device_id_type.h"
40
#include "netif_device_id_type.h"
41
 
41
 
42
#define networking_message( ... )   \
-
 
43
    if( netif_globals.networking_phone ) ipc_call_sync_3_3( netif_globals.networking_phone, __VA_ARGS__ )
-
 
44
 
-
 
45
#define ll_message( device, message, arg2, arg3, result1, result2, result3 )    \
42
#define ll_message( device, message, arg2, arg3, result1, result2, result3 )    \
46
    if(( device )->ll_registered ) async_msg_3(( device )->ll_registered, ( message ), ( device )->device_id, arg2, arg3 )
43
    if(( device )->ll_registered >= 0 ) async_msg_3(( device )->ll_registered, ( message ), ( device )->device_id, arg2, arg3 )
47
 
44
 
48
typedef enum    netif_status{
45
typedef enum netif_state    netif_state_t;
49
    NETIF_NULL = 0,
-
 
50
    NETIF_STOPPED,
-
 
51
    NETIF_ACTIVE,
-
 
52
    NETIF_CARRIER_LOST
-
 
53
} netif_status_t;
-
 
54
 
46
 
55
typedef struct netif_device_stats   netif_device_stats_t;
47
typedef struct netif_device_stats   netif_device_stats_t;
56
typedef netif_device_stats_t *      netif_device_stats_ref;
48
typedef netif_device_stats_t *      netif_device_stats_ref;
57
typedef struct netif_device     netif_device_t;
49
typedef struct netif_device     netif_device_t;
58
typedef netif_device_t *        netif_device_ref;
50
typedef netif_device_t *        netif_device_ref;
59
typedef struct netif_globals        netif_globals_t;
51
typedef struct netif_globals        netif_globals_t;
60
 
52
 
61
DEVICE_MAP_DECLARE( netif_device_map, netif_device_t );
53
DEVICE_MAP_DECLARE( netif_device_map, netif_device_t );
62
 
54
 
-
 
55
enum    netif_state{
-
 
56
    NETIF_NULL = 0,
-
 
57
    NETIF_STOPPED,
-
 
58
    NETIF_ACTIVE,
-
 
59
    NETIF_CARRIER_LOST
-
 
60
};
-
 
61
 
63
// based on linux_kernel/include/linux/netdevice.h
62
// based on linux_kernel/include/linux/netdevice.h
64
 
63
 
65
struct  netif_device_stats{
64
struct  netif_device_stats{
66
    unsigned long   rx_packets;     /* total packets received   */
65
    unsigned long   rx_packets;     /* total packets received   */
67
    unsigned long   tx_packets;     /* total packets transmitted    */
66
    unsigned long   tx_packets;     /* total packets transmitted    */
Line 94... Line 93...
94
    unsigned long   tx_compressed;
93
    unsigned long   tx_compressed;
95
};
94
};
96
 
95
 
97
struct  netif_device{
96
struct  netif_device{
98
    netif_device_id_t   device_id;
97
    netif_device_id_t   device_id;
99
    ipc_callid_t        ll_registered;
98
    int         ll_registered;
100
    netif_device_stats_t    stats;
99
    netif_device_stats_t    stats;
101
    netif_status_t      status;
100
    netif_state_t       state;
102
    int         flags;
101
    int         flags;
103
    int         mtu;
102
    size_t          mtu;
-
 
103
    void *          specific;
104
};
104
};
105
 
105
 
106
struct  netif_globals{
106
struct  netif_globals{
107
    int         networking_phone;
107
    int         networking_phone;
108
    netif_device_map_t  netif_device_map;
108
    netif_device_map_t  netif_device_map;