Digi XBee(R) ANSI C Host Library
sxa_socket.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-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 __DC__
21  #error "This header is only supported on the Rabbit platform with Dynamic C."
22 #endif
23 
24 #ifndef __XBEE_SXA_SOCKET
25 #define __XBEE_SXA_SOCKET
26 
27 #include "xbee/sxa.h"
28 
30 
31 #ifndef SXA_SOCKET_MTU
32 
55  #define SXA_SOCKET_MTU 104
56 #endif
57 
61 #define SXA_INDEX_TO_IP(index) IPADDR(127,1,0,index)
62 
66 #define SXA_STREAM_PORT UINT16_C(61616)
67 #define SXA_MAX_STREAM_PORT UINT16_C(61616+255)
68 
70 #define WPAN_ENDPOINT_DIGI_STREAM 0x66
71 
72 // Since this is Rabbit-specific, all the following fields are sent
73 // little-endian over the air. This struct forms the condensed
74 // TCP/IP header, which forms the first 6 octets of the WPAN envelope
75 // payload.
76 typedef struct _sxa_sock_hdr_t
77 {
81 #define _SXA_SOCK_SYN 0x8000
82 #define _SXA_SOCK_FIN 0x4000
83 #define _SXA_SOCK_ACK 0x2000
84 #define _SXA_SOCK_RST 0x1000
85 #define _SXA_SOCK_FLAG_MASK 0xF000
86 #define _SXA_SOCK_WIN_MASK 0x0FFF
87 #define _SXA_SOCK_WIN_RANGE 0x0800
88 #define _SXA_SOCK_WIN_COUNT 0x07FF
89 #define _SXA_WIN_LOW_RANGE_SHIFT 1
90 #define _SXA_WIN_HIGH_RANGE_SHIFT 4
92 
93 // Definitions in TCP libraries
94 struct ll_Gather;
95 struct LoopbackHandler;
96 
97 int _sxa_socket_tx_handler(struct LoopbackHandler __far * lh, ll_Gather * g);
98 int _sxa_socket_rx_handler( const wpan_envelope_t FAR *envelope,
99  wpan_ep_state_t FAR *ep_state);
100 int sxa_socket_init(void);
101 
103 #define SXA_SOCKET_ENDPOINT { \
104  WPAN_ENDPOINT_DIGI_STREAM, \
105  WPAN_PROFILE_DIGI, \
106  _sxa_socket_rx_handler, \
107  NULL, \
108  0x0000, \
109  0x00, \
110  NULL }
111 
113 
114 #use "xbee_sxa_socket.c"
115 
116 
117 #endif // __XBEE_SXA_SOCKET
118 
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Volatile part of an endpoint record used to track conversations (requests waiting for responses)...
Definition: aps.h:529
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
Definition: sxa_socket.h:76
uint16_t seqnum
shortened sequence number
Definition: sxa_socket.h:78
uint16_t acknum
shortened acknowledgment number
Definition: sxa_socket.h:79
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
uint16_t flags
flags plus encoded window
Definition: sxa_socket.h:80
The "envelope" is used to gather all necessary information about a given frame on the network...
Definition: aps.h:40