IBR-DTNSuite  0.8
ibrcommon/ibrcommon/net/ieee802154.h
Go to the documentation of this file.
00001 /*
00002  * IEEE802.15.4-2003 implementation user-space header.
00003  *
00004  * Copyright (C) 2008, 2009 Siemens AG
00005  *
00006  * Written-by: Dmitry Eremin-Solenikov
00007  * Written-by: Sergey Lapin
00008  * 
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU Lesser General Public
00011  *  License as published by the Free Software Foundation; either
00012  *  version 2.1 of the License, or (at your option) any later version.
00013  *
00014  *  This library is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *  Lesser General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU Lesser General Public
00020  *  License along with this library; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022  */
00023 
00024 #ifndef __IEEE802154_H
00025 #define __IEEE802154_H
00026 
00027 #ifdef HAVE_NET_IEEE802154_H
00028 #include <net/ieee802154.h>
00029 #endif
00030 #ifdef HAVE_NET_AF_IEEE802154_H
00031 #include <net/af_ieee802154.h>
00032 #endif
00033 
00034 #ifndef IEEE802154_ADDR_LEN
00035 #define IEEE802154_ADDR_LEN 8
00036 #endif
00037 
00038 #include <sys/socket.h>
00039 #include <stdint.h>
00040 #ifndef HAVE_STRUCT_SOCKADDR_IEEE802154
00041 
00042 enum {
00043         IEEE802154_ADDR_NONE = 0x0,
00044         // RESERVER = 0x01,
00045         IEEE802154_ADDR_SHORT = 0x2, /* 16-bit address + PANid */
00046         IEEE802154_ADDR_LONG = 0x3, /* 64-bit address + PANid */
00047 };
00048 
00049 struct ieee802154_addr {
00050         int addr_type;
00051         uint16_t pan_id;
00052         union {
00053                 uint8_t hwaddr[IEEE802154_ADDR_LEN];
00054                 uint16_t short_addr;
00055         };
00056 };
00057 
00058 struct sockaddr_ieee802154 {
00059         sa_family_t family; /* AF_IEEE802154 */
00060         struct ieee802154_addr addr;
00061 };
00062 #endif
00063 
00064 #ifndef N_IEEE802154
00065 #define N_IEEE802154 19
00066 #endif
00067 
00068 #ifndef PF_IEEE802154
00069 #define PF_IEEE802154 36
00070 #define AF_IEEE802154 PF_IEEE802154
00071 #endif
00072 
00073 #include <net/if_arp.h>
00074 #ifndef ARPHRD_IEEE802154
00075 #define ARPHRD_IEEE802154         804
00076 #define ARPHRD_IEEE802154_PHY     805
00077 #endif
00078 
00079 #ifndef IEEE802154_MAC_SCAN_ED
00080 #define IEEE802154_MAC_SCAN_ED          0x0
00081 #define IEEE802154_MAC_SCAN_ACTIVE      0x1
00082 #define IEEE802154_MAC_SCAN_PASSIVE     0x2
00083 #define IEEE802154_MAC_SCAN_ORPHAN      0x3
00084 #endif
00085 
00086 #include <linux/if_ether.h>
00087 #ifndef ETH_P_IEEE802154
00088 #define ETH_P_IEEE802154 0x00F6         /* IEEE802.15.4 frame           */
00089 #endif
00090 
00091 /* get/setsockopt */
00092 #ifndef SOL_IEEE802154
00093 #define SOL_IEEE802154  0
00094 #endif
00095 
00096 #ifndef WPAN_WANTACK
00097 #define WPAN_WANTACK    0
00098 #endif
00099 
00100 
00101 #endif