1 /* 2 * Copyright 2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _ETHER_DRIVER_H 6 #define _ETHER_DRIVER_H 7 8 /*! Standard ethernet driver interface */ 9 10 11 #include <Drivers.h> 12 13 14 /* ioctl() opcodes a driver should support */ 15 enum { 16 ETHER_GETADDR = B_DEVICE_OP_CODES_END, 17 /* get ethernet address (required) */ 18 ETHER_INIT, /* (obsolete) */ 19 ETHER_NONBLOCK, /* change non blocking mode (int *) */ 20 ETHER_ADDMULTI, /* add multicast address */ 21 ETHER_REMMULTI, /* remove multicast address */ 22 ETHER_SETPROMISC, /* set promiscuous mode (int *) */ 23 ETHER_GETFRAMESIZE, /* get frame size (required) (int *) */ 24 ETHER_SET_LINK_STATE_SEM, 25 /* pass over a semaphore to release on link state changes (sem_id *) */ 26 ETHER_GET_LINK_STATE, 27 /* get line speed, quality, duplex mode, etc. (ether_link_state_t *) */ 28 29 ETHER_SEND_NET_BUFFER, /* send a net_buffer */ 30 ETHER_RECEIVE_NET_BUFFER, /* receive a net_buffer */ 31 }; 32 33 34 /* ETHER_GETADDR - MAC address */ 35 typedef struct ether_address { 36 uint8 ebyte[6]; 37 } ether_address_t; 38 39 /* ETHER_GETLINKSTATE */ 40 typedef struct ether_link_state { 41 uint32 media; /* as specified in net/if_media.h */ 42 uint32 quality; /* in one tenth of a percent */ 43 uint64 speed; /* in bit/s */ 44 } ether_link_state_t; 45 46 #endif /* _ETHER_DRIVER_H */ 47