LCOV - code coverage report
Current view: top level - src/drivers - driver_none.c (source / functions) Hit Total Coverage
Test: wpa_supplicant/hostapd combined for hwsim test run 1393793999 Lines: 9 26 34.6 %
Date: 2014-03-02 Functions: 2 6 33.3 %
Branches: 1 4 25.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Driver interface for RADIUS server or WPS ER only (no driver)
       3                 :            :  * Copyright (c) 2008, Atheros Communications
       4                 :            :  *
       5                 :            :  * This software may be distributed under the terms of the BSD license.
       6                 :            :  * See README for more details.
       7                 :            :  */
       8                 :            : 
       9                 :            : #include "includes.h"
      10                 :            : 
      11                 :            : #include "common.h"
      12                 :            : #include "driver.h"
      13                 :            : 
      14                 :            : 
      15                 :            : struct none_driver_data {
      16                 :            :         struct hostapd_data *hapd;
      17                 :            :         void *ctx;
      18                 :            : };
      19                 :            : 
      20                 :            : 
      21                 :          1 : static void * none_driver_hapd_init(struct hostapd_data *hapd,
      22                 :            :                                     struct wpa_init_params *params)
      23                 :            : {
      24                 :            :         struct none_driver_data *drv;
      25                 :            : 
      26                 :          1 :         drv = os_zalloc(sizeof(struct none_driver_data));
      27         [ -  + ]:          1 :         if (drv == NULL) {
      28                 :          0 :                 wpa_printf(MSG_ERROR, "Could not allocate memory for none "
      29                 :            :                            "driver data");
      30                 :          0 :                 return NULL;
      31                 :            :         }
      32                 :          1 :         drv->hapd = hapd;
      33                 :            : 
      34                 :          1 :         return drv;
      35                 :            : }
      36                 :            : 
      37                 :            : 
      38                 :          1 : static void none_driver_hapd_deinit(void *priv)
      39                 :            : {
      40                 :          1 :         struct none_driver_data *drv = priv;
      41                 :            : 
      42                 :          1 :         os_free(drv);
      43                 :          1 : }
      44                 :            : 
      45                 :            : 
      46                 :          0 : static int none_driver_send_ether(void *priv, const u8 *dst, const u8 *src,
      47                 :            :                                   u16 proto, const u8 *data, size_t data_len)
      48                 :            : {
      49                 :          0 :         return 0;
      50                 :            : }
      51                 :            : 
      52                 :            : 
      53                 :          0 : static void * none_driver_init(void *ctx, const char *ifname)
      54                 :            : {
      55                 :            :         struct none_driver_data *drv;
      56                 :            : 
      57                 :          0 :         drv = os_zalloc(sizeof(struct none_driver_data));
      58         [ #  # ]:          0 :         if (drv == NULL) {
      59                 :          0 :                 wpa_printf(MSG_ERROR, "Could not allocate memory for none "
      60                 :            :                            "driver data");
      61                 :          0 :                 return NULL;
      62                 :            :         }
      63                 :          0 :         drv->ctx = ctx;
      64                 :            : 
      65                 :          0 :         return drv;
      66                 :            : }
      67                 :            : 
      68                 :            : 
      69                 :          0 : static void none_driver_deinit(void *priv)
      70                 :            : {
      71                 :          0 :         struct none_driver_data *drv = priv;
      72                 :            : 
      73                 :          0 :         os_free(drv);
      74                 :          0 : }
      75                 :            : 
      76                 :            : 
      77                 :          0 : static int none_driver_send_eapol(void *priv, const u8 *dest, u16 proto,
      78                 :            :                                   const u8 *data, size_t data_len)
      79                 :            : {
      80                 :          0 :         return -1;
      81                 :            : }
      82                 :            : 
      83                 :            : 
      84                 :            : const struct wpa_driver_ops wpa_driver_none_ops = {
      85                 :            :         .name = "none",
      86                 :            :         .desc = "no driver (RADIUS server/WPS ER)",
      87                 :            :         .hapd_init = none_driver_hapd_init,
      88                 :            :         .hapd_deinit = none_driver_hapd_deinit,
      89                 :            :         .send_ether = none_driver_send_ether,
      90                 :            :         .init = none_driver_init,
      91                 :            :         .deinit = none_driver_deinit,
      92                 :            :         .send_eapol = none_driver_send_eapol,
      93                 :            : };

Generated by: LCOV version 1.9