Digi XBee(R) ANSI C Host Library
types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2012 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
20 #ifndef __WPAN_TYPES_H
21 #define __WPAN_TYPES_H
22 
23 #include "xbee/platform.h"
24 
26 
34 typedef union {
35  uint8_t b[8];
36  uint16_t u[4];
37  uint32_t l[2];
38 } addr64;
39 
40 
41 #ifndef ADDR64_FORMAT_SEPARATOR
42  #define ADDR64_FORMAT_SEPARATOR '-'
45 #endif
46 
49 #define ADDR64_STRING_LENGTH (8 * 2 + 7 + 1)
50 
51 // These functions are documented with their implementation in wpan_types.c
52 char FAR *addr64_format( char FAR *buffer, const addr64 FAR *address);
53 bool_t addr64_equal( const addr64 FAR *addr1, const addr64 FAR *addr2);
54 bool_t addr64_is_zero( const addr64 FAR *addr);
55 int addr64_parse( addr64 *address, const char FAR *str);
56 
60 #define WPAN_NET_ADDR_BCAST_ALL_NODES 0xFFFF
62 #define WPAN_NET_ADDR_BCAST_NOT_ASLEEP 0xFFFD
64 #define WPAN_NET_ADDR_BCAST_ROUTERS 0xFFFC
66 
68 #define WPAN_NET_ADDR_UNDEFINED 0xFFFE
69 
71 #define WPAN_NET_ADDR_COORDINATOR 0x0000
72 
77 #define WPAN_IEEE_ADDR_UNDEFINED (&_WPAN_IEEE_ADDR_UNDEFINED)
81 
83 #define WPAN_IEEE_ADDR_BROADCAST (&_WPAN_IEEE_ADDR_BROADCAST)
85 
88 #define WPAN_IEEE_ADDR_COORDINATOR (&_WPAN_IEEE_ADDR_COORDINATOR)
90 
93 #define WPAN_IEEE_ADDR_ALL_ZEROS (&_WPAN_IEEE_ADDR_COORDINATOR)
94 
98 typedef struct _wpan_address_t {
99  addr64 ieee;
100  uint16_t network;
102 
104 
105 // If compiling in Dynamic C, automatically #use the appropriate C file.
106 #ifdef __DC__
107  #use "wpan_types.c"
108 #endif
109 
110 #endif // #ifdef __WPAN_TYPES_H
111 
unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
char FAR * addr64_format(char FAR *buffer, const addr64 FAR *address)
Format a 64-bit address as a null-terminated, printable string (e.g., "00-13-A2-01-23-45-67").
Definition: wpan_types.c:77
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
bool_t addr64_is_zero(const addr64 FAR *addr)
Test a 64-bit address for zero.
Definition: wpan_types.c:146
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Common header for Hardware Abstraction Layer.
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
Single structure to hold an 802.15.4 device's 64-bit IEEE/MAC address and 16-bit network address...
Definition: types.h:98
const addr64 _WPAN_IEEE_ADDR_BROADCAST
Definition: wpan_types.c:36
int addr64_parse(addr64 *address, const char FAR *str)
Parse a text string into a 64-bit IEEE address.
Definition: wpan_types.c:186
const addr64 _WPAN_IEEE_ADDR_UNDEFINED
Definition: wpan_types.c:30
Typedef used to hold a 64-bit IEEE address, represented as 8 bytes, 4 16-bit values or 2 32-bit value...
Definition: types.h:34
bool_t addr64_equal(const addr64 FAR *addr1, const addr64 FAR *addr2)
Compare two 64-bit addresses for equality.
Definition: wpan_types.c:125
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
const addr64 _WPAN_IEEE_ADDR_COORDINATOR
Definition: wpan_types.c:42
int bool_t
Variable that can hold 0 or 1, may be an int for speed purporses or uint8_t for size optimization...
Definition: platform_config.h:51