• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * keyParser.c
3  *
4  * Copyright(c) 1998 - 2009 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 /** \file keyParser.c
35  * \brief KEY parser module implementation.
36  *
37  * \see keyParser.h
38 */
39 
40 /****************************************************************************
41  *                                                                          *
42  *   MODULE:	KEY parser                                                  *
43  *   PURPOSE:   KEY parser implementation									*
44  *                                                                          *
45  ****************************************************************************/
46 
47 #define __FILE_ID__  FILE_ID_33
48 #include "osApi.h"
49 #include "report.h"
50 #include "rsnApi.h"
51 
52 #include "keyParser.h"
53 #include "keyParserExternal.h"
54 #include "keyParserWep.h"
55 
56 TI_STATUS keyParserNone_config(keyParser_t *pKeyParser);
57 
58 /**
59 *
60 * Function  - Init KEY Parser module.
61 *
62 * \b Description:
63 *
64 * Called by RSN Manager.
65 * Registers the function 'rsn_keyParserRecv()' at the distributor to receive KEY frames upon receiving a KEY_RECV event.
66 *
67 * \b ARGS:
68 *
69 *
70 * \b RETURNS:
71 *
72 *  TI_STATUS - 0 on success, any other value on failure.
73 *
74 */
75 
keyParser_create(TI_HANDLE hOs)76 keyParser_t* keyParser_create(TI_HANDLE hOs)
77 {
78 	keyParser_t 		*pKeyParser;
79 
80 	/* allocate key parser context memory */
81 	pKeyParser = (keyParser_t*)os_memoryCAlloc(hOs, 1, sizeof(keyParser_t));
82 	if (pKeyParser == NULL)
83 	{
84 		return NULL;
85 	}
86 
87 	pKeyParser->hOs = hOs;
88 
89 	return pKeyParser;
90 }
91 
92 /**
93 *
94 * Function  - Init KEY Parser module.
95 *
96 * \b Description:
97 *
98 * Called by RSN Manager.
99 * Registers the function 'rsn_keyParserRecv()' at the distributor to receive KEY frames upon receiving a KEY_RECV event.
100 *
101 * \b ARGS:
102 *
103 *
104 * \b RETURNS:
105 *
106 *  TI_STATUS - 0 on success, any other value on failure.
107 *
108 */
109 
keyParser_unload(struct _keyParser_t * pKeyParser)110 TI_STATUS keyParser_unload(struct _keyParser_t *pKeyParser)
111 {
112 	/* free key parser context memory */
113 	os_memoryFree(pKeyParser->hOs, pKeyParser, sizeof(keyParser_t));
114 
115 	return TI_OK;
116 }
117 
118 /**
119 *
120 * Function  - Init KEY Parser module.
121 *
122 * \b Description:
123 *
124 * Called by RSN Manager.
125 * Registers the function 'rsn_keyParserRecv()' at the distributor to receive KEY frames upon receiving a KEY_RECV event.
126 *
127 * \b ARGS:
128 *
129 *
130 * \b RETURNS:
131 *
132 *  TI_STATUS - 0 on success, any other value on failure.
133 *
134 */
135 
keyParser_config(struct _keyParser_t * pKeyParser,TRsnPaeConfig * pPaeConfig,struct _unicastKey_t * pUcastKey,struct _broadcastKey_t * pBcastKey,struct _mainKeys_t * pParent,TI_HANDLE hReport,TI_HANDLE hOs,TI_HANDLE hCtrlData)136 TI_STATUS keyParser_config(struct _keyParser_t *pKeyParser,
137 						TRsnPaeConfig *pPaeConfig,
138                         struct _unicastKey_t *pUcastKey,
139                         struct _broadcastKey_t *pBcastKey,
140                         struct _mainKeys_t *pParent,
141 						TI_HANDLE hReport,
142 						TI_HANDLE hOs,
143                         TI_HANDLE hCtrlData)
144 {
145 
146     pKeyParser->pParent = pParent;
147     pKeyParser->pUcastKey = pUcastKey;
148     pKeyParser->pBcastKey = pBcastKey;
149     pKeyParser->pPaeConfig = pPaeConfig;
150 
151     pKeyParser->hReport = hReport;
152 	pKeyParser->hOs = hOs;
153     pKeyParser->hCtrlData = hCtrlData;
154 
155 	keyParserExternal_config(pKeyParser);
156 
157 	return TI_OK;
158 }
159 
160 
161 
keyParserNone_config(keyParser_t * pKeyParser)162 TI_STATUS keyParserNone_config(keyParser_t *pKeyParser)
163 {
164 	pKeyParser->recv = NULL;
165 	pKeyParser->replayReset = NULL;
166 
167 	return TI_OK;
168 
169 }
170 
171 
keyParser_nop(keyParser_t * pKeyParser)172 TI_STATUS keyParser_nop(keyParser_t *pKeyParser)
173 {
174 TRACE0(pKeyParser->hReport, REPORT_SEVERITY_INFORMATION, "KEY_PARSER: nop \n");
175 
176 	return TI_OK;
177 }
178 
179 
180