* Rewrote ether_driver.h, removed some BONE stuff we don't support at this point;

it might also be a good idea to change the constants to better match the usual
  style.
* Added a BSD-style if_media.h.
* Added interface flags IFF_LINK, IFF_AUTO_CONFIGURED, and IFF_CONFIGURING. The
  former will be set automatically by the stack, the rest will be set by the
  net_server depending on the current state.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20535 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-04-03 14:42:07 +00:00
parent 3537f0967f
commit 1a3ab92b81
3 changed files with 92 additions and 64 deletions
+23 -53
View File
@@ -1,71 +1,41 @@
/*
* ether_driver.h
*
* Ethernet driver: handles NE2000 and 3C503 cards
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
/*
Copyright 1999, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License.
*/
#ifndef _ETHER_DRIVER_H
#define _ETHER_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/*! Standard ethernet driver interface */
#include <Drivers.h>
/*
* ioctls: belongs in a public header file
* somewhere, so that the net_server and other ethernet drivers can use.
*/
/* ioctl() opcodes a driver should support */
enum {
ETHER_GETADDR = B_DEVICE_OP_CODES_END, /* get ethernet address */
ETHER_INIT, /* set irq and port */
ETHER_NONBLOCK, /* set/unset nonblocking mode */
ETHER_ADDMULTI, /* add multicast addr */
ETHER_REMMULTI, /* rem multicast addr */
ETHER_SETPROMISC, /* set promiscuous */
ETHER_GETFRAMESIZE, /* get frame size */
ETHER_ADDTIMESTAMP, /* (try to) add timestamps to packets (BONE ext) */
ETHER_HASIOVECS, /* does the driver implement writev ? (BONE ext) (bool *) */
ETHER_GETIFTYPE, /* get the IFT_ type of the interface (int *) */
ETHER_GETLINKSTATE /* get line speed, quality, duplex mode, etc. */
ETHER_GETADDR = B_DEVICE_OP_CODES_END,
/* get ethernet address (required) */
ETHER_INIT, /* (obsolete) */
ETHER_NONBLOCK, /* change non blocking mode (int *) */
ETHER_ADDMULTI, /* add multicast address */
ETHER_REMMULTI, /* remove multicast address */
ETHER_SETPROMISC, /* set promiscuous mode (int *) */
ETHER_GETFRAMESIZE, /* get frame size (required) (int *) */
ETHER_GETLINKSTATE
/* get line speed, quality, duplex mode, etc. (ether_link_state_t *) */
};
/*
* 48-bit ethernet address, passed back from ETHER_GETADDR
*/
/* ETHER_GETADDR - MAC address */
typedef struct {
unsigned char ebyte[6];
uint8 ebyte[6];
} ether_address_t;
/*
* info passed to ETHER_INIT
*/
typedef struct ether_init_params {
short port;
short irq;
unsigned long mem;
} ether_init_params_t;
/*
* info returned from ETHER_GETLINKSTATE
*/
/* ETHER_GETLINKSTATE */
typedef struct ether_link_state {
float link_speed; /* In Mbits per second */
float link_quality; /* Set to zero if not connected */
char duplex_mode; /* Set to 1 for full duplex, 0 for half */
uint32 link_media; /* as specified in net/if_media.h */
uint32 link_quality; /* in one tenth of a percent */
uint64 link_speed; /* in Kbit/s */
} ether_link_state_t;
#ifdef __cplusplus
}
#endif
#endif /* _ETHER_DRIVER_H */
#endif /* _ETHER_DRIVER_H */