LCOV - code coverage report
Current view: top level - src/fst - fst_iface.c (source / functions) Hit Total Coverage
Test: wpa_supplicant/hostapd combined for hwsim test run 1443382998 Lines: 32 32 100.0 %
Date: 2015-09-27 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /*
       2             :  * FST module - FST interface object implementation
       3             :  * Copyright (c) 2014, Qualcomm Atheros, Inc.
       4             :  *
       5             :  * This software may be distributed under the terms of the BSD license.
       6             :  * See README for more details.
       7             :  */
       8             : 
       9             : #include "utils/includes.h"
      10             : #include "utils/common.h"
      11             : #include "fst/fst_internal.h"
      12             : #include "fst/fst_defs.h"
      13             : 
      14             : 
      15         546 : struct fst_iface * fst_iface_create(struct fst_group *g, const char *ifname,
      16             :                                     const u8 *own_addr,
      17             :                                     const struct fst_wpa_obj *iface_obj,
      18             :                                     const struct fst_iface_cfg *cfg)
      19             : {
      20             :         struct fst_iface *i;
      21             : 
      22         546 :         i = os_zalloc(sizeof(*i));
      23         546 :         if (!i) {
      24           2 :                 fst_printf_group(g, MSG_ERROR, "cannot allocate iface for %s",
      25             :                                 ifname);
      26           2 :                 return NULL;
      27             :         }
      28             : 
      29         544 :         i->cfg = *cfg;
      30         544 :         i->iface_obj = *iface_obj;
      31         544 :         i->group = g;
      32         544 :         os_strlcpy(i->ifname, ifname, sizeof(i->ifname));
      33         544 :         os_memcpy(i->own_addr, own_addr, sizeof(i->own_addr));
      34             : 
      35         544 :         if (!i->cfg.llt) {
      36           6 :                 fst_printf_iface(i, MSG_WARNING, "Zero llt adjusted");
      37           6 :                 i->cfg.llt = FST_DEFAULT_LLT_CFG_VALUE;
      38             :         }
      39             : 
      40         544 :         return i;
      41             : }
      42             : 
      43             : 
      44         544 : void fst_iface_delete(struct fst_iface *i)
      45             : {
      46         544 :         fst_iface_set_ies(i, NULL);
      47         544 :         wpabuf_free(i->mb_ie);
      48         544 :         os_free(i);
      49         544 : }
      50             : 
      51             : 
      52        2929 : Boolean fst_iface_is_connected(struct fst_iface *iface, const u8 *addr)
      53             : {
      54             :         struct fst_get_peer_ctx *ctx;
      55        2929 :         const u8 *a = fst_iface_get_peer_first(iface, &ctx, TRUE);
      56             : 
      57        3197 :         for (; a != NULL; a = fst_iface_get_peer_next(iface, &ctx, TRUE))
      58        2449 :                 if (os_memcmp(addr, a, ETH_ALEN) == 0)
      59        2181 :                         return TRUE;
      60             : 
      61         748 :         return FALSE;
      62             : }
      63             : 
      64             : 
      65        2077 : void fst_iface_attach_mbie(struct fst_iface *i, struct wpabuf *mbie)
      66             : {
      67        2077 :         wpabuf_free(i->mb_ie);
      68        2077 :         i->mb_ie = mbie;
      69        2077 : }
      70             : 
      71             : 
      72         956 : enum mb_band_id fst_iface_get_band_id(struct fst_iface *i)
      73             : {
      74             :         enum hostapd_hw_mode hw_mode;
      75             :         u8 channel;
      76             : 
      77         956 :         fst_iface_get_channel_info(i, &hw_mode, &channel);
      78         956 :         return fst_hw_mode_to_band(hw_mode);
      79             : }

Generated by: LCOV version 1.10