Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * WPA Supplicant / Example program entrypoint |
| 3 | * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi> |
| 4 | * |
Dmitry Shmidt | c5ec7f5 | 2012-03-06 16:33:24 -0800 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include "includes.h" |
| 10 | |
| 11 | #include "common.h" |
| 12 | #include "wpa_supplicant_i.h" |
| 13 | |
| 14 | int main(int argc, char *argv[]) |
| 15 | { |
| 16 | struct wpa_interface iface; |
| 17 | int exitcode = 0; |
| 18 | struct wpa_params params; |
| 19 | struct wpa_global *global; |
| 20 | |
| 21 | memset(¶ms, 0, sizeof(params)); |
| 22 | params.wpa_debug_level = MSG_INFO; |
| 23 | |
| 24 | global = wpa_supplicant_init(¶ms); |
| 25 | if (global == NULL) |
| 26 | return -1; |
| 27 | |
| 28 | memset(&iface, 0, sizeof(iface)); |
| 29 | /* TODO: set interface parameters */ |
| 30 | |
Dmitry Shmidt | 203eadb | 2015-03-05 14:16:04 -0800 | [diff] [blame] | 31 | if (wpa_supplicant_add_iface(global, &iface, NULL) == NULL) |
Dmitry Shmidt | 8d520ff | 2011-05-09 14:06:53 -0700 | [diff] [blame] | 32 | exitcode = -1; |
| 33 | |
| 34 | if (exitcode == 0) |
| 35 | exitcode = wpa_supplicant_run(global); |
| 36 | |
| 37 | wpa_supplicant_deinit(global); |
| 38 | |
| 39 | return exitcode; |
| 40 | } |