• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **|                                                                       |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
5 **| All rights reserved.                                                  |**
6 **|                                                                       |**
7 **| Redistribution and use in source and binary forms, with or without    |**
8 **| modification, are permitted provided that the following conditions    |**
9 **| are met:                                                              |**
10 **|                                                                       |**
11 **|  * Redistributions of source code must retain the above copyright     |**
12 **|    notice, this list of conditions and the following disclaimer.      |**
13 **|  * Redistributions in binary form must reproduce the above copyright  |**
14 **|    notice, this list of conditions and the following disclaimer in    |**
15 **|    the documentation and/or other materials provided with the         |**
16 **|    distribution.                                                      |**
17 **|  * Neither the name Texas Instruments nor the names of its            |**
18 **|    contributors may be used to endorse or promote products derived    |**
19 **|    from this software without specific prior written permission.      |**
20 **|                                                                       |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
32 **|                                                                       |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35 
36 
37 #include <linux/errno.h>
38 #include <linux/string.h>
39 
40 #include "arch_ti.h"
41 #include "osTIType.h"
42 #include "osApi.h"
43 #include "ioctl_init.h"
44 
45 #include "802_11Defs.h"
46 #include "mlmeApi.h"
47 
48 /****************************************************************************/
49 /*                                                                          */
50 /*              Definition of Constants                                     */
51 /*                                                                          */
52 /****************************************************************************/
53 #define SIZEOF_DOT11_MGMT_HEADER 0x18
54 #define SIZEOF_MLME_FRAME_INFO   0x60
55 #ifdef EXC_MODULE_INCLUDED
56 #define SIZEOF_BEACON_FRM        0x57
57 #else
58 #define SIZEOF_BEACON_FRM        0x53
59 #endif
60 #define SIZEOF_ELEMENT_HDR       0x02
61 #define SIZEOF_MGMT_FRAME        0x920
62 #define SIZEOF_ASSOC_RSP_TYPE    0x26
63 #define SIZEOF_AUTH_MSG_TYPE     0x0a
64 #define SIZEOF_DEATUH_MSG_TYPE   0x02
65 #define SIZEOF_DISASSOC_MSG_TYPE 0x02
66 
67 #define CHECK_STRUCT_SIZE(_type,_size) \
68 { \
69   if (sizeof(_type) != _size) \
70   { \
71         print_info(KERN_INFO"\n.... ERROR in size of %s struct 0x%08x  should be 0x%08x.....\n", \
72                  #_type, (int)sizeof(_type),(int)_size); \
73         rc = -EINVAL; \
74   } \
75 }
76 
77 /************************************************************************
78  *                        packed_strct_tst                                                              *
79  ************************************************************************
80 DESCRIPTION: Used to test structures for the correct packed size
81 
82 INPUT:      Void
83 
84 OUTPUT:         Print Debug statements if the structures are not the expected size
85 
86 RETURN:    0=success
87            -EINVAL - failure
88 
89 ************************************************************************/
packed_struct_tst(void)90 int packed_struct_tst (void)
91 {
92    int rc = 0;
93    print_info("\nTIWLAN: Testing sizes of packed structures...\n");
94    CHECK_STRUCT_SIZE(dot11_mgmtHeader_t, SIZEOF_DOT11_MGMT_HEADER);
95    CHECK_STRUCT_SIZE(dot11_eleHdr_t, SIZEOF_ELEMENT_HDR);
96    CHECK_STRUCT_SIZE(beacon_probeRsp_t, SIZEOF_BEACON_FRM);
97    CHECK_STRUCT_SIZE(assocRsp_t, SIZEOF_ASSOC_RSP_TYPE );
98    CHECK_STRUCT_SIZE(authMsg_t, SIZEOF_AUTH_MSG_TYPE);
99    CHECK_STRUCT_SIZE(deAuth_t,  SIZEOF_DEATUH_MSG_TYPE);
100    CHECK_STRUCT_SIZE(disAssoc_t, SIZEOF_DISASSOC_MSG_TYPE);
101    CHECK_STRUCT_SIZE(dot11_mgmtFrame_t, SIZEOF_MGMT_FRAME);
102    CHECK_STRUCT_SIZE(mlmeFrameInfo_t,SIZEOF_MLME_FRAME_INFO);
103    print_info("TIWLAN: packet structure size test %s\n", rc?"failed":"passed");
104 
105    return rc;
106 }
107