2 * Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
14 typedef struct net_buffer net_buffer
;
17 struct net_hardware_address
{
22 typedef struct net_device
{
23 struct net_device_module_info
* module
;
25 char name
[IF_NAMESIZE
];
27 uint32 flags
; // IFF_LOOPBACK, ...
28 uint32 type
; // IFT_ETHER, ...
35 struct net_hardware_address address
;
37 struct ifreq_stats stats
;
41 struct net_device_module_info
{
42 struct module_info info
;
44 status_t (*init_device
)(const char* name
, net_device
** _device
);
45 status_t (*uninit_device
)(net_device
* device
);
47 status_t (*up
)(net_device
* device
);
48 void (*down
)(net_device
* device
);
50 status_t (*control
)(net_device
* device
, int32 op
, void* argument
,
53 status_t (*send_data
)(net_device
* device
, net_buffer
* buffer
);
54 status_t (*receive_data
)(net_device
* device
, net_buffer
** _buffer
);
56 status_t (*set_mtu
)(net_device
* device
, size_t mtu
);
57 status_t (*set_promiscuous
)(net_device
* device
, bool promiscuous
);
58 status_t (*set_media
)(net_device
* device
, uint32 media
);
60 status_t (*add_multicast
)(net_device
* device
,
61 const struct sockaddr
* address
);
62 status_t (*remove_multicast
)(net_device
* device
,
63 const struct sockaddr
* address
);
67 #endif // NET_DEVICE_H