Update revision to use TI's mqtt and Freertos.
Dependencies: mbed client server
Fork of cc3100_Test_mqtt_CM3 by
simplelink_V2/cc3100_wlan_rx_filters.h@3:a8c249046181, 2015-09-03 (annotated)
- Committer:
- dflet
- Date:
- Thu Sep 03 14:02:37 2015 +0000
- Revision:
- 3:a8c249046181
SPI Mode change 1 to 0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dflet | 3:a8c249046181 | 1 | /* |
dflet | 3:a8c249046181 | 2 | * wlan_rx_filters.h - CC31xx/CC32xx Host Driver Implementation |
dflet | 3:a8c249046181 | 3 | * |
dflet | 3:a8c249046181 | 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ |
dflet | 3:a8c249046181 | 5 | * |
dflet | 3:a8c249046181 | 6 | * |
dflet | 3:a8c249046181 | 7 | * Redistribution and use in source and binary forms, with or without |
dflet | 3:a8c249046181 | 8 | * modification, are permitted provided that the following conditions |
dflet | 3:a8c249046181 | 9 | * are met: |
dflet | 3:a8c249046181 | 10 | * |
dflet | 3:a8c249046181 | 11 | * Redistributions of source code must retain the above copyright |
dflet | 3:a8c249046181 | 12 | * notice, this list of conditions and the following disclaimer. |
dflet | 3:a8c249046181 | 13 | * |
dflet | 3:a8c249046181 | 14 | * Redistributions in binary form must reproduce the above copyright |
dflet | 3:a8c249046181 | 15 | * notice, this list of conditions and the following disclaimer in the |
dflet | 3:a8c249046181 | 16 | * documentation and/or other materials provided with the |
dflet | 3:a8c249046181 | 17 | * distribution. |
dflet | 3:a8c249046181 | 18 | * |
dflet | 3:a8c249046181 | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
dflet | 3:a8c249046181 | 20 | * its contributors may be used to endorse or promote products derived |
dflet | 3:a8c249046181 | 21 | * from this software without specific prior written permission. |
dflet | 3:a8c249046181 | 22 | * |
dflet | 3:a8c249046181 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
dflet | 3:a8c249046181 | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
dflet | 3:a8c249046181 | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
dflet | 3:a8c249046181 | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
dflet | 3:a8c249046181 | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
dflet | 3:a8c249046181 | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
dflet | 3:a8c249046181 | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
dflet | 3:a8c249046181 | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
dflet | 3:a8c249046181 | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
dflet | 3:a8c249046181 | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
dflet | 3:a8c249046181 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
dflet | 3:a8c249046181 | 34 | * |
dflet | 3:a8c249046181 | 35 | */ |
dflet | 3:a8c249046181 | 36 | |
dflet | 3:a8c249046181 | 37 | |
dflet | 3:a8c249046181 | 38 | /*****************************************************************************/ |
dflet | 3:a8c249046181 | 39 | /* Include files */ |
dflet | 3:a8c249046181 | 40 | /*****************************************************************************/ |
dflet | 3:a8c249046181 | 41 | #include "cc3100_simplelink.h" |
dflet | 3:a8c249046181 | 42 | |
dflet | 3:a8c249046181 | 43 | #ifndef RX_FILTERS_PREPROCESSOR_CLI_IF_H_ |
dflet | 3:a8c249046181 | 44 | #define RX_FILTERS_PREPROCESSOR_CLI_IF_H_ |
dflet | 3:a8c249046181 | 45 | |
dflet | 3:a8c249046181 | 46 | #include "cc3100_driver.h" |
dflet | 3:a8c249046181 | 47 | |
dflet | 3:a8c249046181 | 48 | /*****************************************************************************/ |
dflet | 3:a8c249046181 | 49 | /* Macro declarations */ |
dflet | 3:a8c249046181 | 50 | /*****************************************************************************/ |
dflet | 3:a8c249046181 | 51 | |
dflet | 3:a8c249046181 | 52 | /*! |
dflet | 3:a8c249046181 | 53 | * \def SL_RX_FILTER_MAX_FILTERS |
dflet | 3:a8c249046181 | 54 | * The Max number of filters for 64 filters |
dflet | 3:a8c249046181 | 55 | */ |
dflet | 3:a8c249046181 | 56 | #define SL_RX_FILTER_MAX_FILTERS 64 |
dflet | 3:a8c249046181 | 57 | |
dflet | 3:a8c249046181 | 58 | /*! |
dflet | 3:a8c249046181 | 59 | * \def SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS |
dflet | 3:a8c249046181 | 60 | * The Max number of software filters |
dflet | 3:a8c249046181 | 61 | */ |
dflet | 3:a8c249046181 | 62 | #define SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS (32) |
dflet | 3:a8c249046181 | 63 | /*! |
dflet | 3:a8c249046181 | 64 | * \def SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 65 | * |
dflet | 3:a8c249046181 | 66 | */ |
dflet | 3:a8c249046181 | 67 | #define SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS (2) |
dflet | 3:a8c249046181 | 68 | /*! |
dflet | 3:a8c249046181 | 69 | * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS |
dflet | 3:a8c249046181 | 70 | * |
dflet | 3:a8c249046181 | 71 | */ |
dflet | 3:a8c249046181 | 72 | #define SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS (2) |
dflet | 3:a8c249046181 | 73 | /*! |
dflet | 3:a8c249046181 | 74 | * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS |
dflet | 3:a8c249046181 | 75 | * |
dflet | 3:a8c249046181 | 76 | */ |
dflet | 3:a8c249046181 | 77 | #define SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS (2) |
dflet | 3:a8c249046181 | 78 | /*! |
dflet | 3:a8c249046181 | 79 | * \def SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH |
dflet | 3:a8c249046181 | 80 | * |
dflet | 3:a8c249046181 | 81 | */ |
dflet | 3:a8c249046181 | 82 | #define SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH (32) |
dflet | 3:a8c249046181 | 83 | |
dflet | 3:a8c249046181 | 84 | |
dflet | 3:a8c249046181 | 85 | /* List of possible error numbers */ |
dflet | 3:a8c249046181 | 86 | #define RXFL_OK (0) /* O.K */ |
dflet | 3:a8c249046181 | 87 | #define RXFL_OUTPUT_OR_INPUT_BUFFER_LENGTH_TOO_SMALL (76) /* ! The output buffer length is smaller than required for that operation */ |
dflet | 3:a8c249046181 | 88 | #define RXFL_DEPENDENT_FILTER_SOFTWARE_FILTER_NOT_FIT (75) /* Node filter can't be child of software filter and vice_versa */ |
dflet | 3:a8c249046181 | 89 | #define RXFL_DEPENDENCY_IS_NOT_PERSISTENT (74) /* Dependency filter is not persistent */ |
dflet | 3:a8c249046181 | 90 | #define RXFL_SYSTEM_STATE_NOT_SUPPORTED_FOR_THIS_FILTER (72) /* System state is not supported */ |
dflet | 3:a8c249046181 | 91 | #define RXFL_TRIGGER_USE_REG5_TO_REG8 (71) /* Only counters 5 - 8 are allowed, for Tigger */ |
dflet | 3:a8c249046181 | 92 | #define RXFL_TRIGGER_USE_REG1_TO_REG4 (70) /* Only counters 1 - 4 are allowed, for trigger */ |
dflet | 3:a8c249046181 | 93 | #define RXFL_ACTION_USE_REG5_TO_REG8 (69) /* Only counters 5 - 8 are allowed, for action */ |
dflet | 3:a8c249046181 | 94 | #define RXFL_ACTION_USE_REG1_TO_REG4 (68) /* Only counters 1 - 4 are allowed, for action */ |
dflet | 3:a8c249046181 | 95 | #define RXFL_FIELD_SUPPORT_ONLY_EQUAL_AND_NOTEQUAL (67) /* Rule compare function Id is out of range */ |
dflet | 3:a8c249046181 | 96 | #define RXFL_WRONG_MULTICAST_BROADCAST_ADDRESS (66) /* The address should be of type mutlicast or broadcast */ |
dflet | 3:a8c249046181 | 97 | #define RXFL_THE_FILTER_IS_NOT_OF_HEADER_TYPE (65) /* The filter should be of header type */ |
dflet | 3:a8c249046181 | 98 | #define RXFL_WRONG_COMPARE_FUNC_FOR_BROADCAST_ADDRESS (64) /* The compare funcion is not suitable for broadcast address */ |
dflet | 3:a8c249046181 | 99 | #define RXFL_WRONG_MULTICAST_ADDRESS (63) /* The address should be of muticast type */ |
dflet | 3:a8c249046181 | 100 | #define RXFL_DEPENDENT_FILTER_IS_NOT_PERSISTENT (62) /* The dependency filter is not persistent */ |
dflet | 3:a8c249046181 | 101 | #define RXFL_DEPENDENT_FILTER_IS_NOT_ENABLED (61) /* The dependency filter is not enabled */ |
dflet | 3:a8c249046181 | 102 | #define RXFL_FILTER_HAS_CHILDS (60) /* The filter has childs and can't be removed */ |
dflet | 3:a8c249046181 | 103 | #define RXFL_CHILD_IS_ENABLED (59) /* Can't disable filter while the child is enabled */ |
dflet | 3:a8c249046181 | 104 | #define RXFL_DEPENDENCY_IS_DISABLED (58) /* Can't enable filetr in case its depndency filter is disabled */ |
dflet | 3:a8c249046181 | 105 | #define RXFL_NUMBER_OF_CONNECTION_POINTS_EXCEEDED (52) /* Number of connection points exceeded */ |
dflet | 3:a8c249046181 | 106 | #define RXFL_DEPENDENT_FILTER_DEPENDENCY_ACTION_IS_DROP (51) /* The dependent filter has Drop action, thus the filter can't be created */ |
dflet | 3:a8c249046181 | 107 | #define RXFL_FILTER_DO_NOT_EXISTS (50) /* The filter doesn't exists */ |
dflet | 3:a8c249046181 | 108 | #define RXFL_DEPEDENCY_NOT_ON_THE_SAME_LAYER (49) /* The filter and its dependency must be on the same layer */ |
dflet | 3:a8c249046181 | 109 | #define RXFL_NUMBER_OF_ARGS_EXCEEDED (48) /* Number of arguments excceded */ |
dflet | 3:a8c249046181 | 110 | #define RXFL_ACTION_NO_REG_NUMBER (47) /* Action require counter number */ |
dflet | 3:a8c249046181 | 111 | #define RXFL_DEPENDENT_FILTER_LAYER_DO_NOT_FIT (46) /* the filter and its dependency should be from the same layer */ |
dflet | 3:a8c249046181 | 112 | #define RXFL_DEPENDENT_FILTER_SYSTEM_STATE_DO_NOT_FIT (45) /* The filter and its dependency system state don't fit */ |
dflet | 3:a8c249046181 | 113 | #define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_2 (44) /* The parent filter don't exist */ |
dflet | 3:a8c249046181 | 114 | #define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_1 (43) /* The parent filter is null */ |
dflet | 3:a8c249046181 | 115 | #define RXFL_RULE_HEADER_ACTION_TYPE_NOT_SUPPORTED (42) /* The action type is not supported */ |
dflet | 3:a8c249046181 | 116 | #define RXFL_RULE_HEADER_TRIGGER_COMPARE_FUNC_OUT_OF_RANGE (41) /* The Trigger comparision function is out of range */ |
dflet | 3:a8c249046181 | 117 | #define RXFL_RULE_HEADER_TRIGGER_OUT_OF_RANGE (40) /* The Trigger is out of range */ |
dflet | 3:a8c249046181 | 118 | #define RXFL_RULE_HEADER_COMPARE_FUNC_OUT_OF_RANGE (39) /* The rule compare function is out of range */ |
dflet | 3:a8c249046181 | 119 | #define RXFL_FRAME_TYPE_NOT_SUPPORTED (38) /* ASCII frame type string is illegal */ |
dflet | 3:a8c249046181 | 120 | #define RXFL_RULE_FIELD_ID_NOT_SUPPORTED (37) /* Rule field ID is out of range */ |
dflet | 3:a8c249046181 | 121 | #define RXFL_RULE_HEADER_FIELD_ID_ASCII_NOT_SUPPORTED (36) /* This ASCII field ID is not supported */ |
dflet | 3:a8c249046181 | 122 | #define RXFL_RULE_HEADER_NOT_SUPPORTED (35) /* The header rule is not supported on current release */ |
dflet | 3:a8c249046181 | 123 | #define RXFL_RULE_HEADER_OUT_OF_RANGE (34) /* The header rule is out of range */ |
dflet | 3:a8c249046181 | 124 | #define RXFL_RULE_HEADER_COMBINATION_OPERATOR_OUT_OF_RANGE (33) /* Combination function Id is out of ramge */ |
dflet | 3:a8c249046181 | 125 | #define RXFL_RULE_HEADER_FIELD_ID_OUT_OF_RANGE (32) /* rule field Id is out of range */ |
dflet | 3:a8c249046181 | 126 | #define RXFL_UPDATE_NOT_SUPPORTED (31) /* Update not supported */ |
dflet | 3:a8c249046181 | 127 | #define RXFL_NO_FILTERS_ARE_DEFINED (24) /* No filters are defined in the system */ |
dflet | 3:a8c249046181 | 128 | #define RXFL_NUMBER_OF_FILTER_EXCEEDED (23) /* Number of max filters excceded */ |
dflet | 3:a8c249046181 | 129 | |
dflet | 3:a8c249046181 | 130 | |
dflet | 3:a8c249046181 | 131 | /******************************************************************************/ |
dflet | 3:a8c249046181 | 132 | /* Type declarations */ |
dflet | 3:a8c249046181 | 133 | /******************************************************************************/ |
dflet | 3:a8c249046181 | 134 | |
dflet | 3:a8c249046181 | 135 | /*! |
dflet | 3:a8c249046181 | 136 | |
dflet | 3:a8c249046181 | 137 | |
dflet | 3:a8c249046181 | 138 | * \typedef SlrxFilterID_t |
dflet | 3:a8c249046181 | 139 | * Unique filter ID which is allocated by the system , negative number means error |
dflet | 3:a8c249046181 | 140 | */ |
dflet | 3:a8c249046181 | 141 | typedef int8_t SlrxFilterID_t; |
dflet | 3:a8c249046181 | 142 | |
dflet | 3:a8c249046181 | 143 | |
dflet | 3:a8c249046181 | 144 | /*! |
dflet | 3:a8c249046181 | 145 | * \typedef SlrxFilterCompareMask_t |
dflet | 3:a8c249046181 | 146 | * The mask is used for the rule comparison function |
dflet | 3:a8c249046181 | 147 | */ |
dflet | 3:a8c249046181 | 148 | typedef uint8_t SlrxFilterCompareMask_t; |
dflet | 3:a8c249046181 | 149 | |
dflet | 3:a8c249046181 | 150 | /*! |
dflet | 3:a8c249046181 | 151 | * \typedef SlrxFilterIdMask_t |
dflet | 3:a8c249046181 | 152 | * Representation of filters Id as a bit field |
dflet | 3:a8c249046181 | 153 | * The bit field is used to declare which filters are involved |
dflet | 3:a8c249046181 | 154 | * in operation. Number of filter can be up to 128 filters. i.e. 128 bits are needed. |
dflet | 3:a8c249046181 | 155 | * On the current release, up to 64 filters can be defined. |
dflet | 3:a8c249046181 | 156 | */ |
dflet | 3:a8c249046181 | 157 | typedef uint8_t SlrxFilterIdMask_t[128/8]; |
dflet | 3:a8c249046181 | 158 | |
dflet | 3:a8c249046181 | 159 | /*! |
dflet | 3:a8c249046181 | 160 | * \typedef SlrxFilterPrePreparedFilters_t |
dflet | 3:a8c249046181 | 161 | * Describes the supported software filter sets, |
dflet | 3:a8c249046181 | 162 | */ |
dflet | 3:a8c249046181 | 163 | typedef uint8_t SlrxFilterPrePreparedFilters_t; |
dflet | 3:a8c249046181 | 164 | #define SL_ARP_AUTO_REPLY_PRE_PREPARED_FILTERS (0) |
dflet | 3:a8c249046181 | 165 | #define SL_MULTICASTSIPV4_DROP_PREPREPARED_FILTERS (1) |
dflet | 3:a8c249046181 | 166 | #define SL_MULTICASTSIPV6_DROP_PREPREPARED_FILTERS (2) |
dflet | 3:a8c249046181 | 167 | #define SL_MULTICASTSWIFI_DROP_PREPREPARED_FILTERS (3) |
dflet | 3:a8c249046181 | 168 | |
dflet | 3:a8c249046181 | 169 | |
dflet | 3:a8c249046181 | 170 | |
dflet | 3:a8c249046181 | 171 | /*! |
dflet | 3:a8c249046181 | 172 | * \typedef SlrxFilterPrePreparedFiltersMask_t |
dflet | 3:a8c249046181 | 173 | * Describes the supported software filter sets, |
dflet | 3:a8c249046181 | 174 | * each bit represents different software filter set |
dflet | 3:a8c249046181 | 175 | * The filter sets are defined at SlrxFilterPrePreparedFilters_t |
dflet | 3:a8c249046181 | 176 | */ |
dflet | 3:a8c249046181 | 177 | typedef uint8_t SlrxFilterPrePreparedFiltersMask_t[SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS/8]; |
dflet | 3:a8c249046181 | 178 | |
dflet | 3:a8c249046181 | 179 | |
dflet | 3:a8c249046181 | 180 | /*! \typedef SlrxFilterRegxPattern_t |
dflet | 3:a8c249046181 | 181 | * The struct contains the regular expression pattern which is used in case of payload rule. |
dflet | 3:a8c249046181 | 182 | * Not supported in the current release |
dflet | 3:a8c249046181 | 183 | */ |
dflet | 3:a8c249046181 | 184 | typedef struct SlrxFilterRegxPattern_t { |
dflet | 3:a8c249046181 | 185 | uint8_t x[SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH]; |
dflet | 3:a8c249046181 | 186 | } SlrxFilterRegxPattern_t; |
dflet | 3:a8c249046181 | 187 | |
dflet | 3:a8c249046181 | 188 | |
dflet | 3:a8c249046181 | 189 | /*! \typedef SlrxFilterAsciiArg_t |
dflet | 3:a8c249046181 | 190 | * The buffer is used to provide container for ASCII argument, which may be used in case of HEADER rule. |
dflet | 3:a8c249046181 | 191 | * example for ASCII argument can be : IP = 256.0.67.1 |
dflet | 3:a8c249046181 | 192 | */ |
dflet | 3:a8c249046181 | 193 | typedef uint8_t SlrxFilterAsciiArg_t; |
dflet | 3:a8c249046181 | 194 | |
dflet | 3:a8c249046181 | 195 | |
dflet | 3:a8c249046181 | 196 | /*! \typedef SlrxFilterBinaryArg_t |
dflet | 3:a8c249046181 | 197 | * The buffer provides container for binary argument, which may be used in case of HEADER rule |
dflet | 3:a8c249046181 | 198 | */ |
dflet | 3:a8c249046181 | 199 | typedef uint8_t SlrxFilterBinaryArg_t ; |
dflet | 3:a8c249046181 | 200 | |
dflet | 3:a8c249046181 | 201 | |
dflet | 3:a8c249046181 | 202 | /*! \typedef SlrxFilterActionArg_t |
dflet | 3:a8c249046181 | 203 | * Provides container for the filter action argument. |
dflet | 3:a8c249046181 | 204 | * for example: in case action is to send automatic response , the argument is the template to be used for the automatic response. |
dflet | 3:a8c249046181 | 205 | * |
dflet | 3:a8c249046181 | 206 | * |
dflet | 3:a8c249046181 | 207 | */ |
dflet | 3:a8c249046181 | 208 | typedef uint8_t SlrxFilterActionArg_t ; |
dflet | 3:a8c249046181 | 209 | |
dflet | 3:a8c249046181 | 210 | |
dflet | 3:a8c249046181 | 211 | |
dflet | 3:a8c249046181 | 212 | /*! \typedef SlrxFilterOffset_t |
dflet | 3:a8c249046181 | 213 | * The offset relative to the packet payload start location. |
dflet | 3:a8c249046181 | 214 | * Not supported on current release |
dflet | 3:a8c249046181 | 215 | */ |
dflet | 3:a8c249046181 | 216 | typedef uint32_t SlrxFilterOffset_t; |
dflet | 3:a8c249046181 | 217 | |
dflet | 3:a8c249046181 | 218 | |
dflet | 3:a8c249046181 | 219 | |
dflet | 3:a8c249046181 | 220 | /*! \typedef SlrxFilterRuleType_t |
dflet | 3:a8c249046181 | 221 | * Enumerates the different filter types. |
dflet | 3:a8c249046181 | 222 | * On the current release only HEADER and COMBINATION are supported. |
dflet | 3:a8c249046181 | 223 | */ |
dflet | 3:a8c249046181 | 224 | typedef uint8_t SlrxFilterRuleType_t; |
dflet | 3:a8c249046181 | 225 | /* possible values for SlrxFilterRuleType_t */ |
dflet | 3:a8c249046181 | 226 | #define HEADER (0) |
dflet | 3:a8c249046181 | 227 | #define COMBINATION (1) |
dflet | 3:a8c249046181 | 228 | #define EXACT_PATTERN (2) |
dflet | 3:a8c249046181 | 229 | #define LIKELIHOOD_PATTERN (3) |
dflet | 3:a8c249046181 | 230 | #define ALWAYS_TRUE (4) |
dflet | 3:a8c249046181 | 231 | #define NUM_OF_FILTER_TYPES (5) |
dflet | 3:a8c249046181 | 232 | |
dflet | 3:a8c249046181 | 233 | |
dflet | 3:a8c249046181 | 234 | /*! \typedef SlrxFilterFlags_t |
dflet | 3:a8c249046181 | 235 | * Bit field which sets the behaviour of the RX filter |
dflet | 3:a8c249046181 | 236 | * |
dflet | 3:a8c249046181 | 237 | */ |
dflet | 3:a8c249046181 | 238 | |
dflet | 3:a8c249046181 | 239 | #define RX_FILTER_BINARY (0x1) |
dflet | 3:a8c249046181 | 240 | #define RX_FILTER_PERSISTENT (0x8) |
dflet | 3:a8c249046181 | 241 | #define RX_FILTER_ENABLE (0x10) |
dflet | 3:a8c249046181 | 242 | |
dflet | 3:a8c249046181 | 243 | typedef union SlrxFilterFlags_t { |
dflet | 3:a8c249046181 | 244 | |
dflet | 3:a8c249046181 | 245 | /* struct |
dflet | 3:a8c249046181 | 246 | { */ |
dflet | 3:a8c249046181 | 247 | /*! |
dflet | 3:a8c249046181 | 248 | * The filter argument can be set as binary argument or ASCII arguments. |
dflet | 3:a8c249046181 | 249 | * When the bit is on the argument are binary. |
dflet | 3:a8c249046181 | 250 | */ |
dflet | 3:a8c249046181 | 251 | /* uint8_t Binary: 1; */ |
dflet | 3:a8c249046181 | 252 | /*! |
dflet | 3:a8c249046181 | 253 | * |
dflet | 3:a8c249046181 | 254 | */ |
dflet | 3:a8c249046181 | 255 | /* uint8_t AutoSort : 1; */ |
dflet | 3:a8c249046181 | 256 | /*! |
dflet | 3:a8c249046181 | 257 | * |
dflet | 3:a8c249046181 | 258 | */ |
dflet | 3:a8c249046181 | 259 | /* uint8_t AutoFaultDetect : 1; */ |
dflet | 3:a8c249046181 | 260 | /*! |
dflet | 3:a8c249046181 | 261 | * When the bit is on it means the the node is enabled . |
dflet | 3:a8c249046181 | 262 | */ |
dflet | 3:a8c249046181 | 263 | /* uint8_t Enabled : 1; */ |
dflet | 3:a8c249046181 | 264 | /* uint8_t padding : 3; */ |
dflet | 3:a8c249046181 | 265 | /* |
dflet | 3:a8c249046181 | 266 | };*/ |
dflet | 3:a8c249046181 | 267 | |
dflet | 3:a8c249046181 | 268 | uint8_t IntRepresentation; |
dflet | 3:a8c249046181 | 269 | |
dflet | 3:a8c249046181 | 270 | } SlrxFilterFlags_t; |
dflet | 3:a8c249046181 | 271 | |
dflet | 3:a8c249046181 | 272 | /*! \typedef SlrxFilterCompareFunction_t |
dflet | 3:a8c249046181 | 273 | * Used as comparison function for the header type arguments |
dflet | 3:a8c249046181 | 274 | * |
dflet | 3:a8c249046181 | 275 | */ |
dflet | 3:a8c249046181 | 276 | typedef uint8_t SlrxFilterCompareFunction_t; |
dflet | 3:a8c249046181 | 277 | /* Possible values for SlrxFilterCompareFunction_t */ |
dflet | 3:a8c249046181 | 278 | #define COMPARE_FUNC_IN_BETWEEN (0) |
dflet | 3:a8c249046181 | 279 | #define COMPARE_FUNC_EQUAL (1) |
dflet | 3:a8c249046181 | 280 | #define COMPARE_FUNC_NOT_EQUAL_TO (2) |
dflet | 3:a8c249046181 | 281 | #define COMPARE_FUNC_NOT_IN_BETWEEN (3) |
dflet | 3:a8c249046181 | 282 | #define COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4) |
dflet | 3:a8c249046181 | 283 | |
dflet | 3:a8c249046181 | 284 | /*! \typedef SlrxFilterCompareFunction_t |
dflet | 3:a8c249046181 | 285 | * Used as comparison function for the header type arguments |
dflet | 3:a8c249046181 | 286 | * |
dflet | 3:a8c249046181 | 287 | */ |
dflet | 3:a8c249046181 | 288 | typedef uint8_t SlrxTriggerCompareFunction_t; |
dflet | 3:a8c249046181 | 289 | /* Possible values for SlrxTriggerCompareFunction_t */ |
dflet | 3:a8c249046181 | 290 | #define TRIGGER_COMPARE_FUNC_EQUAL (0) |
dflet | 3:a8c249046181 | 291 | /* arg1 == protocolVal ,not supported in current release */ |
dflet | 3:a8c249046181 | 292 | #define TRIGGER_COMPARE_FUNC_NOT_EQUAL_TO (1) |
dflet | 3:a8c249046181 | 293 | /* arg1 == protocolVal */ |
dflet | 3:a8c249046181 | 294 | #define TRIGGER_COMPARE_FUNC_SMALLER_THAN (2) |
dflet | 3:a8c249046181 | 295 | /* arg1 == protocolVal */ |
dflet | 3:a8c249046181 | 296 | #define TRIGGER_COMPARE_FUNC_BIGGER_THAN (3) |
dflet | 3:a8c249046181 | 297 | /* definition */ |
dflet | 3:a8c249046181 | 298 | #define TRIGGER_COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4) |
dflet | 3:a8c249046181 | 299 | |
dflet | 3:a8c249046181 | 300 | |
dflet | 3:a8c249046181 | 301 | /*! \typedef SlrxFilterHdrField_t |
dflet | 3:a8c249046181 | 302 | * Provides list of possible header types which may be defined as part of the rule |
dflet | 3:a8c249046181 | 303 | * |
dflet | 3:a8c249046181 | 304 | */ |
dflet | 3:a8c249046181 | 305 | typedef uint8_t SlrxFilterHdrField_t; |
dflet | 3:a8c249046181 | 306 | /* Possible values for SlrxFilterHdrField_t */ |
dflet | 3:a8c249046181 | 307 | #define NULL_FIELD_ID_TYPE (0) |
dflet | 3:a8c249046181 | 308 | /* 802.11 control\data\management */ |
dflet | 3:a8c249046181 | 309 | #define FRAME_TYPE_FIELD (1) |
dflet | 3:a8c249046181 | 310 | /* 802.11 beacon\probe\.. */ |
dflet | 3:a8c249046181 | 311 | #define FRAME_SUBTYPE_FIELD (2) |
dflet | 3:a8c249046181 | 312 | /* 802.11 bssid type */ |
dflet | 3:a8c249046181 | 313 | #define BSSID_FIELD (3) |
dflet | 3:a8c249046181 | 314 | /* */ |
dflet | 3:a8c249046181 | 315 | #define MAC_SRC_ADDRESS_FIELD (4) |
dflet | 3:a8c249046181 | 316 | /* */ |
dflet | 3:a8c249046181 | 317 | #define MAC_DST_ADDRESS_FIELD (5) |
dflet | 3:a8c249046181 | 318 | /* */ |
dflet | 3:a8c249046181 | 319 | #define FRAME_LENGTH_FIELD (6) |
dflet | 3:a8c249046181 | 320 | /* */ |
dflet | 3:a8c249046181 | 321 | #define PROTOCOL_TYPE_FIELD (7) |
dflet | 3:a8c249046181 | 322 | /* */ |
dflet | 3:a8c249046181 | 323 | #define IP_VERSION_FIELD (8) |
dflet | 3:a8c249046181 | 324 | /* TCP / UDP */ |
dflet | 3:a8c249046181 | 325 | #define IP_PROTOCOL_FIELD (9) |
dflet | 3:a8c249046181 | 326 | /* */ |
dflet | 3:a8c249046181 | 327 | #define IPV4_SRC_ADRRESS_FIELD (10) |
dflet | 3:a8c249046181 | 328 | /* */ |
dflet | 3:a8c249046181 | 329 | #define IPV4_DST_ADDRESS_FIELD (11) |
dflet | 3:a8c249046181 | 330 | /* */ |
dflet | 3:a8c249046181 | 331 | #define IPV6_SRC_ADRRESS_FIELD (12) |
dflet | 3:a8c249046181 | 332 | /* */ |
dflet | 3:a8c249046181 | 333 | #define IPV6_DST_ADDRESS_FIELD (13) |
dflet | 3:a8c249046181 | 334 | /* */ |
dflet | 3:a8c249046181 | 335 | #define SRC_PORT_FIELD (14) |
dflet | 3:a8c249046181 | 336 | /* */ |
dflet | 3:a8c249046181 | 337 | #define DST_PORT_FIELD (15) |
dflet | 3:a8c249046181 | 338 | /* Definition */ |
dflet | 3:a8c249046181 | 339 | #define NUM_OF_FIELD_NAME_FIELD (16) |
dflet | 3:a8c249046181 | 340 | |
dflet | 3:a8c249046181 | 341 | /*! \union SlrxFilterHeaderArg_t |
dflet | 3:a8c249046181 | 342 | * The structure holds the header ARGS which are used in case of HDR rule. |
dflet | 3:a8c249046181 | 343 | */ |
dflet | 3:a8c249046181 | 344 | /* -- 36 bytes */ |
dflet | 3:a8c249046181 | 345 | typedef union SlrxFilterHeaderArg_t { |
dflet | 3:a8c249046181 | 346 | /*----------------------------- Large size ---------------------------------*/ |
dflet | 3:a8c249046181 | 347 | /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 348 | * example : IPV6 16 bytes, 39 characters |
dflet | 3:a8c249046181 | 349 | * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12 |
dflet | 3:a8c249046181 | 350 | */ |
dflet | 3:a8c249046181 | 351 | |
dflet | 3:a8c249046181 | 352 | SlrxFilterBinaryArg_t RxFilterDB16BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][16 ]; /* Binary Values for comparition */ |
dflet | 3:a8c249046181 | 353 | /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 354 | * example : IPV6 16 bytes, 39 characters |
dflet | 3:a8c249046181 | 355 | * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12 |
dflet | 3:a8c249046181 | 356 | * Ascii format for ipV6 is not supported |
dflet | 3:a8c249046181 | 357 | */ |
dflet | 3:a8c249046181 | 358 | /*----------------------------- Medium size ---------------------------------*/ |
dflet | 3:a8c249046181 | 359 | /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 360 | * MAC address: 6 bytes, 17 chars |
dflet | 3:a8c249046181 | 361 | */ |
dflet | 3:a8c249046181 | 362 | SlrxFilterBinaryArg_t RxFilterDB6BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][6]; /* Binary Values for comparition */ |
dflet | 3:a8c249046181 | 363 | /*! |
dflet | 3:a8c249046181 | 364 | * ! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 365 | * IP address: 4 bytes, 15 chars |
dflet | 3:a8c249046181 | 366 | * 2 bytes are added for padding |
dflet | 3:a8c249046181 | 367 | */ |
dflet | 3:a8c249046181 | 368 | SlrxFilterAsciiArg_t RxFilterDB18BytesAsciiRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][18]; /* Ascii Values for comparison */ |
dflet | 3:a8c249046181 | 369 | /*----------------------------- Small size ---------------------------------*/ |
dflet | 3:a8c249046181 | 370 | /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 371 | * IP address: 4 bytes, 15 chars |
dflet | 3:a8c249046181 | 372 | * Port: 2 bytes, chars: 5 chars |
dflet | 3:a8c249046181 | 373 | */ |
dflet | 3:a8c249046181 | 374 | SlrxFilterBinaryArg_t RxFilterDB4BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][4]; /* Binary Values for comparison */ |
dflet | 3:a8c249046181 | 375 | /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 376 | * Port: 2 bytes, chars: 5 chars |
dflet | 3:a8c249046181 | 377 | */ |
dflet | 3:a8c249046181 | 378 | SlrxFilterAsciiArg_t RxFilterDB5BytesRuleAsciiArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][5]; /* Ascii Values for comparison */ |
dflet | 3:a8c249046181 | 379 | /*----------------------------- 1 byte size ---------------------------------*/ |
dflet | 3:a8c249046181 | 380 | /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS |
dflet | 3:a8c249046181 | 381 | */ |
dflet | 3:a8c249046181 | 382 | SlrxFilterBinaryArg_t RxFilterDB1BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][1]; /* Binary Values for comparison */ |
dflet | 3:a8c249046181 | 383 | } SlrxFilterHeaderArg_t; |
dflet | 3:a8c249046181 | 384 | |
dflet | 3:a8c249046181 | 385 | |
dflet | 3:a8c249046181 | 386 | |
dflet | 3:a8c249046181 | 387 | /*! \typedef SlrxFilterRuleHeaderArgsAndMask_t |
dflet | 3:a8c249046181 | 388 | * Structure which defines the Header Args and mask |
dflet | 3:a8c249046181 | 389 | */ |
dflet | 3:a8c249046181 | 390 | /* -- 52 bytes */ |
dflet | 3:a8c249046181 | 391 | typedef struct SlrxFilterRuleHeaderArgsAndMask_t { |
dflet | 3:a8c249046181 | 392 | /*! Argument for the comparison function */ |
dflet | 3:a8c249046181 | 393 | /* -- 36 byte */ |
dflet | 3:a8c249046181 | 394 | SlrxFilterHeaderArg_t RuleHeaderArgs; |
dflet | 3:a8c249046181 | 395 | |
dflet | 3:a8c249046181 | 396 | /*! the mask is used in order to enable partial comparison, |
dflet | 3:a8c249046181 | 397 | * Use the 0xFFFFFFFF in case you don't want to use mask |
dflet | 3:a8c249046181 | 398 | */ |
dflet | 3:a8c249046181 | 399 | /* -- 16 bytes */ |
dflet | 3:a8c249046181 | 400 | SlrxFilterCompareMask_t RuleHeaderArgsMask[16]; |
dflet | 3:a8c249046181 | 401 | |
dflet | 3:a8c249046181 | 402 | } SlrxFilterRuleHeaderArgsAndMask_t; |
dflet | 3:a8c249046181 | 403 | |
dflet | 3:a8c249046181 | 404 | /*! \typedef SlrxFilterHeaderType_t |
dflet | 3:a8c249046181 | 405 | * Structure which defines the Header rule |
dflet | 3:a8c249046181 | 406 | * The header rule defines compare function on the protocol header |
dflet | 3:a8c249046181 | 407 | * For example destMacAddre is between ( 12:6::78:77, 12:6::78:90 ) |
dflet | 3:a8c249046181 | 408 | * |
dflet | 3:a8c249046181 | 409 | */ |
dflet | 3:a8c249046181 | 410 | /* -- 56 byte */ |
dflet | 3:a8c249046181 | 411 | typedef struct SlrxFilterHeaderType_t { |
dflet | 3:a8c249046181 | 412 | /*! see :: SlrxFilterRuleHeaderArgsAndMask_t */ |
dflet | 3:a8c249046181 | 413 | /* -- 52 bytes */ |
dflet | 3:a8c249046181 | 414 | SlrxFilterRuleHeaderArgsAndMask_t RuleHeaderArgsAndMask; |
dflet | 3:a8c249046181 | 415 | |
dflet | 3:a8c249046181 | 416 | /*! Packet HDR field which will be compared to the argument */ |
dflet | 3:a8c249046181 | 417 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 418 | SlrxFilterHdrField_t RuleHeaderfield; |
dflet | 3:a8c249046181 | 419 | |
dflet | 3:a8c249046181 | 420 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 421 | /*! type of the comparison function |
dflet | 3:a8c249046181 | 422 | * see :: SlrxFilterCompareFunction_t |
dflet | 3:a8c249046181 | 423 | */ |
dflet | 3:a8c249046181 | 424 | SlrxFilterCompareFunction_t RuleCompareFunc; |
dflet | 3:a8c249046181 | 425 | |
dflet | 3:a8c249046181 | 426 | /*! padding */ |
dflet | 3:a8c249046181 | 427 | /* -- 2 bytes */ |
dflet | 3:a8c249046181 | 428 | uint8_t RulePadding[2]; |
dflet | 3:a8c249046181 | 429 | |
dflet | 3:a8c249046181 | 430 | } SlrxFilterHeaderType_t; |
dflet | 3:a8c249046181 | 431 | |
dflet | 3:a8c249046181 | 432 | /*! \typedef SlrxFilterPayloadType_t |
dflet | 3:a8c249046181 | 433 | * Structure which defines payload rule. |
dflet | 3:a8c249046181 | 434 | * Not supported on current release. |
dflet | 3:a8c249046181 | 435 | */ |
dflet | 3:a8c249046181 | 436 | /* -- 40 byte */ |
dflet | 3:a8c249046181 | 437 | typedef struct SlrxFilterPayloadType_t { |
dflet | 3:a8c249046181 | 438 | /*! Not supported on current release */ |
dflet | 3:a8c249046181 | 439 | /* -- 32 byte */ |
dflet | 3:a8c249046181 | 440 | SlrxFilterRegxPattern_t RegxPattern; |
dflet | 3:a8c249046181 | 441 | /*! Not supported on current release */ |
dflet | 3:a8c249046181 | 442 | /* -- 4 byte */ |
dflet | 3:a8c249046181 | 443 | SlrxFilterOffset_t LowerOffset; |
dflet | 3:a8c249046181 | 444 | /*! Not supported on current release */ |
dflet | 3:a8c249046181 | 445 | /* -- 4 byte */ |
dflet | 3:a8c249046181 | 446 | SlrxFilterOffset_t UpperOffset; |
dflet | 3:a8c249046181 | 447 | } SlrxFilterPayloadType_t; |
dflet | 3:a8c249046181 | 448 | |
dflet | 3:a8c249046181 | 449 | /*! \typedef SlrxFilterCombinationTypeOperator_t |
dflet | 3:a8c249046181 | 450 | * Enumerate the optional operators for the combination type |
dflet | 3:a8c249046181 | 451 | * filterID1 is located in the first arg , filterId2 is the second arg,see ::SlrxFilterCombinationType_t.CombinationFilterId |
dflet | 3:a8c249046181 | 452 | */ |
dflet | 3:a8c249046181 | 453 | typedef uint8_t SlrxFilterCombinationTypeOperator_t; |
dflet | 3:a8c249046181 | 454 | /* Possible values for SlrxFilterCombinationTypeOperator_t */ |
dflet | 3:a8c249046181 | 455 | /*! !filterID1 */ |
dflet | 3:a8c249046181 | 456 | #define COMBINED_FUNC_NOT (0) |
dflet | 3:a8c249046181 | 457 | /*! filterID1 && filterID2 */ |
dflet | 3:a8c249046181 | 458 | #define COMBINED_FUNC_AND (1) |
dflet | 3:a8c249046181 | 459 | /*! filterID1 && filterID2 */ |
dflet | 3:a8c249046181 | 460 | #define COMBINED_FUNC_OR (2) |
dflet | 3:a8c249046181 | 461 | |
dflet | 3:a8c249046181 | 462 | /*! \typedef SlrxFilterCombinationType_t |
dflet | 3:a8c249046181 | 463 | * Defines the structure which define the combination type filter |
dflet | 3:a8c249046181 | 464 | * The combined filter enable to make operation on one or two filter, |
dflet | 3:a8c249046181 | 465 | * for example !filterId1 or and(filterId2,filterId3). |
dflet | 3:a8c249046181 | 466 | * |
dflet | 3:a8c249046181 | 467 | */ |
dflet | 3:a8c249046181 | 468 | /* -- 4 byte */ |
dflet | 3:a8c249046181 | 469 | typedef struct SlrxFilterCombinationType_t { |
dflet | 3:a8c249046181 | 470 | /* ! combination operator */ |
dflet | 3:a8c249046181 | 471 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 472 | SlrxFilterCombinationTypeOperator_t CombinationTypeOperator; |
dflet | 3:a8c249046181 | 473 | /* ! filterID, may be one or two depends on the combination operator type */ |
dflet | 3:a8c249046181 | 474 | /* -- 2 byte */ |
dflet | 3:a8c249046181 | 475 | SlrxFilterID_t CombinationFilterId[SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS]; |
dflet | 3:a8c249046181 | 476 | /* ! Padding */ |
dflet | 3:a8c249046181 | 477 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 478 | uint8_t Padding; |
dflet | 3:a8c249046181 | 479 | } SlrxFilterCombinationType_t; |
dflet | 3:a8c249046181 | 480 | |
dflet | 3:a8c249046181 | 481 | |
dflet | 3:a8c249046181 | 482 | /*! \typedef SlrxFilterRule_t |
dflet | 3:a8c249046181 | 483 | * Rule structure composed of behavioral flags and the filter rule definitions |
dflet | 3:a8c249046181 | 484 | * |
dflet | 3:a8c249046181 | 485 | */ |
dflet | 3:a8c249046181 | 486 | /* -- 56 byte */ |
dflet | 3:a8c249046181 | 487 | typedef union SlrxFilterRule_t { |
dflet | 3:a8c249046181 | 488 | /* ! Header type rule , see explanation on the ::SlrxFilterHeaderType_t structure */ |
dflet | 3:a8c249046181 | 489 | /* -- 56 byte */ |
dflet | 3:a8c249046181 | 490 | SlrxFilterHeaderType_t HeaderType; |
dflet | 3:a8c249046181 | 491 | /* ! Payload rule, not supported in current release */ |
dflet | 3:a8c249046181 | 492 | /* -- 40 byte */ |
dflet | 3:a8c249046181 | 493 | SlrxFilterPayloadType_t PayLoadHeaderType; /* future for exact pattern or like hood pattern */ |
dflet | 3:a8c249046181 | 494 | /* ! Combined type rule , see explanation in ::SlrxFilterCombinationType_t structure */ |
dflet | 3:a8c249046181 | 495 | /* -- 4 byte */ |
dflet | 3:a8c249046181 | 496 | SlrxFilterCombinationType_t CombinationType; |
dflet | 3:a8c249046181 | 497 | } SlrxFilterRule_t; |
dflet | 3:a8c249046181 | 498 | |
dflet | 3:a8c249046181 | 499 | /*! \typedef SlrxFilterTriggerRoles_t |
dflet | 3:a8c249046181 | 500 | * Bit field which represents the roleId possible values |
dflet | 3:a8c249046181 | 501 | * In the current release only Station/AP roles are supported. |
dflet | 3:a8c249046181 | 502 | */ |
dflet | 3:a8c249046181 | 503 | #define RX_FILTER_ROLE_AP (1) |
dflet | 3:a8c249046181 | 504 | #define RX_FILTER_ROLE_STA (2) |
dflet | 3:a8c249046181 | 505 | #define RX_FILTER_ROLE_PROMISCUOUS (4) |
dflet | 3:a8c249046181 | 506 | #define RX_FILTER_ROLE_NULL (0) |
dflet | 3:a8c249046181 | 507 | |
dflet | 3:a8c249046181 | 508 | typedef union SlrxFilterTriggerRoles_t { |
dflet | 3:a8c249046181 | 509 | /* struct */ |
dflet | 3:a8c249046181 | 510 | /* { */ |
dflet | 3:a8c249046181 | 511 | /* uint8_t RoleAP :1; */ |
dflet | 3:a8c249046181 | 512 | /* uint8_t RoleStation :1; */ |
dflet | 3:a8c249046181 | 513 | /* The filter is activated only in Promiscuous mode */ |
dflet | 3:a8c249046181 | 514 | /* uint8_t PromiscuousMode :1; */ |
dflet | 3:a8c249046181 | 515 | /* uint8_t RoleReserved :5; */ |
dflet | 3:a8c249046181 | 516 | /* }; */ |
dflet | 3:a8c249046181 | 517 | /* ! Bit fiels of the Filter role */ |
dflet | 3:a8c249046181 | 518 | uint8_t IntRepresentation; |
dflet | 3:a8c249046181 | 519 | |
dflet | 3:a8c249046181 | 520 | } SlrxFilterTriggerRoles_t; |
dflet | 3:a8c249046181 | 521 | |
dflet | 3:a8c249046181 | 522 | /*! \typedef SlrxFilterTriggerConnectionStates_t |
dflet | 3:a8c249046181 | 523 | * Bit field representing the possible values of the When section of the rule |
dflet | 3:a8c249046181 | 524 | * |
dflet | 3:a8c249046181 | 525 | */ |
dflet | 3:a8c249046181 | 526 | #define RX_FILTER_CONNECTION_STATE_STA_CONNECTED (1) |
dflet | 3:a8c249046181 | 527 | #define RX_FILTER_CONNECTION_STATE_STA_NOT_CONNECTED (2) |
dflet | 3:a8c249046181 | 528 | #define RX_FILTER_CONNECTION_STATE_STA_HAS_IP (4) |
dflet | 3:a8c249046181 | 529 | #define RX_FILTER_CONNECTION_STATE_STA_HAS_NO_IP (8) |
dflet | 3:a8c249046181 | 530 | |
dflet | 3:a8c249046181 | 531 | typedef union SlrxFilterTriggerConnectionStates_t { |
dflet | 3:a8c249046181 | 532 | /* struct */ |
dflet | 3:a8c249046181 | 533 | /* { */ |
dflet | 3:a8c249046181 | 534 | /* uint8_t RoleStationWiFiConnected :1; */ |
dflet | 3:a8c249046181 | 535 | /* uint8_t RoleStationWiFiDisconneted:1; */ |
dflet | 3:a8c249046181 | 536 | /* uint8_t RoleStationWiFiHasIp:1; */ |
dflet | 3:a8c249046181 | 537 | /* uint8_t RoleStationWiFiHasNoIp:1; */ |
dflet | 3:a8c249046181 | 538 | /* uint8_t RoleStationWiFiSocketOpened:1; */ |
dflet | 3:a8c249046181 | 539 | /* uint8_t RoleStationWiFiSocketclosed:1; */ |
dflet | 3:a8c249046181 | 540 | /* }; */ |
dflet | 3:a8c249046181 | 541 | /* */ |
dflet | 3:a8c249046181 | 542 | /* ! */ |
dflet | 3:a8c249046181 | 543 | uint8_t IntRepresentation; |
dflet | 3:a8c249046181 | 544 | |
dflet | 3:a8c249046181 | 545 | } SlrxFilterTriggerConnectionStates_t; |
dflet | 3:a8c249046181 | 546 | |
dflet | 3:a8c249046181 | 547 | /*! \typedef SlrxFilterDBTriggerArg_t |
dflet | 3:a8c249046181 | 548 | * Provides container for entering the filter 'when' argument. |
dflet | 3:a8c249046181 | 549 | * The current release support 'When rules' which has no arguments. |
dflet | 3:a8c249046181 | 550 | * For example : |
dflet | 3:a8c249046181 | 551 | * When connect to specific AP -- the AP bssid is the argument. |
dflet | 3:a8c249046181 | 552 | * |
dflet | 3:a8c249046181 | 553 | */ |
dflet | 3:a8c249046181 | 554 | typedef uint32_t SlrxFilterDBTriggerArg_t; |
dflet | 3:a8c249046181 | 555 | |
dflet | 3:a8c249046181 | 556 | |
dflet | 3:a8c249046181 | 557 | |
dflet | 3:a8c249046181 | 558 | /*! \typedef SlrxFilterCounterId_t |
dflet | 3:a8c249046181 | 559 | * the counter ID we have 4 counters |
dflet | 3:a8c249046181 | 560 | */ |
dflet | 3:a8c249046181 | 561 | typedef uint8_t SlrxFilterCounterId_t; |
dflet | 3:a8c249046181 | 562 | /* Possible values for SlrxFilterCounterId_t */ |
dflet | 3:a8c249046181 | 563 | #define NO_TRIGGER (0) |
dflet | 3:a8c249046181 | 564 | #define RX_FILTER_COUNTER1 (1) |
dflet | 3:a8c249046181 | 565 | #define RX_FILTER_COUNTER2 (2) |
dflet | 3:a8c249046181 | 566 | #define RX_FILTER_COUNTER3 (3) |
dflet | 3:a8c249046181 | 567 | #define RX_FILTER_COUNTER4 (4) |
dflet | 3:a8c249046181 | 568 | #define RX_FILTER_COUNTER5 (5) |
dflet | 3:a8c249046181 | 569 | #define RX_FILTER_COUNTER6 (6) |
dflet | 3:a8c249046181 | 570 | #define RX_FILTER_COUNTER7 (7) |
dflet | 3:a8c249046181 | 571 | #define RX_FILTER_COUNTER8 (8) |
dflet | 3:a8c249046181 | 572 | #define MAX_RX_FILTER_COUNTER (9) |
dflet | 3:a8c249046181 | 573 | |
dflet | 3:a8c249046181 | 574 | |
dflet | 3:a8c249046181 | 575 | |
dflet | 3:a8c249046181 | 576 | /*! \typedef SlrxFilterActionArgs_t |
dflet | 3:a8c249046181 | 577 | * Possible value for filter action args |
dflet | 3:a8c249046181 | 578 | * |
dflet | 3:a8c249046181 | 579 | */ |
dflet | 3:a8c249046181 | 580 | |
dflet | 3:a8c249046181 | 581 | typedef uint8_t SlrxFilterActionArgs_t; |
dflet | 3:a8c249046181 | 582 | /* Possible values for SlrxFilterActionArgs_t */ |
dflet | 3:a8c249046181 | 583 | #define ACTION_ARG_REG_1_4 (0) |
dflet | 3:a8c249046181 | 584 | /* ! Can be use as counter */ |
dflet | 3:a8c249046181 | 585 | #define ACTION_ARG_TEMPLATE (1) |
dflet | 3:a8c249046181 | 586 | /* ! Can be use as counter */ |
dflet | 3:a8c249046181 | 587 | #define ACTION_ARG_EVENT (2) |
dflet | 3:a8c249046181 | 588 | |
dflet | 3:a8c249046181 | 589 | /* ! GPIO number */ |
dflet | 3:a8c249046181 | 590 | #define ACTION_ARG_GPIO (4) |
dflet | 3:a8c249046181 | 591 | /*! |
dflet | 3:a8c249046181 | 592 | * \def SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS |
dflet | 3:a8c249046181 | 593 | * |
dflet | 3:a8c249046181 | 594 | */ |
dflet | 3:a8c249046181 | 595 | #define SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS (5) |
dflet | 3:a8c249046181 | 596 | |
dflet | 3:a8c249046181 | 597 | |
dflet | 3:a8c249046181 | 598 | |
dflet | 3:a8c249046181 | 599 | |
dflet | 3:a8c249046181 | 600 | /*! \typedef SlrxFilterTrigger_t |
dflet | 3:a8c249046181 | 601 | * The filter trigger, determine when the filter is triggered, |
dflet | 3:a8c249046181 | 602 | * The filter is triggered in the following condition :\n |
dflet | 3:a8c249046181 | 603 | * 1. The filter parent is triggered\n |
dflet | 3:a8c249046181 | 604 | * 2. The requested connection type exists, i.e. wlan_connect\n |
dflet | 3:a8c249046181 | 605 | * 3. The filter role is the same as the system role\n |
dflet | 3:a8c249046181 | 606 | * |
dflet | 3:a8c249046181 | 607 | */ |
dflet | 3:a8c249046181 | 608 | /* -- 12 byte */ |
dflet | 3:a8c249046181 | 609 | typedef struct SlrxFilterTrigger_t { |
dflet | 3:a8c249046181 | 610 | /*! The parent filter ID, this is the way to build filter tree. */ |
dflet | 3:a8c249046181 | 611 | /* NULL value means tree root. |
dflet | 3:a8c249046181 | 612 | */ |
dflet | 3:a8c249046181 | 613 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 614 | SlrxFilterID_t ParentFilterID; |
dflet | 3:a8c249046181 | 615 | /* ! See ::SlrxFilterCounterId_t explanation */ |
dflet | 3:a8c249046181 | 616 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 617 | SlrxFilterCounterId_t Trigger; |
dflet | 3:a8c249046181 | 618 | /* ! See :: SlrxFilterTriggerConnectionStates_t */ |
dflet | 3:a8c249046181 | 619 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 620 | SlrxFilterTriggerConnectionStates_t TriggerArgConnectionState; |
dflet | 3:a8c249046181 | 621 | /* ! See ::SlrxFilterTriggerRoles_t */ |
dflet | 3:a8c249046181 | 622 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 623 | SlrxFilterTriggerRoles_t TriggerArgRoleStatus; |
dflet | 3:a8c249046181 | 624 | /* ! The Trigger arguments are in the same order as the Trigger bit field order. */ |
dflet | 3:a8c249046181 | 625 | /* -- 4 byte */ |
dflet | 3:a8c249046181 | 626 | SlrxFilterDBTriggerArg_t TriggerArg; |
dflet | 3:a8c249046181 | 627 | /** The compare function which will be operate for each bit that is turned on in the ::SlrxFilterTrigger_t.Trigger field, |
dflet | 3:a8c249046181 | 628 | * for example , in case the second bit in the Trigger function is on the second function in the list will be executed. |
dflet | 3:a8c249046181 | 629 | * |
dflet | 3:a8c249046181 | 630 | */ |
dflet | 3:a8c249046181 | 631 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 632 | SlrxTriggerCompareFunction_t TriggerCompareFunction; |
dflet | 3:a8c249046181 | 633 | |
dflet | 3:a8c249046181 | 634 | /* ! padding */ |
dflet | 3:a8c249046181 | 635 | /* -- 3 byte */ |
dflet | 3:a8c249046181 | 636 | uint8_t Padding[3]; |
dflet | 3:a8c249046181 | 637 | } SlrxFilterTrigger_t; |
dflet | 3:a8c249046181 | 638 | |
dflet | 3:a8c249046181 | 639 | /*! \typedef SlrxFilterActionType_t |
dflet | 3:a8c249046181 | 640 | * The actions are executed only if the filter is matched,\n |
dflet | 3:a8c249046181 | 641 | * In case of false match the packet is transfered to the HOST. \n |
dflet | 3:a8c249046181 | 642 | * The action is composed of bit field structure, |
dflet | 3:a8c249046181 | 643 | * up to 2 actions can be defined per filter. |
dflet | 3:a8c249046181 | 644 | * |
dflet | 3:a8c249046181 | 645 | */ |
dflet | 3:a8c249046181 | 646 | #define RX_FILTER_ACTION_NULL (0x0) |
dflet | 3:a8c249046181 | 647 | #define RX_FILTER_ACTION_DROP (0x1) |
dflet | 3:a8c249046181 | 648 | #define RX_FILTER_ACTION_GPIO (0x2) |
dflet | 3:a8c249046181 | 649 | #define RX_FILTER_ACTION_ON_REG_INCREASE (0x4) |
dflet | 3:a8c249046181 | 650 | #define RX_FILTER_ACTION_ON_REG_DECREASE (0x8) |
dflet | 3:a8c249046181 | 651 | #define RX_FILTER_ACTION_ON_REG_RESET (0x10) |
dflet | 3:a8c249046181 | 652 | #define RX_FILTER_ACTION_SEND_TEMPLATE (0x20) /* unsupported */ |
dflet | 3:a8c249046181 | 653 | #define RX_FILTER_ACTION_EVENT_TO_HOST (0x40) /* unsupported */ |
dflet | 3:a8c249046181 | 654 | |
dflet | 3:a8c249046181 | 655 | typedef union SlrxFilterActionType_t { |
dflet | 3:a8c249046181 | 656 | /* struct */ |
dflet | 3:a8c249046181 | 657 | /* { */ |
dflet | 3:a8c249046181 | 658 | /* ! No action to execute the packet is dropped,drop is always on leaf. */ |
dflet | 3:a8c249046181 | 659 | /* ! If not dropped ,The packet is passed to the next filter or in case it is the last filter to the host */ |
dflet | 3:a8c249046181 | 660 | /* uint8_t ActionDrop : 1; */ |
dflet | 3:a8c249046181 | 661 | /* ! Not Supported in the current release */ |
dflet | 3:a8c249046181 | 662 | /* uint8_t ActionGpio : 1; */ |
dflet | 3:a8c249046181 | 663 | /*! action can increase counter registers. |
dflet | 3:a8c249046181 | 664 | * 1 = Increase |
dflet | 3:a8c249046181 | 665 | * 2 = decrease |
dflet | 3:a8c249046181 | 666 | * 3 = reset |
dflet | 3:a8c249046181 | 667 | */ |
dflet | 3:a8c249046181 | 668 | /* uint8_t ActionOnREGIncrease : 1; */ |
dflet | 3:a8c249046181 | 669 | /* uint8_t ActionOnREGDecrease : 1; */ |
dflet | 3:a8c249046181 | 670 | /* uint8_t ActionOnREGReset : 1; */ |
dflet | 3:a8c249046181 | 671 | |
dflet | 3:a8c249046181 | 672 | /* ! Not Supported in the current release */ |
dflet | 3:a8c249046181 | 673 | /* uint8_t ActionSendTemplate : 1; */ |
dflet | 3:a8c249046181 | 674 | /* ! Not Supported in the current release */ |
dflet | 3:a8c249046181 | 675 | /* uint8_t ActionEventToHost: 1; */ |
dflet | 3:a8c249046181 | 676 | /* uint8_t padding: 1; */ |
dflet | 3:a8c249046181 | 677 | /* }; */ |
dflet | 3:a8c249046181 | 678 | |
dflet | 3:a8c249046181 | 679 | uint8_t IntRepresentation; |
dflet | 3:a8c249046181 | 680 | |
dflet | 3:a8c249046181 | 681 | } SlrxFilterActionType_t; |
dflet | 3:a8c249046181 | 682 | |
dflet | 3:a8c249046181 | 683 | /*! \typedef SlrxFilterAction_t |
dflet | 3:a8c249046181 | 684 | * Several actions can be defined,\n |
dflet | 3:a8c249046181 | 685 | * The action is executed in case the filter rule is matched. |
dflet | 3:a8c249046181 | 686 | */ |
dflet | 3:a8c249046181 | 687 | /* -- 8 byte */ |
dflet | 3:a8c249046181 | 688 | typedef struct SlrxFilterAction_t { |
dflet | 3:a8c249046181 | 689 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 690 | /* ! Determine which actions are supported */ |
dflet | 3:a8c249046181 | 691 | SlrxFilterActionType_t ActionType; |
dflet | 3:a8c249046181 | 692 | /* ! Buffer for the action arguments */ |
dflet | 3:a8c249046181 | 693 | /** |
dflet | 3:a8c249046181 | 694 | * <b>location 0</b> - The counter to increase |
dflet | 3:a8c249046181 | 695 | * In case the action is of type "increase" the arg will contain the counter number, |
dflet | 3:a8c249046181 | 696 | * The counter number values are as in ::SlrxFilterCounterId_t.\n |
dflet | 3:a8c249046181 | 697 | * <b>location 1</b> - The template arg.\n |
dflet | 3:a8c249046181 | 698 | * <b>location 2</b> - The event arg.\n |
dflet | 3:a8c249046181 | 699 | * |
dflet | 3:a8c249046181 | 700 | */ |
dflet | 3:a8c249046181 | 701 | /* -- 5 byte */ |
dflet | 3:a8c249046181 | 702 | SlrxFilterActionArg_t ActionArg[SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS]; |
dflet | 3:a8c249046181 | 703 | |
dflet | 3:a8c249046181 | 704 | /* ! Padding */ |
dflet | 3:a8c249046181 | 705 | /* - 2 Bytes */ |
dflet | 3:a8c249046181 | 706 | uint8_t Padding[2]; |
dflet | 3:a8c249046181 | 707 | |
dflet | 3:a8c249046181 | 708 | } SlrxFilterAction_t; |
dflet | 3:a8c249046181 | 709 | |
dflet | 3:a8c249046181 | 710 | |
dflet | 3:a8c249046181 | 711 | /*! \struct _WlanRxFilterOperationCommandBuff_t |
dflet | 3:a8c249046181 | 712 | * The structure is used for the interface HOST NWP.\n |
dflet | 3:a8c249046181 | 713 | * The supported operation : \n |
dflet | 3:a8c249046181 | 714 | * ::ENABLE_DISABLE_RX_FILTER,\n |
dflet | 3:a8c249046181 | 715 | * ::REMOVE_RX_FILTER,\n |
dflet | 3:a8c249046181 | 716 | * |
dflet | 3:a8c249046181 | 717 | */ |
dflet | 3:a8c249046181 | 718 | /* 20 bytes */ |
dflet | 3:a8c249046181 | 719 | typedef struct _WlanRxFilterOperationCommandBuff_t { |
dflet | 3:a8c249046181 | 720 | /* -- 16 bytes */ |
dflet | 3:a8c249046181 | 721 | SlrxFilterIdMask_t FilterIdMask; |
dflet | 3:a8c249046181 | 722 | /* 4 bytes */ |
dflet | 3:a8c249046181 | 723 | uint8_t Padding[4]; |
dflet | 3:a8c249046181 | 724 | } _WlanRxFilterOperationCommandBuff_t; |
dflet | 3:a8c249046181 | 725 | |
dflet | 3:a8c249046181 | 726 | |
dflet | 3:a8c249046181 | 727 | |
dflet | 3:a8c249046181 | 728 | /* -- 56 bytes */ |
dflet | 3:a8c249046181 | 729 | typedef struct _WlanRxFilterUpdateArgsCommandBuff_t { |
dflet | 3:a8c249046181 | 730 | /* -- 1 bytes */ |
dflet | 3:a8c249046181 | 731 | uint8_t FilterId; |
dflet | 3:a8c249046181 | 732 | |
dflet | 3:a8c249046181 | 733 | /* -- 1 bytes */ |
dflet | 3:a8c249046181 | 734 | /* ! the args representation */ |
dflet | 3:a8c249046181 | 735 | uint8_t BinaryRepresentation; |
dflet | 3:a8c249046181 | 736 | |
dflet | 3:a8c249046181 | 737 | /* -- 52 byte */ |
dflet | 3:a8c249046181 | 738 | SlrxFilterRuleHeaderArgsAndMask_t FilterRuleHeaderArgsAndMask; |
dflet | 3:a8c249046181 | 739 | |
dflet | 3:a8c249046181 | 740 | /* -- 2 bytes */ |
dflet | 3:a8c249046181 | 741 | uint8_t Padding[2]; |
dflet | 3:a8c249046181 | 742 | } _WlanRxFilterUpdateArgsCommandBuff_t; |
dflet | 3:a8c249046181 | 743 | |
dflet | 3:a8c249046181 | 744 | |
dflet | 3:a8c249046181 | 745 | /*! \typedef _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t |
dflet | 3:a8c249046181 | 746 | * The structure is used for the interface HOST NWP.\n |
dflet | 3:a8c249046181 | 747 | * |
dflet | 3:a8c249046181 | 748 | */ |
dflet | 3:a8c249046181 | 749 | /* -- 16 bytes */ |
dflet | 3:a8c249046181 | 750 | typedef struct _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t { |
dflet | 3:a8c249046181 | 751 | |
dflet | 3:a8c249046181 | 752 | /* ! the filter set bit map */ |
dflet | 3:a8c249046181 | 753 | /* -- 16 bytes */ |
dflet | 3:a8c249046181 | 754 | SlrxFilterIdMask_t FilterIdMask; |
dflet | 3:a8c249046181 | 755 | |
dflet | 3:a8c249046181 | 756 | } _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t; |
dflet | 3:a8c249046181 | 757 | |
dflet | 3:a8c249046181 | 758 | |
dflet | 3:a8c249046181 | 759 | /*! \struct _WlanRxFilterPrePreparedFiltersCommandBuff_t |
dflet | 3:a8c249046181 | 760 | * The function enables to perform operations on pre-prepared filters |
dflet | 3:a8c249046181 | 761 | * |
dflet | 3:a8c249046181 | 762 | */ |
dflet | 3:a8c249046181 | 763 | typedef struct _WlanRxFilterPrePreparedFiltersCommandBuff_t { |
dflet | 3:a8c249046181 | 764 | /* ! the filter set bit map */ |
dflet | 3:a8c249046181 | 765 | /* -- 4 bytes */ |
dflet | 3:a8c249046181 | 766 | SlrxFilterPrePreparedFiltersMask_t FilterPrePreparedFiltersMask; |
dflet | 3:a8c249046181 | 767 | |
dflet | 3:a8c249046181 | 768 | } _WlanRxFilterPrePreparedFiltersCommandBuff_t; |
dflet | 3:a8c249046181 | 769 | |
dflet | 3:a8c249046181 | 770 | |
dflet | 3:a8c249046181 | 771 | /*! \typedef sl_protocol_WlanRxFilterPrePreparedFiltersCommandResponseBuff_t |
dflet | 3:a8c249046181 | 772 | * |
dflet | 3:a8c249046181 | 773 | */ |
dflet | 3:a8c249046181 | 774 | /*-- 4 bytes */ |
dflet | 3:a8c249046181 | 775 | typedef struct _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t { |
dflet | 3:a8c249046181 | 776 | /* -- 4 bytes */ |
dflet | 3:a8c249046181 | 777 | /* ! the filter set bit map */ |
dflet | 3:a8c249046181 | 778 | SlrxFilterPrePreparedFiltersMask_t FilterPrePreparedFiltersMask; |
dflet | 3:a8c249046181 | 779 | |
dflet | 3:a8c249046181 | 780 | } _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t; |
dflet | 3:a8c249046181 | 781 | |
dflet | 3:a8c249046181 | 782 | |
dflet | 3:a8c249046181 | 783 | |
dflet | 3:a8c249046181 | 784 | typedef uint8_t SLrxFilterOperation_t; |
dflet | 3:a8c249046181 | 785 | #define SL_ENABLE_DISABLE_RX_FILTER (0) |
dflet | 3:a8c249046181 | 786 | #define SL_REMOVE_RX_FILTER (1) |
dflet | 3:a8c249046181 | 787 | #define SL_STORE_RX_FILTERS (2) |
dflet | 3:a8c249046181 | 788 | #define SL_UPDATE_RX_FILTER_ARGS (3) |
dflet | 3:a8c249046181 | 789 | #define SL_FILTER_RETRIEVE_ENABLE_STATE (4) |
dflet | 3:a8c249046181 | 790 | #define SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE (5) |
dflet | 3:a8c249046181 | 791 | #define SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE (6) |
dflet | 3:a8c249046181 | 792 | |
dflet | 3:a8c249046181 | 793 | |
dflet | 3:a8c249046181 | 794 | /* Bit manipulation for 8 bit */ |
dflet | 3:a8c249046181 | 795 | #define ISBITSET8(x,i) ((x[i>>3] & (0x80>>(i&7)))!=0) /* < Is bit set, 8 bit unsigned numbers = x , location = i */ |
dflet | 3:a8c249046181 | 796 | #define SETBIT8(x,i) x[i>>3]|=(0x80>>(i&7)); /* < Set bit,8 bit unsigned numbers = x , location = i */ |
dflet | 3:a8c249046181 | 797 | #define CLEARBIT8(x,i) x[i>>3]&=(0x80>>(i&7))^0xFF; /* < Clear bit,8 bit unsigned numbers = x , location = i */ |
dflet | 3:a8c249046181 | 798 | |
dflet | 3:a8c249046181 | 799 | namespace mbed_cc3100 { |
dflet | 3:a8c249046181 | 800 | |
dflet | 3:a8c249046181 | 801 | /* ******************************************************************************/ |
dflet | 3:a8c249046181 | 802 | /* RX filters - Start */ |
dflet | 3:a8c249046181 | 803 | /* ******************************************************************************/ |
dflet | 3:a8c249046181 | 804 | /* -- 80 bytes */ |
dflet | 3:a8c249046181 | 805 | typedef struct _WlanRxFilterAddCommand_t { |
dflet | 3:a8c249046181 | 806 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 807 | SlrxFilterRuleType_t RuleType; |
dflet | 3:a8c249046181 | 808 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 809 | SlrxFilterFlags_t FilterFlags; |
dflet | 3:a8c249046181 | 810 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 811 | SlrxFilterID_t FilterId; |
dflet | 3:a8c249046181 | 812 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 813 | uint8_t Padding; |
dflet | 3:a8c249046181 | 814 | /* -- 56 byte */ |
dflet | 3:a8c249046181 | 815 | SlrxFilterRule_t Rule; |
dflet | 3:a8c249046181 | 816 | /* -- 12 byte ( 3 padding ) */ |
dflet | 3:a8c249046181 | 817 | SlrxFilterTrigger_t Trigger; |
dflet | 3:a8c249046181 | 818 | /* -- 8 byte */ |
dflet | 3:a8c249046181 | 819 | SlrxFilterAction_t Action; |
dflet | 3:a8c249046181 | 820 | } _WlanRxFilterAddCommand_t; |
dflet | 3:a8c249046181 | 821 | |
dflet | 3:a8c249046181 | 822 | |
dflet | 3:a8c249046181 | 823 | |
dflet | 3:a8c249046181 | 824 | /* -- 4 bytes */ |
dflet | 3:a8c249046181 | 825 | typedef struct l_WlanRxFilterAddCommandReponse_t { |
dflet | 3:a8c249046181 | 826 | /* -- 1 byte */ |
dflet | 3:a8c249046181 | 827 | SlrxFilterID_t FilterId; |
dflet | 3:a8c249046181 | 828 | /* -- 1 Byte */ |
dflet | 3:a8c249046181 | 829 | uint8_t Status; |
dflet | 3:a8c249046181 | 830 | /* -- 2 byte */ |
dflet | 3:a8c249046181 | 831 | uint8_t Padding[2]; |
dflet | 3:a8c249046181 | 832 | |
dflet | 3:a8c249046181 | 833 | } _WlanRxFilterAddCommandReponse_t; |
dflet | 3:a8c249046181 | 834 | |
dflet | 3:a8c249046181 | 835 | |
dflet | 3:a8c249046181 | 836 | |
dflet | 3:a8c249046181 | 837 | /* |
dflet | 3:a8c249046181 | 838 | * \struct _WlanRxFilterSetCommand_t |
dflet | 3:a8c249046181 | 839 | */ |
dflet | 3:a8c249046181 | 840 | typedef struct _WlanRxFilterSetCommand_t { |
dflet | 3:a8c249046181 | 841 | uint16_t InputBufferLength; |
dflet | 3:a8c249046181 | 842 | /* 1 byte */ |
dflet | 3:a8c249046181 | 843 | SLrxFilterOperation_t RxFilterOperation; |
dflet | 3:a8c249046181 | 844 | uint8_t Padding[1]; |
dflet | 3:a8c249046181 | 845 | } _WlanRxFilterSetCommand_t; |
dflet | 3:a8c249046181 | 846 | |
dflet | 3:a8c249046181 | 847 | /** |
dflet | 3:a8c249046181 | 848 | * \struct _WlanRxFilterSetCommandReponse_t |
dflet | 3:a8c249046181 | 849 | */ |
dflet | 3:a8c249046181 | 850 | typedef struct _WlanRxFilterSetCommandReponse_t { |
dflet | 3:a8c249046181 | 851 | /* 1 byte */ |
dflet | 3:a8c249046181 | 852 | uint8_t Status; |
dflet | 3:a8c249046181 | 853 | /* 3 bytes */ |
dflet | 3:a8c249046181 | 854 | uint8_t Padding[3]; |
dflet | 3:a8c249046181 | 855 | |
dflet | 3:a8c249046181 | 856 | } _WlanRxFilterSetCommandReponse_t; |
dflet | 3:a8c249046181 | 857 | |
dflet | 3:a8c249046181 | 858 | /** |
dflet | 3:a8c249046181 | 859 | * \struct _WlanRxFilterGetCommand_t |
dflet | 3:a8c249046181 | 860 | */ |
dflet | 3:a8c249046181 | 861 | typedef struct _WlanRxFilterGetCommand_t { |
dflet | 3:a8c249046181 | 862 | uint16_t OutputBufferLength; |
dflet | 3:a8c249046181 | 863 | /* 1 byte */ |
dflet | 3:a8c249046181 | 864 | SLrxFilterOperation_t RxFilterOperation; |
dflet | 3:a8c249046181 | 865 | uint8_t Padding[1]; |
dflet | 3:a8c249046181 | 866 | } _WlanRxFilterGetCommand_t; |
dflet | 3:a8c249046181 | 867 | |
dflet | 3:a8c249046181 | 868 | /** |
dflet | 3:a8c249046181 | 869 | * \struct _WlanRxFilterGetCommandReponse_t |
dflet | 3:a8c249046181 | 870 | */ |
dflet | 3:a8c249046181 | 871 | typedef struct _WlanRxFilterGetCommandReponse_t { |
dflet | 3:a8c249046181 | 872 | /* 1 byte */ |
dflet | 3:a8c249046181 | 873 | uint8_t Status; |
dflet | 3:a8c249046181 | 874 | /* 1 bytes */ |
dflet | 3:a8c249046181 | 875 | uint8_t Padding; |
dflet | 3:a8c249046181 | 876 | /* 2 byte */ |
dflet | 3:a8c249046181 | 877 | uint16_t OutputBufferLength; |
dflet | 3:a8c249046181 | 878 | |
dflet | 3:a8c249046181 | 879 | } _WlanRxFilterGetCommandReponse_t; |
dflet | 3:a8c249046181 | 880 | |
dflet | 3:a8c249046181 | 881 | |
dflet | 3:a8c249046181 | 882 | |
dflet | 3:a8c249046181 | 883 | /* ******************************************************************************/ |
dflet | 3:a8c249046181 | 884 | /* RX filters -- End */ |
dflet | 3:a8c249046181 | 885 | /* ******************************************************************************/ |
dflet | 3:a8c249046181 | 886 | |
dflet | 3:a8c249046181 | 887 | class cc3100_driver; |
dflet | 3:a8c249046181 | 888 | |
dflet | 3:a8c249046181 | 889 | class cc3100_wlan_rx_filters |
dflet | 3:a8c249046181 | 890 | { |
dflet | 3:a8c249046181 | 891 | |
dflet | 3:a8c249046181 | 892 | public: |
dflet | 3:a8c249046181 | 893 | |
dflet | 3:a8c249046181 | 894 | cc3100_wlan_rx_filters(cc3100_driver &driver); |
dflet | 3:a8c249046181 | 895 | |
dflet | 3:a8c249046181 | 896 | ~cc3100_wlan_rx_filters(); |
dflet | 3:a8c249046181 | 897 | |
dflet | 3:a8c249046181 | 898 | |
dflet | 3:a8c249046181 | 899 | /*********************************************************************************************/ |
dflet | 3:a8c249046181 | 900 | /* Function prototypes */ |
dflet | 3:a8c249046181 | 901 | /*********************************************************************************************/ |
dflet | 3:a8c249046181 | 902 | |
dflet | 3:a8c249046181 | 903 | /*! |
dflet | 3:a8c249046181 | 904 | |
dflet | 3:a8c249046181 | 905 | \addtogroup wlan |
dflet | 3:a8c249046181 | 906 | @{ |
dflet | 3:a8c249046181 | 907 | |
dflet | 3:a8c249046181 | 908 | */ |
dflet | 3:a8c249046181 | 909 | |
dflet | 3:a8c249046181 | 910 | |
dflet | 3:a8c249046181 | 911 | /*! |
dflet | 3:a8c249046181 | 912 | \brief Adds new filter rule to the system |
dflet | 3:a8c249046181 | 913 | |
dflet | 3:a8c249046181 | 914 | \param[in] RuleType The rule type |
dflet | 3:a8c249046181 | 915 | \param[in] FilterFlags Flags which set the type of header rule Args and sets the persistent flag |
dflet | 3:a8c249046181 | 916 | \param[in] pRule Determine the filter rule logic |
dflet | 3:a8c249046181 | 917 | \param[in] pTrigger Determine when the rule is triggered also sets rule parent. |
dflet | 3:a8c249046181 | 918 | \param[in] pAction Sets the action to be executed in case the match functions pass |
dflet | 3:a8c249046181 | 919 | \param[out] pFilterId The filterId which was created |
dflet | 3:a8c249046181 | 920 | |
dflet | 3:a8c249046181 | 921 | \return On success, zero is returned. Otherwise error code is returned |
dflet | 3:a8c249046181 | 922 | */ |
dflet | 3:a8c249046181 | 923 | #if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd) |
dflet | 3:a8c249046181 | 924 | SlrxFilterID_t sl_WlanRxFilterAdd( SlrxFilterRuleType_t RuleType, |
dflet | 3:a8c249046181 | 925 | SlrxFilterFlags_t FilterFlags, |
dflet | 3:a8c249046181 | 926 | const SlrxFilterRule_t* const Rule, |
dflet | 3:a8c249046181 | 927 | const SlrxFilterTrigger_t* const Trigger, |
dflet | 3:a8c249046181 | 928 | const SlrxFilterAction_t* const Action, |
dflet | 3:a8c249046181 | 929 | SlrxFilterID_t* pFilterId); |
dflet | 3:a8c249046181 | 930 | |
dflet | 3:a8c249046181 | 931 | #endif |
dflet | 3:a8c249046181 | 932 | |
dflet | 3:a8c249046181 | 933 | |
dflet | 3:a8c249046181 | 934 | |
dflet | 3:a8c249046181 | 935 | |
dflet | 3:a8c249046181 | 936 | |
dflet | 3:a8c249046181 | 937 | /*! |
dflet | 3:a8c249046181 | 938 | \brief Sets parameters to Rx filters |
dflet | 3:a8c249046181 | 939 | |
dflet | 3:a8c249046181 | 940 | \param[in] RxFilterOperation |
dflet | 3:a8c249046181 | 941 | possible operations : |
dflet | 3:a8c249046181 | 942 | - SL_ENABLE_DISABLE_RX_FILTER - Enables\disables filter in a filter list |
dflet | 3:a8c249046181 | 943 | - SL_REMOVE_RX_FILTER - Removes filter from memory ( to remove from flash call SL_STORE_RX_FILTERS after this command) |
dflet | 3:a8c249046181 | 944 | - SL_STORE_RX_FILTERS - Save the filters for persistent |
dflet | 3:a8c249046181 | 945 | - SL_UPDATE_RX_FILTER_ARGS - Update the arguments of existing filter |
dflet | 3:a8c249046181 | 946 | - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE - Change the default creation of the pre-prepared filters |
dflet | 3:a8c249046181 | 947 | |
dflet | 3:a8c249046181 | 948 | \param[in] pInputBuffer options: |
dflet | 3:a8c249046181 | 949 | The buffer input is _WlanRxFilterOperationCommandBuff_t: |
dflet | 3:a8c249046181 | 950 | - SL_ENABLE_DISABLE_RX_FILTER |
dflet | 3:a8c249046181 | 951 | - SL_REMOVE_RX_FILTER |
dflet | 3:a8c249046181 | 952 | - SL_STORE_RX_FILTERS |
dflet | 3:a8c249046181 | 953 | The buffer input is _WlanRxFilterUpdateArgsCommandBuff_t: |
dflet | 3:a8c249046181 | 954 | - SL_UPDATE_RX_FILTER_ARGS |
dflet | 3:a8c249046181 | 955 | The buffer input is _WlanRxFilterPrePreparedFiltersCommandBuff_t: |
dflet | 3:a8c249046181 | 956 | - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE |
dflet | 3:a8c249046181 | 957 | |
dflet | 3:a8c249046181 | 958 | \param[in] InputbufferLength The length in byte of the input buffer |
dflet | 3:a8c249046181 | 959 | |
dflet | 3:a8c249046181 | 960 | \return On success, zero is returned. Otherwise error code is returned |
dflet | 3:a8c249046181 | 961 | */ |
dflet | 3:a8c249046181 | 962 | |
dflet | 3:a8c249046181 | 963 | #if _SL_INCLUDE_FUNC(sl_WlanRxFilterSet) |
dflet | 3:a8c249046181 | 964 | int16_t sl_WlanRxFilterSet( const SLrxFilterOperation_t RxFilterOperation, |
dflet | 3:a8c249046181 | 965 | const uint8_t* const pInputBuffer, |
dflet | 3:a8c249046181 | 966 | uint16_t InputbufferLength); |
dflet | 3:a8c249046181 | 967 | #endif |
dflet | 3:a8c249046181 | 968 | |
dflet | 3:a8c249046181 | 969 | /*! |
dflet | 3:a8c249046181 | 970 | \brief Gets parameters of Rx filters |
dflet | 3:a8c249046181 | 971 | |
dflet | 3:a8c249046181 | 972 | \param[in] RxFilterOperation |
dflet | 3:a8c249046181 | 973 | possible operations : |
dflet | 3:a8c249046181 | 974 | - SL_FILTER_RETRIEVE_ENABLE_STATE - Retrieves the enable disable status |
dflet | 3:a8c249046181 | 975 | - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE - Retrieves the pre-prepared filters creation status |
dflet | 3:a8c249046181 | 976 | |
dflet | 3:a8c249046181 | 977 | \param[in] pOutputBuffer |
dflet | 3:a8c249046181 | 978 | The buffer input is _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t: |
dflet | 3:a8c249046181 | 979 | - SL_FILTER_RETRIEVE_ENABLE_STATE |
dflet | 3:a8c249046181 | 980 | The buffer input is _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t: |
dflet | 3:a8c249046181 | 981 | - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE |
dflet | 3:a8c249046181 | 982 | |
dflet | 3:a8c249046181 | 983 | \param[in] OutputbufferLength The length in byte of the output buffer |
dflet | 3:a8c249046181 | 984 | |
dflet | 3:a8c249046181 | 985 | \return On success, zero is returned. Otherwise error code is returned |
dflet | 3:a8c249046181 | 986 | */ |
dflet | 3:a8c249046181 | 987 | |
dflet | 3:a8c249046181 | 988 | #if _SL_INCLUDE_FUNC(sl_WlanRxFilterGet) |
dflet | 3:a8c249046181 | 989 | int16_t sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation, |
dflet | 3:a8c249046181 | 990 | uint8_t* pOutputBuffer, |
dflet | 3:a8c249046181 | 991 | uint16_t OutputbufferLength); |
dflet | 3:a8c249046181 | 992 | #endif |
dflet | 3:a8c249046181 | 993 | |
dflet | 3:a8c249046181 | 994 | private: |
dflet | 3:a8c249046181 | 995 | |
dflet | 3:a8c249046181 | 996 | cc3100_driver &_driver; |
dflet | 3:a8c249046181 | 997 | |
dflet | 3:a8c249046181 | 998 | |
dflet | 3:a8c249046181 | 999 | /*! |
dflet | 3:a8c249046181 | 1000 | |
dflet | 3:a8c249046181 | 1001 | Close the Doxygen group. |
dflet | 3:a8c249046181 | 1002 | @} |
dflet | 3:a8c249046181 | 1003 | |
dflet | 3:a8c249046181 | 1004 | */ |
dflet | 3:a8c249046181 | 1005 | };//class |
dflet | 3:a8c249046181 | 1006 | |
dflet | 3:a8c249046181 | 1007 | }//namespace mbed_cc3100 |
dflet | 3:a8c249046181 | 1008 | |
dflet | 3:a8c249046181 | 1009 | #endif /* RX_FILTERS_PREPROCESSOR_CLI_IF_H_ */ |
dflet | 3:a8c249046181 | 1010 | |
dflet | 3:a8c249046181 | 1011 | |
dflet | 3:a8c249046181 | 1012 |