]>
Commit | Line | Data |
---|---|---|
a9533e7e HP |
1 | /* |
2 | * Copyright (c) 2010 Broadcom Corporation | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice appear in all copies. | |
7 | * | |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
15 | */ | |
16 | ||
17 | #include <bcmutils.h> | |
18 | #include <bcmwpa.h> | |
19 | ||
20 | /* Is this body of this tlvs entry a WFA entry? If | |
21 | * not update the tlvs buffer pointer/length. | |
22 | */ | |
7cc4a4c0 | 23 | bool bcm_is_wfa_ie(uint8 *ie, uint8 **tlvs, uint *tlvs_len, uint8 type) |
a9533e7e HP |
24 | { |
25 | /* If the contents match the WFA_OUI and type */ | |
26 | if ((ie[TLV_LEN_OFF] > (WFA_OUI_LEN + 1)) && | |
27 | !bcmp(&ie[TLV_BODY_OFF], WFA_OUI, WFA_OUI_LEN) && | |
28 | type == ie[TLV_BODY_OFF + WFA_OUI_LEN]) { | |
29 | return TRUE; | |
30 | } | |
31 | ||
32 | /* point to the next ie */ | |
33 | ie += ie[TLV_LEN_OFF] + TLV_HDR_LEN; | |
34 | /* calculate the length of the rest of the buffer */ | |
35 | *tlvs_len -= (int)(ie - *tlvs); | |
36 | /* update the pointer to the start of the buffer */ | |
37 | *tlvs = ie; | |
38 | ||
39 | return FALSE; | |
40 | } | |
41 | ||
a2627bc0 JC |
42 | wpa_ie_fixed_t *BCMROMFN(bcm_find_wpaie) (uint8 * parse, uint len) |
43 | { | |
a9533e7e HP |
44 | bcm_tlv_t *ie; |
45 | ||
46 | while ((ie = bcm_parse_tlvs(parse, len, DOT11_MNG_VS_ID))) { | |
47 | if (bcm_is_wpa_ie((uint8 *) ie, &parse, &len)) { | |
48 | return (wpa_ie_fixed_t *) ie; | |
49 | } | |
50 | } | |
51 | return NULL; | |
52 | } |