1 //------------------------------------------------------------------------------
2 // <copyright file="athbtfilter.h" company="Atheros">
3 // Copyright (c) 2007-2010 Atheros Corporation. All rights reserved.
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // Public Bluetooth filter APIs
22 // Author(s): ="Atheros"
23 //==============================================================================
24 #ifndef ATHBTFILTER_H_
25 #define ATHBTFILTER_H_
27 #define ATH_DEBUG_INFO (1 << 2)
28 #define ATH_DEBUG_INF ATH_DEBUG_INFO
30 typedef enum _ATHBT_HCI_CTRL_TYPE {
31 ATHBT_HCI_COMMAND = 0,
33 } ATHBT_HCI_CTRL_TYPE;
35 typedef enum _ATHBT_STATE_INDICATION {
43 /* new states go here.. */
45 ATH_BT_MAX_STATE_INDICATION
46 } ATHBT_STATE_INDICATION;
48 /* filter function for OUTGOING commands and INCOMMING events */
49 typedef void (*ATHBT_FILTER_CMD_EVENTS_FN)(void *pContext, ATHBT_HCI_CTRL_TYPE Type, unsigned char *pBuffer, int Length);
51 /* filter function for OUTGOING data HCI packets */
52 typedef void (*ATHBT_FILTER_DATA_FN)(void *pContext, unsigned char *pBuffer, int Length);
54 typedef enum _ATHBT_STATE {
60 /* BT state indication (when filter functions are not used) */
62 typedef void (*ATHBT_INDICATE_STATE_FN)(void *pContext, ATHBT_STATE_INDICATION Indication, ATHBT_STATE State, unsigned char LMPVersion);
64 struct athbt_filter_instance {
66 WCHAR *pWlanAdapterName; /* filled in by user */
68 char *pWlanAdapterName; /* filled in by user */
70 int FilterEnabled; /* filtering is enabled */
71 int Attached; /* filter library is attached */
72 void *pContext; /* private context for filter library */
73 ATHBT_FILTER_CMD_EVENTS_FN pFilterCmdEvents; /* function ptr to filter a command or event */
74 ATHBT_FILTER_DATA_FN pFilterAclDataOut; /* function ptr to filter ACL data out (to radio) */
75 ATHBT_FILTER_DATA_FN pFilterAclDataIn; /* function ptr to filter ACL data in (from radio) */
76 ATHBT_INDICATE_STATE_FN pIndicateState; /* function ptr to indicate a state */
77 }; /* XXX: unused ? */
82 #define AthBtFilterHciCommand(instance,packet,length) \
83 if ((instance)->FilterEnabled) { \
84 (instance)->pFilterCmdEvents((instance)->pContext, \
86 (unsigned char *)(packet), \
90 #define AthBtFilterHciEvent(instance,packet,length) \
91 if ((instance)->FilterEnabled) { \
92 (instance)->pFilterCmdEvents((instance)->pContext, \
94 (unsigned char *)(packet), \
98 #define AthBtFilterHciAclDataOut(instance,packet,length) \
99 if ((instance)->FilterEnabled) { \
100 (instance)->pFilterAclDataOut((instance)->pContext, \
101 (unsigned char *)(packet), \
105 #define AthBtFilterHciAclDataIn(instance,packet,length) \
106 if ((instance)->FilterEnabled) { \
107 (instance)->pFilterAclDataIn((instance)->pContext, \
108 (unsigned char *)(packet), \
112 /* if filtering is not desired, the application can indicate the state directly using this
115 #define AthBtIndicateState(instance,indication,state) \
116 if ((instance)->FilterEnabled) { \
117 (instance)->pIndicateState((instance)->pContext, \
128 int AthBtFilter_Attach(ATH_BT_FILTER_INSTANCE *pInstance, unsigned int flags);
129 void AthBtFilter_Detach(ATH_BT_FILTER_INSTANCE *pInstance);
135 #endif /*ATHBTFILTER_H_*/