【MTK平台】【wpa_supplicant】关于wpa_supplicant/p2p_supplicant.c文件的介绍

本文主要介绍external/wpa_supplicant_8/wpa_supplicant/p2p_supplicant.c 这个文件

这个文件里面有个核心的方法就是wpas_p2p_init,

/**
 * wpas_p2p_init - Initialize P2P module for %wpa_supplicant
 * @global: Pointer to global data from wpa_supplicant_init()
 * @wpa_s: Pointer to wpa_supplicant data from wpa_supplicant_add_iface()
 * Returns: 0 on success, -1 on failure
 */
int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
{
	struct p2p_config p2p;///p2p变量指向一个p2p_config对象,代表P2P模块的配置信息
	int i;

	if (wpa_s->conf->p2p_disabled)
		return 0;
    //WPA_DRIVER_FLAGS_P2P_CAPABLE:代表Wifi驱动对P2P支持的能力
	if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE))
		return 0;
    //判断全局参数p2p是否已被赋值
	if (global->p2p)
		return 0;
    //wpas_p2p_mac_setup中主要针对P2p的随机地址做判断
	if (wpas_p2p_mac_setup(wpa_s) < 0) {
		wpa_msg(wpa_s, MSG_ERROR,
			"Failed to initialize P2P random MAC address.");
		return -1;
	}
   

你可能感兴趣的:(WIFI,p2p,c语言,asp.net)