SimpleLink API Reference Manual  1.11.1
 All Data Structures Files Functions Variables Typedefs Macros Groups
evnt_handler.h
Go to the documentation of this file.
1 /*****************************************************************************
2 *
3 * evnt_handler.h - CC3000 Host Driver Implementation.
4 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *****************************************************************************/
35 #ifndef __EVENT_HANDLER_H__
36 #define __EVENT_HANDLER_H__
37 #include "hci.h"
38 #include "socket.h"
39 
40 //*****************************************************************************
41 //
42 // If building with a C++ compiler, make all of the definitions in this header
43 // have a C binding.
44 //
45 //*****************************************************************************
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 //*****************************************************************************
51 //
52 // Prototypes for the APIs.
53 //
54 //*****************************************************************************
55 
56 //*****************************************************************************
57 //
68 //
69 //*****************************************************************************
70 extern unsigned char *hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen);
71 
72 //*****************************************************************************
73 //
82 //
83 //*****************************************************************************
84 extern long hci_unsol_event_handler(char *event_hdr);
85 
86 //*****************************************************************************
87 //
96 //
97 //*****************************************************************************
98 extern long hci_unsolicited_event_handler(void);
99 
100 #define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
101 
102 #define SOCKET_STATUS_ACTIVE 0
103 #define SOCKET_STATUS_INACTIVE 1
104 /* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
105  Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
106 #define SOCKET_STATUS_INIT_VAL 0xFFFF
107 #define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
108 #define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
109 
110 extern unsigned long socket_active_status;
111 
112 extern void set_socket_active_status(long Sd, long Status);
113 extern long get_socket_active_status(long Sd);
114 
115 typedef struct _bsd_accept_return_t
116 {
118  long iStatus;
120 
122 
123 
124 typedef struct _bsd_read_return_t
125 {
128  unsigned long uiFlags;
130 
131 #define BSD_RECV_FROM_FROMLEN_OFFSET (4)
132 #define BSD_RECV_FROM_FROM_OFFSET (16)
133 
134 
135 typedef struct _bsd_select_return_t
136 {
137  long iStatus;
138  unsigned long uiRdfd;
139  unsigned long uiWrfd;
140  unsigned long uiExfd;
142 
143 
145 {
146  unsigned char ucOptValue[4];
147  char iStatus;
149 
151 {
152  long retVal;
155 
156 //*****************************************************************************
157 //
158 // Mark the end of the C bindings section for C++ compilers.
159 //
160 //*****************************************************************************
161 #ifdef __cplusplus
162 }
163 #endif // __cplusplus
164 
165 #endif // __EVENT_HANDLER_H__
166