00001 /* 00002 * White Rabbit RTU (Routing Table Unit) 00003 * Copyright (C) 2010, CERN. 00004 * 00005 * Version: wrsw_rtud v1.0 00006 * 00007 * Authors: Juan Luis Manas (juan.manas@integrasys.es) 00008 * 00009 * Description: MAC address type related operations. 00010 * 00011 * Fixes: 00012 * Alessandro Rubini 00013 * 00014 * 00015 * This program is free software; you can redistribute it and/or 00016 * modify it under the terms of the GNU General Public License 00017 * as published by the Free Software Foundation; either version 00018 * 2 of the License, or (at your option) any later version. 00019 * 00020 * This program is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00027 */ 00028 00029 00030 #ifndef __WHITERABBIT_RTU_MAC_H 00031 #define __WHITERABBIT_RTU_MAC_H 00032 00033 #include <stdint.h> 00034 #include <string.h> 00035 #include <linux/if_ether.h> 00036 00041 static inline int mac_equal(uint8_t a[ETH_ALEN], uint8_t b[ETH_ALEN]) 00042 { 00043 return !memcmp(a, b, ETH_ALEN); 00044 } 00045 00050 static inline uint8_t* mac_copy(uint8_t dst[ETH_ALEN], uint8_t src[ETH_ALEN]) 00051 { 00052 return memcpy(dst, src, ETH_ALEN); 00053 } 00054 00059 static inline uint8_t* mac_clean(uint8_t mac[ETH_ALEN]) 00060 { 00061 return memset(mac, 0x00, ETH_ALEN); 00062 } 00063 00064 char *mac_to_string(uint8_t mac[ETH_ALEN]); 00065 00066 #endif /* __WHITERABBIT_RTU_MAC_H */ 00067