EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Data Structures | Macros | Typedefs | Functions
ap_service.h File Reference

File containing the definition of the ap service. More...

#include <stdbool.h>
#include <sys/types.h>
#include "../radius/radius_server.h"
#include "../supervisor/supervisor_config.h"
#include "../utils/allocs.h"
#include "../utils/iface.h"
#include "../utils/os.h"
#include "ap_config.h"
Include dependency graph for ap_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  run_ap_callback_fn_struct
 

Macros

#define ATTACH_AP_COMMAND   "ATTACH"
 
#define STA_AP_COMMAND    "STA" /* Command name to check if a station is registered */
 
#define GENERIC_AP_COMMAND_OK_REPLY   "OK" /* The command response on succes */
 
#define GENERIC_AP_COMMAND_FAIL_REPLY    "FAIL" /* The command response on failure */
 
#define PING_AP_COMMAND   "PING" /* Command name to ping the hostapd daemon */
 
#define PING_AP_COMMAND_REPLY   "PONG" /* Reply to the ping command */
 
#define DENYACL_ADD_COMMAND    "DENY_ACL ADD_MAC" /* Command name to add a station to the deny ACL */
 
#define DENYACL_DEL_COMMAND    "DENY_ACL DEL_MAC" /* Command name to remove a station from the deny ACL */
 

Typedefs

typedef void(* ap_service_fn) (struct supervisor_context *context, uint8_t mac_addr[], enum AP_CONNECTION_STATUS status)
 

Functions

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...
 
int ping_ap_command (struct apconf *hconf)
 Pings the hostapd daemon. More...
 
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...
 

Detailed Description

File containing the definition of the ap service.

Author
Alexandru Mereacre
Date
2020

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.

Macro Definition Documentation

◆ ATTACH_AP_COMMAND

#define ATTACH_AP_COMMAND   "ATTACH"

◆ DENYACL_ADD_COMMAND

#define DENYACL_ADD_COMMAND    "DENY_ACL ADD_MAC" /* Command name to add a station to the deny ACL */

◆ DENYACL_DEL_COMMAND

#define DENYACL_DEL_COMMAND    "DENY_ACL DEL_MAC" /* Command name to remove a station from the deny ACL */

◆ GENERIC_AP_COMMAND_FAIL_REPLY

#define GENERIC_AP_COMMAND_FAIL_REPLY    "FAIL" /* The command response on failure */

◆ GENERIC_AP_COMMAND_OK_REPLY

#define GENERIC_AP_COMMAND_OK_REPLY   "OK" /* The command response on succes */

◆ PING_AP_COMMAND

#define PING_AP_COMMAND   "PING" /* Command name to ping the hostapd daemon */

◆ PING_AP_COMMAND_REPLY

#define PING_AP_COMMAND_REPLY   "PONG" /* Reply to the ping command */

◆ STA_AP_COMMAND

#define STA_AP_COMMAND    "STA" /* Command name to check if a station is registered */

Typedef Documentation

◆ ap_service_fn

typedef void(* ap_service_fn) (struct supervisor_context *context, uint8_t mac_addr[], enum AP_CONNECTION_STATUS status)

Type of callback for AP service in run_ap()

Function Documentation

◆ check_sta_ap_command()

int check_sta_ap_command ( struct apconf hconf,
const char *  mac_addr 
)

Check if a station is registered on the AP.

Parameters
hconfAP config structure
mac_addrThe mac address of the station
Returns
int 0 on success, -1 on failure

◆ close_ap()

bool close_ap ( struct supervisor_context context)

Closes (terminates) AP process.

Parameters
contextThe supervisor context structure
Returns
true success, false otherwise

◆ denyacl_add_ap_command()

int denyacl_add_ap_command ( struct apconf hconf,
const char *  mac_addr 
)

Deny ACL ADD AP command.

Parameters
hconfAP config structure
mac_addrThe mac address to add to deny list
Returns
int 0 on success, -1 on failure

◆ denyacl_del_ap_command()

int denyacl_del_ap_command ( struct apconf hconf,
const char *  mac_addr 
)

Deny ACL DEL AP command.

Parameters
hconfAP config structure
mac_addrThe mac address to remove from deny list
Returns
int 0 on success, -1 on failure

◆ disconnect_ap_command()

int disconnect_ap_command ( struct apconf hconf,
const char *  mac_addr 
)

Disconnect and reconnect a MAC device from the AP.

Parameters
hconfAP config structure
mac_addrThe mac address to disconnect
Returns
int 0 on success, -1 on failure

◆ ping_ap_command()

int ping_ap_command ( struct apconf hconf)

Pings the hostapd daemon.

Parameters
hconfAP config structure
Return values
<tt>0</tt>if the hostapd daemon responded okay.
<tt>-1</tt>if the hostapd daemon didn't respond or had an invalid response.

◆ run_ap()

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.

Parameters
contextThe supervisor context structure
exec_apFlag to execute/signal the AP process
generate_ssidFlag to generate the SSID for AP
[in]ap_callback_fnA stuct containing the callback for AP service
Returns
int 0 on success, -1 on failure