TI's CC3100 host driver and demo. Experimental and a work in progress.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cc3100_wlan_rx_filters.h Source File

cc3100_wlan_rx_filters.h

00001 /*
00002  * wlan_rx_filters.h - CC31xx/CC32xx Host Driver Implementation
00003  *
00004  * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
00005  * 
00006  * 
00007  *  Redistribution and use in source and binary forms, with or without 
00008  *  modification, are permitted provided that the following conditions 
00009  *  are met:
00010  *
00011  *    Redistributions of source code must retain the above copyright 
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  *    Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in the 
00016  *    documentation and/or other materials provided with the   
00017  *    distribution.
00018  *
00019  *    Neither the name of Texas Instruments Incorporated nor the names of
00020  *    its contributors may be used to endorse or promote products derived
00021  *    from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00026  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
00027  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
00028  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00029  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00030  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00031  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00032  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00033  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  *
00035 */
00036 
00037 #ifndef RX_FILTERS_PREPROCESSOR_CLI_IF_H_
00038 #define RX_FILTERS_PREPROCESSOR_CLI_IF_H_
00039 
00040 
00041 /*****************************************************************************/
00042 /* Include files                                                             */
00043 /*****************************************************************************/
00044 #include "cc3100_simplelink.h"
00045 
00046 #ifdef  __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 
00051 /*****************************************************************************/
00052 /* Macro declarations                                                                        */
00053 /*****************************************************************************/
00054 
00055 /*!
00056  * \def SL_RX_FILTER_MAX_FILTERS
00057  *  The Max number of filters for 64 filters
00058  */
00059 #define SL_RX_FILTER_MAX_FILTERS 64
00060 
00061 /*!
00062  * \def SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS
00063  * The Max number of software filters
00064  */
00065 #define SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS      (32)
00066 /*!
00067  * \def SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00068  *
00069  */
00070 #define SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS          (2)
00071 /*!
00072  * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS
00073  *
00074  */
00075 #define SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS         (2)
00076 /*!
00077  * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS
00078  *
00079  */
00080 #define SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS       (2)
00081 /*!
00082  * \def SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH
00083  *
00084  */
00085 #define SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH      (32)
00086 
00087 
00088 /*  List of possible error numbers */
00089 #define RXFL_OK                                                (0) /*  O.K */
00090 #define RXFL_OUTPUT_OR_INPUT_BUFFER_LENGTH_TOO_SMALL           (76) /* ! The output buffer length is smaller than required for that operation */
00091 #define RXFL_DEPENDENT_FILTER_SOFTWARE_FILTER_NOT_FIT          (75) /* Node filter can't be child of software filter and vice_versa */
00092 #define RXFL_DEPENDENCY_IS_NOT_PERSISTENT                      (74) /*  Dependency filter is not persistent */ 
00093 #define RXFL_SYSTEM_STATE_NOT_SUPPORTED_FOR_THIS_FILTER        (72) /*  System state is not supported */
00094 #define RXFL_TRIGGER_USE_REG5_TO_REG8                          (71) /*  Only counters 5 - 8 are allowed, for Tigger */
00095 #define RXFL_TRIGGER_USE_REG1_TO_REG4                          (70) /*  Only counters 1 - 4 are allowed, for trigger */
00096 #define RXFL_ACTION_USE_REG5_TO_REG8                           (69) /*  Only counters 5 - 8 are allowed, for action */
00097 #define RXFL_ACTION_USE_REG1_TO_REG4                           (68) /*  Only counters 1 - 4 are allowed, for action */
00098 #define RXFL_FIELD_SUPPORT_ONLY_EQUAL_AND_NOTEQUAL             (67) /*  Rule compare function Id is out of range */
00099 #define RXFL_WRONG_MULTICAST_BROADCAST_ADDRESS                 (66) /*  The address should be of type mutlicast or broadcast */
00100 #define RXFL_THE_FILTER_IS_NOT_OF_HEADER_TYPE                  (65) /*  The filter should be of header type */
00101 #define RXFL_WRONG_COMPARE_FUNC_FOR_BROADCAST_ADDRESS          (64) /*  The compare funcion is not suitable for broadcast address */
00102 #define RXFL_WRONG_MULTICAST_ADDRESS                           (63) /*  The address should be of muticast type */
00103 #define RXFL_DEPENDENT_FILTER_IS_NOT_PERSISTENT                (62) /*  The dependency filter is not persistent */
00104 #define RXFL_DEPENDENT_FILTER_IS_NOT_ENABLED                   (61) /*  The dependency filter is not enabled */
00105 #define RXFL_FILTER_HAS_CHILDS                                 (60) /*  The filter has childs and can't be removed */
00106 #define RXFL_CHILD_IS_ENABLED                                  (59) /*  Can't disable filter while the child is enabled */
00107 #define RXFL_DEPENDENCY_IS_DISABLED                            (58) /*  Can't enable filetr in case its depndency filter is disabled */
00108 #define RXFL_NUMBER_OF_CONNECTION_POINTS_EXCEEDED              (52) /*  Number of connection points exceeded */
00109 #define RXFL_DEPENDENT_FILTER_DEPENDENCY_ACTION_IS_DROP        (51) /*  The dependent filter has Drop action, thus the filter can't be created */
00110 #define RXFL_FILTER_DO_NOT_EXISTS                              (50) /*  The filter doesn't exists */
00111 #define RXFL_DEPEDENCY_NOT_ON_THE_SAME_LAYER                   (49) /*  The filter and its dependency must be on the same layer */
00112 #define RXFL_NUMBER_OF_ARGS_EXCEEDED                           (48) /*  Number of arguments excceded */
00113 #define RXFL_ACTION_NO_REG_NUMBER                              (47) /*  Action require counter number */
00114 #define RXFL_DEPENDENT_FILTER_LAYER_DO_NOT_FIT                 (46) /*  the filter and its dependency should be from the same layer */
00115 #define RXFL_DEPENDENT_FILTER_SYSTEM_STATE_DO_NOT_FIT          (45) /*  The filter and its dependency system state don't fit  */
00116 #define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_2                   (44) /*  The parent filter don't exist  */
00117 #define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_1                   (43) /*  The parent filter is null */
00118 #define RXFL_RULE_HEADER_ACTION_TYPE_NOT_SUPPORTED             (42) /*  The action type is not supported */
00119 #define RXFL_RULE_HEADER_TRIGGER_COMPARE_FUNC_OUT_OF_RANGE     (41) /*  The Trigger comparision function is out of range */
00120 #define RXFL_RULE_HEADER_TRIGGER_OUT_OF_RANGE                  (40) /*  The Trigger is out of range */
00121 #define RXFL_RULE_HEADER_COMPARE_FUNC_OUT_OF_RANGE             (39) /*  The rule compare function is out of range */
00122 #define RXFL_FRAME_TYPE_NOT_SUPPORTED                          (38) /*  ASCII frame type string is illegal */
00123 #define RXFL_RULE_FIELD_ID_NOT_SUPPORTED                       (37) /*  Rule field ID is out of range */
00124 #define RXFL_RULE_HEADER_FIELD_ID_ASCII_NOT_SUPPORTED          (36) /*  This ASCII field ID is not supported */
00125 #define RXFL_RULE_HEADER_NOT_SUPPORTED                         (35) /*  The header rule is not supported on current release */
00126 #define RXFL_RULE_HEADER_OUT_OF_RANGE                          (34) /*  The header rule is out of range */
00127 #define RXFL_RULE_HEADER_COMBINATION_OPERATOR_OUT_OF_RANGE     (33) /*  Combination function Id is out of ramge */
00128 #define RXFL_RULE_HEADER_FIELD_ID_OUT_OF_RANGE                 (32) /*  rule field Id is out of range */
00129 #define RXFL_UPDATE_NOT_SUPPORTED                              (31) /*  Update not supported */
00130 #define RXFL_NO_FILTERS_ARE_DEFINED                            (24) /*  No filters are defined in the system */
00131 #define RXFL_NUMBER_OF_FILTER_EXCEEDED                         (23) /*  Number of max filters excceded */
00132 
00133 
00134 /******************************************************************************/
00135 /* Type declarations                                                                         */
00136 /******************************************************************************/
00137 
00138 /*!
00139 
00140 
00141  * \typedef SlrxFilterID_t
00142  * Unique filter ID which is allocated by the system , negative number means error
00143  */
00144 typedef  _i8    SlrxFilterID_t;
00145 
00146 
00147 /*!
00148  * \typedef SlrxFilterCompareMask_t
00149  * The mask is used for the rule comparison function
00150  */
00151 typedef _u8   SlrxFilterCompareMask_t;
00152 
00153 /*!
00154  * \typedef SlrxFilterIdMask_t
00155  *  Representation of filters Id as a bit field
00156  *  The bit field is used to declare which filters are involved
00157  *  in operation. Number of filter can be up to 128 filters. i.e. 128 bits are needed.
00158  *  On the current release, up to 64 filters can be defined.
00159  */
00160 typedef _u8   SlrxFilterIdMask_t[128/8];
00161 
00162 /*!
00163  * \typedef SlrxFilterPrePreparedFilters_t
00164  *  Describes the supported software filter sets,
00165  */
00166 typedef _u8  SlrxFilterPrePreparedFilters_t;
00167 #define SL_ARP_AUTO_REPLY_PRE_PREPARED_FILTERS       (0)
00168 #define SL_MULTICASTSIPV4_DROP_PREPREPARED_FILTERS   (1)
00169 #define SL_MULTICASTSIPV6_DROP_PREPREPARED_FILTERS   (2)
00170 #define SL_MULTICASTSWIFI_DROP_PREPREPARED_FILTERS   (3)
00171 
00172 
00173 
00174 /*!
00175  * \typedef SlrxFilterPrePreparedFiltersMask_t
00176  *  Describes the supported software filter sets,
00177  *  each bit represents different software filter set
00178  *  The filter sets are defined at SlrxFilterPrePreparedFilters_t
00179  */
00180 typedef _u8   SlrxFilterPrePreparedFiltersMask_t[SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS/8];
00181 
00182 
00183 /*! \typedef SlrxFilterRegxPattern_t
00184  * The struct contains the regular expression pattern which is used in case of payload rule.
00185  * Not supported in the current release
00186  */
00187 typedef struct SlrxFilterRegxPattern_t
00188 {
00189     _u8 x[SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH];
00190 }SlrxFilterRegxPattern_t;
00191 
00192 
00193 /*! \typedef SlrxFilterAsciiArg_t
00194  * The buffer is used to provide container for ASCII argument, which may be used in case of HEADER rule.
00195  * example for ASCII argument can be : IP = 256.0.67.1
00196  */
00197 typedef _u8 SlrxFilterAsciiArg_t;
00198 
00199 
00200 /*! \typedef SlrxFilterBinaryArg_t
00201  * The buffer provides container for binary argument, which  may be used in case of HEADER rule
00202  */
00203 typedef _u8   SlrxFilterBinaryArg_t ;
00204 
00205 
00206 /*! \typedef SlrxFilterActionArg_t
00207  *  Provides container for the filter action argument.
00208  *  for example: in case action is to send automatic response , the argument is the template to be used for the automatic response.
00209  *
00210  *
00211  */
00212 typedef  _u8 SlrxFilterActionArg_t ;
00213 
00214 
00215 
00216 /*! \typedef SlrxFilterOffset_t
00217  * The offset relative to the packet payload start location.
00218  * Not supported on current release
00219  */
00220 typedef _u32   SlrxFilterOffset_t;
00221 
00222 
00223 
00224 /*! \typedef SlrxFilterRuleType_t
00225  * Enumerates the different filter types.
00226  * On the current release only HEADER and COMBINATION are supported.
00227  */
00228 typedef _u8 SlrxFilterRuleType_t;
00229 /* possible values for SlrxFilterRuleType_t */
00230 #define HEADER                    (0)
00231 #define COMBINATION               (1)
00232 #define EXACT_PATTERN             (2)
00233 #define LIKELIHOOD_PATTERN        (3)
00234 #define ALWAYS_TRUE               (4)
00235 #define NUM_OF_FILTER_TYPES       (5)
00236 
00237 
00238 /*! \typedef SlrxFilterFlags_t
00239  * Bit field which sets the behaviour of the RX filter
00240  *
00241  */
00242 
00243 #define RX_FILTER_BINARY          (0x1)
00244 #define RX_FILTER_PERSISTENT      (0x8)
00245 #define RX_FILTER_ENABLE          (0x10)
00246 
00247 typedef union SlrxFilterFlags_t
00248 {
00249 
00250     /* struct
00251     { */
00252         /*!
00253          *  The filter argument can be set as binary argument or ASCII arguments.
00254          *  When the bit is on the argument are binary.
00255          */
00256         /* _u8 Binary: 1; */
00257         /*!
00258          * 
00259          */
00260         /* _u8 AutoSort : 1; */
00261         /*!
00262          * 
00263          */
00264         /* _u8 AutoFaultDetect : 1; */
00265         /*!
00266          *  When the bit is on it means the the node is enabled .
00267         */
00268         /* _u8 Enabled : 1; */
00269         /* _u8 padding : 3; */
00270     /*
00271     };*/
00272 
00273     _u8 IntRepresentation;
00274 
00275 }SlrxFilterFlags_t;
00276 
00277 /*! \typedef SlrxFilterCompareFunction_t
00278  * Used as comparison function for the header type arguments
00279  *
00280  */
00281 typedef _u8 SlrxFilterCompareFunction_t;
00282 /* Possible values for SlrxFilterCompareFunction_t */
00283 #define COMPARE_FUNC_IN_BETWEEN                 (0)
00284 #define COMPARE_FUNC_EQUAL                      (1)
00285 #define COMPARE_FUNC_NOT_EQUAL_TO               (2)
00286 #define COMPARE_FUNC_NOT_IN_BETWEEN             (3)
00287 #define COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4)
00288 
00289 /*! \typedef SlrxFilterCompareFunction_t
00290  * Used as comparison function for the header type arguments
00291  *
00292  */
00293 typedef _u8 SlrxTriggerCompareFunction_t;
00294 /* Possible values for SlrxTriggerCompareFunction_t */
00295 #define TRIGGER_COMPARE_FUNC_EQUAL              (0)
00296 /*   arg1 == protocolVal ,not supported in current release */
00297 #define TRIGGER_COMPARE_FUNC_NOT_EQUAL_TO       (1)
00298 /*   arg1 == protocolVal */
00299 #define TRIGGER_COMPARE_FUNC_SMALLER_THAN       (2)
00300 /*   arg1 == protocolVal */
00301 #define TRIGGER_COMPARE_FUNC_BIGGER_THAN        (3)
00302 /* definition */
00303 #define TRIGGER_COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4)
00304 
00305 
00306 /*! \typedef SlrxFilterHdrField_t
00307  * Provides list of possible header types which may be defined as part of the rule
00308  *
00309  */
00310 typedef _u8 SlrxFilterHdrField_t;
00311 /* Possible values for SlrxFilterHdrField_t */
00312 #define NULL_FIELD_ID_TYPE           (0)
00313 /* 802.11 control\data\management */
00314 #define FRAME_TYPE_FIELD             (1)
00315 /*  802.11 beacon\probe\.. */
00316 #define FRAME_SUBTYPE_FIELD          (2)
00317  /*  802.11 bssid type */
00318 #define BSSID_FIELD                  (3)
00319  /* */
00320 #define MAC_SRC_ADDRESS_FIELD        (4)
00321  /* */
00322 #define MAC_DST_ADDRESS_FIELD        (5)
00323 /* */
00324 #define FRAME_LENGTH_FIELD           (6)
00325 /* */
00326 #define PROTOCOL_TYPE_FIELD          (7)
00327  /* */
00328 #define IP_VERSION_FIELD             (8)
00329  /* TCP / UDP */
00330 #define IP_PROTOCOL_FIELD            (9)
00331  /* */
00332 #define IPV4_SRC_ADRRESS_FIELD       (10)
00333 /* */
00334 #define IPV4_DST_ADDRESS_FIELD       (11)
00335 /* */
00336 #define IPV6_SRC_ADRRESS_FIELD       (12)
00337 /* */
00338 #define IPV6_DST_ADDRESS_FIELD       (13)
00339  /* */
00340 #define SRC_PORT_FIELD               (14)
00341  /* */
00342 #define DST_PORT_FIELD               (15)
00343  /* Definition */
00344 #define NUM_OF_FIELD_NAME_FIELD      (16)
00345 
00346 /*! \union SlrxFilterHeaderArg_t
00347  * The structure holds the header ARGS which are used in case of HDR rule.
00348  */
00349 /* -- 36 bytes */
00350 typedef union SlrxFilterHeaderArg_t 
00351 {
00352     /*----------------------------- Large size ---------------------------------*/
00353     /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00354      * example : IPV6 16 bytes, 39 characters
00355      * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12
00356      */
00357 
00358     SlrxFilterBinaryArg_t RxFilterDB16BytesRuleArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][16 ]; /*  Binary Values for comparition */
00359     /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00360      * example : IPV6 16 bytes, 39 characters
00361      * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12
00362      * Ascii format for ipV6 is not supported
00363      */
00364     /*----------------------------- Medium size ---------------------------------*/
00365     /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00366      * MAC address: 6 bytes, 17 chars
00367      */
00368     SlrxFilterBinaryArg_t RxFilterDB6BytesRuleArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][6]; /*  Binary Values for comparition */
00369     /*!
00370      * ! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00371      *  IP address: 4 bytes, 15 chars
00372      *  2 bytes are added for padding
00373      */
00374     SlrxFilterAsciiArg_t RxFilterDB18BytesAsciiRuleArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][18]; /* Ascii Values for comparison */
00375     /*----------------------------- Small size ---------------------------------*/
00376     /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00377      *  IP address: 4 bytes, 15 chars
00378      *  Port: 2 bytes, chars: 5 chars
00379      */
00380     SlrxFilterBinaryArg_t RxFilterDB4BytesRuleArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][4]; /*  Binary Values for comparison */
00381     /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00382      * Port: 2 bytes, chars: 5 chars
00383      */
00384     SlrxFilterAsciiArg_t RxFilterDB5BytesRuleAsciiArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][5]; /* Ascii Values for comparison */
00385     /*----------------------------- 1 byte size ---------------------------------*/
00386     /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
00387      */
00388     SlrxFilterBinaryArg_t RxFilterDB1BytesRuleArgs [SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][1]; /*  Binary Values for comparison */
00389 }SlrxFilterHeaderArg_t ;
00390 
00391 
00392 
00393 /*! \typedef SlrxFilterRuleHeaderArgsAndMask_t
00394  * Structure which defines the Header Args and mask
00395  */
00396 /* -- 52 bytes */
00397 typedef struct SlrxFilterRuleHeaderArgsAndMask_t
00398 {
00399     /*! Argument for the comparison function */
00400     /* -- 36 byte */
00401     SlrxFilterHeaderArg_t  RuleHeaderArgs;
00402 
00403     /*! the mask is used in order to enable partial comparison,
00404      *  Use the 0xFFFFFFFF in case you don't want to use mask
00405      */
00406     /* -- 16 bytes */
00407     SlrxFilterCompareMask_t RuleHeaderArgsMask[16];
00408 
00409 }SlrxFilterRuleHeaderArgsAndMask_t;
00410 
00411 /*! \typedef SlrxFilterHeaderType_t
00412  * Structure which defines the Header rule
00413  * The header rule defines compare function on the protocol header
00414  * For example destMacAddre is between ( 12:6::78:77,  12:6::78:90 )
00415  *
00416  */
00417 /* -- 56 byte */
00418 typedef struct SlrxFilterHeaderType_t
00419 {
00420     /*! see :: SlrxFilterRuleHeaderArgsAndMask_t */
00421     /* -- 52 bytes */ 
00422     SlrxFilterRuleHeaderArgsAndMask_t RuleHeaderArgsAndMask;
00423 
00424     /*! Packet HDR field which will be compared to the argument */
00425     /* -- 1 byte */
00426     SlrxFilterHdrField_t RuleHeaderfield;
00427 
00428     /* -- 1 byte */
00429     /*! type of the comparison function
00430      * see :: SlrxFilterCompareFunction_t
00431      */
00432     SlrxFilterCompareFunction_t RuleCompareFunc;
00433 
00434     /*! padding */
00435     /* -- 2 bytes */
00436     _u8 RulePadding[2];
00437 
00438 }SlrxFilterHeaderType_t;
00439 
00440 /*! \typedef SlrxFilterPayloadType_t
00441  *  Structure which defines payload rule.
00442  *  Not supported on current release.
00443  */
00444 /* -- 40 byte  */
00445 typedef struct SlrxFilterPayloadType_t
00446 {
00447     /*! Not supported on current release */
00448     /* -- 32 byte */
00449     SlrxFilterRegxPattern_t RegxPattern;
00450     /*! Not supported on current release */
00451     /* -- 4 byte */
00452     SlrxFilterOffset_t LowerOffset;
00453     /*! Not supported on current release */
00454     /* -- 4 byte */
00455     SlrxFilterOffset_t UpperOffset;
00456 }SlrxFilterPayloadType_t;
00457 
00458 /*! \typedef SlrxFilterCombinationTypeOperator_t
00459  * Enumerate the optional operators for the combination type
00460  * filterID1 is located in  the first arg , filterId2 is the second arg,see ::SlrxFilterCombinationType_t.CombinationFilterId
00461  */
00462 typedef _u8 SlrxFilterCombinationTypeOperator_t;
00463 /* Possible values for SlrxFilterCombinationTypeOperator_t */
00464 /*! !filterID1 */
00465 #define COMBINED_FUNC_NOT     (0)
00466 /*! filterID1 && filterID2 */
00467 #define COMBINED_FUNC_AND     (1)
00468 /*! filterID1 && filterID2 */
00469 #define COMBINED_FUNC_OR      (2)
00470 
00471 /*! \typedef SlrxFilterCombinationType_t
00472  * Defines the structure which define the combination type filter
00473  * The combined filter enable to make operation on one or two filter,
00474  * for example !filterId1 or and(filterId2,filterId3).
00475  *
00476  */
00477 /* -- 4  byte */
00478 typedef struct SlrxFilterCombinationType_t
00479 {
00480     /* ! combination operator */
00481     /*  -- 1 byte */
00482     SlrxFilterCombinationTypeOperator_t CombinationTypeOperator;
00483     /* ! filterID, may be one or two depends on the combination operator type */
00484     /*  -- 2  byte */
00485     SlrxFilterID_t CombinationFilterId[SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS];
00486     /* ! Padding */
00487     /*  -- 1  byte */
00488     _u8 Padding;
00489 }SlrxFilterCombinationType_t;
00490 
00491 
00492 /*! \typedef SlrxFilterRule_t
00493  * Rule structure composed of behavioral flags and the filter rule definitions
00494  *
00495  */
00496 /*  -- 56  byte */
00497 typedef union SlrxFilterRule_t
00498 {
00499     /* ! Header type rule , see explanation on the ::SlrxFilterHeaderType_t structure */
00500     /*  -- 56 byte */
00501     SlrxFilterHeaderType_t HeaderType;
00502     /* ! Payload rule, not supported in current release */
00503     /*  -- 40 byte */
00504     SlrxFilterPayloadType_t PayLoadHeaderType; /* future for exact pattern or like hood pattern */
00505     /* ! Combined type rule , see explanation in ::SlrxFilterCombinationType_t structure */
00506     /*  -- 4  byte */
00507     SlrxFilterCombinationType_t CombinationType;
00508 }SlrxFilterRule_t;
00509 
00510 /*! \typedef SlrxFilterTriggerRoles_t
00511  * Bit field which represents the roleId possible values
00512  * In the current release only Station/AP roles are supported.
00513  */
00514 #define RX_FILTER_ROLE_AP                            (1)
00515 #define RX_FILTER_ROLE_STA                           (2)
00516 #define RX_FILTER_ROLE_PROMISCUOUS                   (4)
00517 #define RX_FILTER_ROLE_NULL                          (0)
00518 
00519 typedef union SlrxFilterTriggerRoles_t
00520 {
00521 /*     struct                                                            */
00522 /*     {                                                                 */
00523 /*         _u8 RoleAP :1;                                      */
00524 /*         _u8 RoleStation :1;                                 */
00525       /* The filter is activated only in Promiscuous mode          */
00526 /*         _u8 PromiscuousMode :1;                             */
00527 /*         _u8 RoleReserved :5;                                */
00528 /*     };                                                                */
00529     /* ! Bit fiels of the Filter role    */   
00530     _u8 IntRepresentation;
00531 
00532 }SlrxFilterTriggerRoles_t;
00533 
00534 /*! \typedef SlrxFilterTriggerConnectionStates_t
00535  * Bit field representing the possible values of the When section of the rule
00536  *
00537  */
00538 #define RX_FILTER_CONNECTION_STATE_STA_CONNECTED     (1)
00539 #define RX_FILTER_CONNECTION_STATE_STA_NOT_CONNECTED (2)
00540 #define RX_FILTER_CONNECTION_STATE_STA_HAS_IP        (4)
00541 #define RX_FILTER_CONNECTION_STATE_STA_HAS_NO_IP     (8)
00542 
00543 typedef union SlrxFilterTriggerConnectionStates_t
00544 {
00545 /*     struct */
00546 /*     {      */
00547 /*         _u8 RoleStationWiFiConnected :1;  */
00548 /*         _u8 RoleStationWiFiDisconneted:1; */
00549 /*         _u8 RoleStationWiFiHasIp:1;       */
00550 /*         _u8 RoleStationWiFiHasNoIp:1;     */
00551 /*         _u8 RoleStationWiFiSocketOpened:1; */
00552 /*         _u8 RoleStationWiFiSocketclosed:1; */
00553 /*     }; */
00554 /*  */
00555     /* ! */
00556     _u8 IntRepresentation;
00557         
00558 }SlrxFilterTriggerConnectionStates_t;
00559 
00560 /*! \typedef SlrxFilterDBTriggerArg_t
00561  * Provides container for entering the filter 'when' argument.
00562  * The current release support 'When rules' which has no arguments.
00563  * For example :
00564  *  When connect to specific AP -- the AP bssid is the argument.
00565  *
00566  */
00567 typedef _u32  SlrxFilterDBTriggerArg_t;
00568 
00569 
00570 
00571 /*! \typedef  SlrxFilterCounterId_t
00572  * the counter ID we have 4 counters
00573  */
00574 typedef _u8 SlrxFilterCounterId_t;
00575 /* Possible values for SlrxFilterCounterId_t */
00576 #define NO_TRIGGER                                  (0)
00577 #define RX_FILTER_COUNTER1                          (1)
00578 #define RX_FILTER_COUNTER2                          (2)
00579 #define RX_FILTER_COUNTER3                          (3)
00580 #define RX_FILTER_COUNTER4                          (4)
00581 #define RX_FILTER_COUNTER5                          (5)
00582 #define RX_FILTER_COUNTER6                          (6)
00583 #define RX_FILTER_COUNTER7                          (7)
00584 #define RX_FILTER_COUNTER8                          (8)
00585 #define MAX_RX_FILTER_COUNTER                       (9)
00586 
00587 
00588 
00589 /*! \typedef SlrxFilterActionArgs_t
00590  * Possible value for filter action args
00591  *
00592  */
00593 
00594 typedef _u8  SlrxFilterActionArgs_t;
00595 /* Possible values for SlrxFilterActionArgs_t */
00596 #define ACTION_ARG_REG_1_4                          (0)
00597     /* ! Can be use as counter */
00598 #define ACTION_ARG_TEMPLATE                         (1)
00599     /* ! Can be use as counter */
00600 #define ACTION_ARG_EVENT                            (2)
00601 
00602 /* ! GPIO number */
00603 #define ACTION_ARG_GPIO                             (4)
00604 /*!
00605  * \def SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS
00606  *
00607  */
00608 #define SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS  (5)
00609 
00610 
00611 
00612 
00613 /*! \typedef SlrxFilterTrigger_t
00614  * The filter trigger, determine when the filter is triggered,
00615  * The filter is triggered in the following condition :\n
00616  * 1. The filter parent is triggered\n
00617  * 2. The requested connection type exists, i.e. wlan_connect\n
00618  * 3. The filter role is the same as the system role\n
00619  *
00620  */
00621 /*  --  12 byte */
00622 typedef struct SlrxFilterTrigger_t
00623 {
00624     /*! The parent filter ID, this is the way to build filter tree. */
00625     /*  NULL           value means  tree root.
00626     */
00627     /*  --  1 byte */
00628     SlrxFilterID_t ParentFilterID;
00629     /* ! See ::SlrxFilterCounterId_t explanation */
00630     /*  -- 1 byte */
00631     SlrxFilterCounterId_t Trigger;
00632     /* ! See :: SlrxFilterTriggerConnectionStates_t */
00633     /*  -- 1 byte */
00634     SlrxFilterTriggerConnectionStates_t TriggerArgConnectionState;
00635     /* ! See ::SlrxFilterTriggerRoles_t */
00636     /*  -- 1 byte */
00637     SlrxFilterTriggerRoles_t TriggerArgRoleStatus;
00638     /* ! The Trigger arguments are in the same order as the Trigger bit field order. */
00639     /*  --  4 byte */
00640     SlrxFilterDBTriggerArg_t TriggerArg;
00641     /** The compare function which will be operate for each bit that is turned on in the ::SlrxFilterTrigger_t.Trigger field,
00642      * for example , in case the second bit in the Trigger function is on the second function in the list will be executed.
00643      *
00644     */
00645     /*  --  1 byte */
00646     SlrxTriggerCompareFunction_t TriggerCompareFunction;
00647 
00648     /* ! padding */
00649     /*  --  3 byte */
00650     _u8 Padding[3];
00651 } SlrxFilterTrigger_t;
00652 
00653 /*! \typedef SlrxFilterActionType_t
00654  *  The actions are executed only if the filter is matched,\n
00655  *  In case of false match the packet is transfered to the HOST. \n
00656  *  The action is composed of bit field structure,
00657  *  up to 2 actions can be defined per filter.
00658  *
00659  */
00660 #define RX_FILTER_ACTION_NULL               (0x0)
00661 #define RX_FILTER_ACTION_DROP               (0x1)
00662 #define RX_FILTER_ACTION_GPIO               (0x2)
00663 #define RX_FILTER_ACTION_ON_REG_INCREASE    (0x4)
00664 #define RX_FILTER_ACTION_ON_REG_DECREASE    (0x8)
00665 #define RX_FILTER_ACTION_ON_REG_RESET       (0x10)
00666 #define RX_FILTER_ACTION_SEND_TEMPLATE      (0x20) /* unsupported */
00667 #define RX_FILTER_ACTION_EVENT_TO_HOST      (0x40) /* unsupported */
00668 
00669 typedef union SlrxFilterActionType_t
00670 {
00671 /*     struct */
00672 /*     { */
00673          /* ! No action to execute the packet is dropped,drop is always on leaf. */
00674          /* ! If not dropped ,The packet is passed to the next filter or in case it is the last filter to the host */
00675 /*         _u8 ActionDrop : 1; */
00676          /* ! Not Supported in the current release */
00677 /*         _u8 ActionGpio : 1; */
00678          /*! action can increase counter registers.
00679           *  1 = Increase
00680           *  2 = decrease
00681           *  3 = reset
00682           */
00683 /*         _u8 ActionOnREGIncrease : 1; */
00684 /*         _u8 ActionOnREGDecrease : 1; */
00685 /*         _u8 ActionOnREGReset : 1;    */
00686 
00687          /* ! Not Supported in the current release */
00688 /*         _u8 ActionSendTemplate : 1; */
00689          /* ! Not Supported in the current release */
00690 /*         _u8 ActionEventToHost: 1;   */
00691 /*         _u8 padding: 1;             */
00692 /*     }; */
00693 
00694     _u8 IntRepresentation;
00695 
00696 }SlrxFilterActionType_t;
00697 
00698 /*! \typedef SlrxFilterAction_t
00699  * Several actions can be defined,\n
00700  * The action is executed in case the filter rule is matched.
00701  */
00702 /*  -- 8 byte   */
00703 typedef struct SlrxFilterAction_t
00704 {
00705     /*  -- 1 byte */
00706     /* ! Determine which actions are supported */
00707     SlrxFilterActionType_t ActionType;
00708     /* ! Buffer for the action arguments */
00709     /**
00710      * <b>location 0</b> - The counter to increase
00711      *     In case the action is of type "increase" the arg will contain the counter number,
00712      *     The counter number values are as in  ::SlrxFilterCounterId_t.\n
00713      * <b>location 1</b> - The template arg.\n
00714      * <b>location 2</b> - The event arg.\n
00715      *
00716      */
00717     /*  -- 5 byte */
00718     SlrxFilterActionArg_t ActionArg[SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS];
00719 
00720     /* ! Padding */
00721     /* - 2 Bytes */
00722     _u8 Padding[2];
00723 
00724 } SlrxFilterAction_t;
00725 
00726 
00727 /*! \struct _WlanRxFilterOperationCommandBuff_t
00728  *  The structure is used for the interface HOST NWP.\n
00729  *  The supported operation : \n
00730  *   ::ENABLE_DISABLE_RX_FILTER,\n
00731  *   ::REMOVE_RX_FILTER,\n
00732  *
00733  */
00734 /*  20 bytes */
00735 typedef struct _WlanRxFilterOperationCommandBuff_t 
00736 {
00737     /*  -- 16 bytes */
00738     SlrxFilterIdMask_t FilterIdMask;
00739     /*  4 bytes */
00740     _u8 Padding[4];
00741 }_WlanRxFilterOperationCommandBuff_t ;
00742 
00743 
00744 
00745 /* -- 56 bytes */
00746 typedef struct _WlanRxFilterUpdateArgsCommandBuff_t
00747 {
00748     /*  -- 1 bytes */
00749     _u8  FilterId;
00750 
00751     /*  -- 1 bytes */
00752     /* ! the args representation */
00753     _u8 BinaryRepresentation;
00754 
00755     /*  -- 52 byte */
00756     SlrxFilterRuleHeaderArgsAndMask_t FilterRuleHeaderArgsAndMask;
00757 
00758     /* -- 2 bytes */
00759     _u8 Padding[2];
00760 }_WlanRxFilterUpdateArgsCommandBuff_t;
00761 
00762 
00763 /*! \typedef _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t
00764  *  The structure is used for the interface HOST NWP.\n
00765  *
00766  */
00767 /* -- 16 bytes */
00768 typedef struct _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t
00769 {
00770 
00771     /* ! the filter set bit map */
00772     /*  -- 16 bytes             */
00773     SlrxFilterIdMask_t FilterIdMask;
00774 
00775 }_WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t;
00776 
00777 
00778 /*! \struct _WlanRxFilterPrePreparedFiltersCommandBuff_t
00779  *  The function enables to perform operations on pre-prepared filters
00780  *
00781  */
00782 typedef struct _WlanRxFilterPrePreparedFiltersCommandBuff_t 
00783 {
00784     /* ! the filter set bit map */
00785     /*  -- 4 bytes */
00786     SlrxFilterPrePreparedFiltersMask_t  FilterPrePreparedFiltersMask;
00787 
00788 }_WlanRxFilterPrePreparedFiltersCommandBuff_t ;
00789 
00790 
00791 /*! \typedef sl_protocol_WlanRxFilterPrePreparedFiltersCommandResponseBuff_t
00792  *
00793  */
00794 /*-- 4 bytes  */
00795 typedef struct _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t
00796 {
00797     /* -- 4 bytes */
00798     /* ! the filter set bit map */
00799     SlrxFilterPrePreparedFiltersMask_t  FilterPrePreparedFiltersMask;
00800 
00801 }_WlanRxFilterPrePreparedFiltersCommandResponseBuff_t;
00802 
00803 
00804 
00805 typedef _u8 SLrxFilterOperation_t;
00806 #define SL_ENABLE_DISABLE_RX_FILTER                         (0)
00807 #define SL_REMOVE_RX_FILTER                                 (1)
00808 #define SL_STORE_RX_FILTERS                                 (2)
00809 #define SL_UPDATE_RX_FILTER_ARGS                            (3)
00810 #define SL_FILTER_RETRIEVE_ENABLE_STATE                     (4)
00811 #define SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE (5)
00812 #define SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE      (6)
00813 
00814 
00815 /*  Bit manipulation for 8 bit */
00816 #define ISBITSET8(x,i) ((x[i>>3] & (0x80>>(i&7)))!=0) /* < Is bit set, 8 bit unsigned numbers = x , location = i */
00817 #define SETBIT8(x,i) x[i>>3]|=(0x80>>(i&7)); /* < Set bit,8 bit unsigned numbers = x , location = i */
00818 #define CLEARBIT8(x,i) x[i>>3]&=(0x80>>(i&7))^0xFF; /* < Clear bit,8 bit unsigned numbers = x , location = i */
00819 
00820 
00821 /*********************************************************************************************/
00822 /* Function prototypes                                                                       */
00823 /*********************************************************************************************/
00824 
00825 /*!
00826 
00827     \addtogroup wlan
00828     @{
00829 
00830 */
00831 
00832 
00833 /*!
00834   \brief Adds new filter rule to the system
00835 
00836   \param[in]    RuleType     The rule type
00837   \param[in]    FilterFlags  Flags which set the type of header rule Args and sets the persistent flag
00838   \param[in]    pRule        Determine the filter rule logic
00839   \param[in]    pTrigger     Determine when the rule is triggered also sets rule parent.
00840   \param[in]    pAction      Sets the action to be executed in case the match functions pass
00841   \param[out]   pFilterId    The filterId which was created
00842 
00843   \return       On success, zero is returned. Otherwise error code is returned
00844  */
00845 #if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
00846 SlrxFilterID_t sl_WlanRxFilterAdd(    SlrxFilterRuleType_t                 RuleType,
00847                                     SlrxFilterFlags_t                     FilterFlags,
00848                                     const SlrxFilterRule_t* const         Rule,
00849                                     const SlrxFilterTrigger_t* const     Trigger,
00850                                     const SlrxFilterAction_t* const     Action,
00851                                     SlrxFilterID_t*                     pFilterId);
00852 
00853 #endif
00854 
00855 
00856 
00857 
00858 
00859 /*!
00860   \brief   Sets parameters to Rx filters
00861 
00862  \param[in] RxFilterOperation
00863  possible operations :
00864     - SL_ENABLE_DISABLE_RX_FILTER - Enables\disables filter in a filter list
00865     - SL_REMOVE_RX_FILTER - Removes filter from memory ( to remove from flash call SL_STORE_RX_FILTERS after this command)
00866     - SL_STORE_RX_FILTERS - Save the filters for persistent
00867     - SL_UPDATE_RX_FILTER_ARGS - Update the arguments of existing filter
00868     - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE - Change the default creation of the pre-prepared filters
00869 
00870   \param[in] pInputBuffer options:
00871    The buffer input is _WlanRxFilterOperationCommandBuff_t:
00872      - SL_ENABLE_DISABLE_RX_FILTER
00873     - SL_REMOVE_RX_FILTER
00874     - SL_STORE_RX_FILTERS
00875     The buffer input is _WlanRxFilterUpdateArgsCommandBuff_t:
00876      - SL_UPDATE_RX_FILTER_ARGS
00877    The buffer input is _WlanRxFilterPrePreparedFiltersCommandBuff_t:
00878      - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE
00879 
00880   \param[in] InputbufferLength The length in byte of the input buffer
00881 
00882   \return    On success, zero is returned. Otherwise error code is returned
00883  */
00884 
00885 #if _SL_INCLUDE_FUNC(sl_WlanRxFilterSet)
00886 _i16 sl_WlanRxFilterSet(  const SLrxFilterOperation_t RxFilterOperation,
00887                           const _u8*  const pInputBuffer,
00888                          _u16 InputbufferLength);
00889 #endif
00890 
00891 /*!
00892   \brief    Gets parameters of Rx filters
00893 
00894  \param[in] RxFilterOperation
00895  possible operations :
00896     - SL_FILTER_RETRIEVE_ENABLE_STATE - Retrieves the enable disable status
00897     - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE - Retrieves the pre-prepared filters creation status
00898 
00899  \param[in] pOutputBuffer
00900    The buffer input is _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t:
00901      - SL_FILTER_RETRIEVE_ENABLE_STATE
00902    The buffer input is _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t:
00903      - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE
00904 
00905   \param[in] OutputbufferLength   The length in byte of the output buffer
00906 
00907    \return   On success, zero is returned. Otherwise error code is returned
00908 */
00909 
00910 #if _SL_INCLUDE_FUNC(sl_WlanRxFilterGet)
00911 _i16 sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation,
00912                         _u8*  pOutputBuffer,
00913                         _u16  OutputbufferLength);
00914 #endif
00915 
00916 
00917 /*!
00918 
00919  Close the Doxygen group.
00920  @}
00921 
00922  */
00923 
00924 #ifdef  __cplusplus
00925 }
00926 #endif /*  __cplusplus */
00927 
00928 #endif /* RX_FILTERS_PREPROCESSOR_CLI_IF_H_ */
00929 
00930 
00931