/*
 * wireless_struct.h
 * This file is part of Network-Inador
 *
 * Copyright (C) 2024 - Félix Arreola Rodríguez
 *
 * Network-Inador is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Network-Inador is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Network-Inador; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, 
 * Boston, MA  02110-1301  USA
 */

#ifndef __WIRELESS_STRUCT_H__
#define __WIRELESS_STRUCT_H__

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>

#include <net/ethernet.h>

#include <netlink/socket.h>
#include <netlink/msg.h>

#include "flist.h"

#define SSID_MAX_LEN 32

typedef struct _WirelessBSS {
	/** Number of counts without seeing this BSS */
	unsigned int scan_miss_count;
	/** Index of the last scan update */
	unsigned int last_update_idx;
	
	/** BSSID */
	uint8_t bssid[ETHER_ADDR_LEN * 2 + 1];
	/** HESSID */
	//u8 hessid[ETHER_ADDR_LEN * 2 + 1];
	/** SSID */
	uint8_t ssid[SSID_MAX_LEN];
	/** Length of SSID */
	size_t ssid_len;
	/** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
	int freq;
	/** Capability information field in host byte order */
	uint16_t caps;
	/** Timestamp of last Beacon/Probe Response frame */
	uint64_t tsf;
	/** Time of the last update (i.e., Beacon or Probe Response RX) */
	struct timespec last_update;
} WirelessBSS;

typedef struct _WirelessInfo {
	int phy;
	uint32_t *freqs;
	int num_freqs;
	uint32_t caps;
	uint8_t can_scan;
	uint8_t can_scan_ssid;
	uint8_t supported;
	
	unsigned int bss_update_idx;
	FList *aps;
} WirelessInfo;

#endif /* __WIRELESS_STRUCT_H__ */