EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Macros | Functions
hostapd.c File Reference

File containing the implementation of hostapd config generation utilities. More...

#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "ap_config.h"
#include "utils/allocs.h"
#include "utils/iface.h"
#include "utils/log.h"
#include "utils/os.h"
Include dependency graph for hostapd.c:

Macros

#define WITH_HOSTAPD_UCI
 
#define HOSTAPD_LOG_FILE_OPTION   "-f"
 
#define PROCESS_RESTART_TIME   5 /* In seconds */
 
#define MAX_AP_CHECK_COUNT   5 /* Number of tries */
 

Functions

int generate_vlan_conf (char *vlan_file, char *interface)
 Generates and save the VLAN configuration file. More...
 
int generate_hostapd_conf (struct apconf *hconf, struct radius_conf *rconf)
 Generates and saves the hostapd configuration files. More...
 
void get_hostapd_args (const char *hostapd_bin_path, const char *hostapd_file_path, const char *hostapd_log_path, const char *argv[static 5])
 
int check_ap_running (char *name, char *if_name, int wait_time)
 
int run_ap_process (struct apconf *hconf)
 Executes the hostapd process. More...
 
bool kill_ap_process (void)
 Terminate the AP service. More...
 
int signal_ap_process (const struct apconf *hconf)
 Signal the AP process to reload the config. More...
 

Detailed Description

File containing the implementation of hostapd config generation utilities.

Author
Alexandru Mereacre
Date
2021

Defines function that generate the hostapd daemon configuration file and manages (execute, kill and signal) the hostapd process.

Macro Definition Documentation

◆ HOSTAPD_LOG_FILE_OPTION

#define HOSTAPD_LOG_FILE_OPTION   "-f"

◆ MAX_AP_CHECK_COUNT

#define MAX_AP_CHECK_COUNT   5 /* Number of tries */

◆ PROCESS_RESTART_TIME

#define PROCESS_RESTART_TIME   5 /* In seconds */

◆ WITH_HOSTAPD_UCI

#define WITH_HOSTAPD_UCI

Function Documentation

◆ check_ap_running()

int check_ap_running ( char *  name,
char *  if_name,
int  wait_time 
)

◆ generate_hostapd_conf()

int generate_hostapd_conf ( struct apconf hconf,
struct radius_conf rconf 
)

Generates and saves the hostapd configuration files.

Parameters
hconfThe hostapd configuration structure
rconfThe radius configuration structure
Returns
0 if config file saved, -1 otherwise

◆ generate_vlan_conf()

int generate_vlan_conf ( char *  vlan_file,
char *  interface 
)

Generates and save the VLAN configuration file.

Parameters
vlan_fileThe VLAN configuration file path
interfaceThe WiFi AP interface name
Returns
0 if VLAN config file saved, -1 otherwise

◆ get_hostapd_args()

void get_hostapd_args ( const char *  hostapd_bin_path,
const char *  hostapd_file_path,
const char *  hostapd_log_path,
const char *  argv[static 5] 
)

◆ kill_ap_process()

bool kill_ap_process ( void  )

Terminate the AP service.

Returns
bool true on success, false otherwise

◆ run_ap_process()

int run_ap_process ( struct apconf hconf)

Executes the hostapd process.

Parameters
hconfThe hostapd process config structure
Returns
int 0 on success, -1 on failure

◆ signal_ap_process()

int signal_ap_process ( const struct apconf hconf)

Signal the AP process to reload the config.

Parameters
hconfThe hostapd process config structure
Returns
int 0 on success, -1 on failure