EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the hostapd service. More...
#include <errno.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "ap_config.h"
#include "ap_service.h"
#include "hostapd.h"
#include <eloop.h>
#include "../radius/radius_server.h"
#include "../supervisor/supervisor_config.h"
#include "../utils/allocs.h"
#include "../utils/iface.h"
#include "../utils/log.h"
#include "../utils/os.h"
#include "../utils/sockctl.h"
Macros | |
#define | AP_STA_DISCONNECTED "AP-STA-DISCONNECTED" |
#define | AP_STA_CONNECTED "AP-STA-CONNECTED" |
Functions | |
int | ping_ap_command (struct apconf *hconf) |
Pings the hostapd daemon. More... | |
int | denyacl_ap_command (struct apconf *hconf, const char *cmd, const char *mac_addr) |
int | denyacl_add_ap_command (struct apconf *hconf, const char *mac_addr) |
Deny ACL ADD AP command. More... | |
int | denyacl_del_ap_command (struct apconf *hconf, const char *mac_addr) |
Deny ACL DEL AP command. More... | |
int | disconnect_ap_command (struct apconf *hconf, const char *mac_addr) |
Disconnect and reconnect a MAC device from the AP. More... | |
int | check_sta_ap_command (struct apconf *hconf, const char *mac_addr) |
Check if a station is registered on the AP. More... | |
int | find_ap_status (const char *ap_answer, uint8_t mac_addr[static ETHER_ADDR_LEN], enum AP_CONNECTION_STATUS *status) |
Finds the stauts of the given access point. More... | |
void | ap_sock_handler (int sock, void *eloop_ctx, void *sock_ctx) |
int | register_ap_event (struct supervisor_context *context, struct run_ap_callback_fn_struct *ap_callback_fn) |
int | run_ap (struct supervisor_context *context, bool exec_ap, bool generate_ssid, struct run_ap_callback_fn_struct *ap_callback_fn) |
Runs the AP service. More... | |
bool | close_ap (struct supervisor_context *context) |
Closes (terminates) AP process. More... | |
File containing the implementation of the hostapd service.
Defines the functions to start and stop the acces point service (AP). It also defines auxiliary commands to manage the acces control list for stations connected to the AP.
#define AP_STA_CONNECTED "AP-STA-CONNECTED" |
#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED" |
void ap_sock_handler | ( | int | sock, |
void * | eloop_ctx, | ||
void * | sock_ctx | ||
) |
int check_sta_ap_command | ( | struct apconf * | hconf, |
const char * | mac_addr | ||
) |
Check if a station is registered on the AP.
hconf | AP config structure |
mac_addr | The mac address of the station |
bool close_ap | ( | struct supervisor_context * | context | ) |
Closes (terminates) AP process.
context | The supervisor context structure |
int denyacl_add_ap_command | ( | struct apconf * | hconf, |
const char * | mac_addr | ||
) |
Deny ACL ADD AP command.
hconf | AP config structure |
mac_addr | The mac address to add to deny list |
int denyacl_ap_command | ( | struct apconf * | hconf, |
const char * | cmd, | ||
const char * | mac_addr | ||
) |
int denyacl_del_ap_command | ( | struct apconf * | hconf, |
const char * | mac_addr | ||
) |
Deny ACL DEL AP command.
hconf | AP config structure |
mac_addr | The mac address to remove from deny list |
int disconnect_ap_command | ( | struct apconf * | hconf, |
const char * | mac_addr | ||
) |
Disconnect and reconnect a MAC device from the AP.
hconf | AP config structure |
mac_addr | The mac address to disconnect |
int find_ap_status | ( | const char * | ap_answer, |
uint8_t | mac_addr[static ETHER_ADDR_LEN], | ||
enum AP_CONNECTION_STATUS * | status | ||
) |
Finds the stauts of the given access point.
ap_answer | Response from ap socket. | |
[out] | mac_addr | The MAC address of the AP. |
[out] | status | Outputs the the status of the AP to this variable. |
0 | Sucess. |
-1 | Error. No valid AP status found in the ap_answer string. |
int ping_ap_command | ( | struct apconf * | hconf | ) |
Pings the hostapd daemon.
hconf | AP config structure |
<tt>0</tt> | if the hostapd daemon responded okay. |
<tt>-1</tt> | if the hostapd daemon didn't respond or had an invalid response. |
int register_ap_event | ( | struct supervisor_context * | context, |
struct run_ap_callback_fn_struct * | ap_callback_fn | ||
) |
int run_ap | ( | struct supervisor_context * | context, |
bool | exec_ap, | ||
bool | generate_ssid, | ||
struct run_ap_callback_fn_struct * | ap_callback_fn | ||
) |
Runs the AP service.
context | The supervisor context structure | |
exec_ap | Flag to execute/signal the AP process | |
generate_ssid | Flag to generate the SSID for AP | |
[in] | ap_callback_fn | A stuct containing the callback for AP service |