1
/******************************************************************************
2
* Copyright (c) 2004, 2008 IBM Corporation
4
* This program and the accompanying materials
5
* are made available under the terms of the BSD License
6
* which accompanies this distribution, and is available at
7
* http://www.opensource.org/licenses/bsd-license.php
10
* IBM Corporation - initial implementation
11
*****************************************************************************/
18
#define ETH_MTU_SIZE 1518 /**< Maximum Transfer Unit */
19
#define ETH_ALEN 6 /**< HW address length */
20
#define ETHERTYPE_IP 0x0800
21
#define ETHERTYPE_IPv6 0x86DD
22
#define ETHERTYPE_ARP 0x0806
25
* A header for Ethernet-packets.
28
uint8_t dest_mac[ETH_ALEN]; /**< Destination HW address */
29
uint8_t src_mac[ETH_ALEN]; /**< Source HW address */
30
uint16_t type; /**< Next level protocol type */
33
/* Initializes ethernet layer */
34
extern void set_mac_address(const uint8_t * own_mac);
35
extern const uint8_t * get_mac_address(void);
37
/* Receives and handles packets, according to Receive-handle diagram */
38
extern int32_t receive_ether(void);
40
/* Sends an ethernet frame. */
41
extern int send_ether(void* buffer, int len);
43
/* fills ethernet header */
44
extern void fill_ethhdr(uint8_t * packet, uint16_t eth_type,
45
const uint8_t * src_mac, const uint8_t * dest_mac);