EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the definition of the command processor functions. More...
#include <stdbool.h>
#include <sys/types.h>
#include <sys/un.h>
#include <utarray.h>
#include "../utils/sockctl.h"
#include "supervisor_config.h"
Go to the source code of this file.
Macros | |
#define | CMD_PING "PING_SUPERVISOR" |
#define | CMD_SET_IP "SET_IP" |
#define | CMD_SUBSCRIBE_EVENTS "SUBSCRIBE_EVENTS" |
#define | CMD_ACCEPT_MAC "ACCEPT_MAC" |
#define | CMD_DENY_MAC "DENY_MAC" |
#define | CMD_ADD_NAT "ADD_NAT" |
#define | CMD_REMOVE_NAT "REMOVE_NAT" |
#define | CMD_ASSIGN_PSK "ASSIGN_PSK" |
#define | CMD_GET_MAP "GET_MAP" |
#define | CMD_GET_ALL "GET_ALL" |
#define | CMD_ADD_BRIDGE "ADD_BRIDGE" |
#define | CMD_REMOVE_BRIDGE "REMOVE_BRIDGE" |
#define | CMD_CLEAR_BRIDGES "CLEAR_BRIDGE" |
#define | CMD_GET_BRIDGES "GET_BRIDGES" |
#define | CMD_REGISTER_TICKET "REGISTER_TICKET" |
#define | CMD_CLEAR_PSK "CLEAR_PSK" |
#define | CMD_DELIMITER '\x20' |
#define | OK_REPLY "OK\n" |
#define | FAIL_REPLY "FAIL\n" |
#define | MAX_QUERY_OP_LEN 3 |
Typedefs | |
typedef ssize_t(* | process_cmd_fn) (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Functions | |
bool | process_domain_buffer (char *domain_buffer, size_t domain_buffer_len, UT_array *cmd_arr, char sep) |
Processes the domain command string. More... | |
ssize_t | process_ping_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the PING command. More... | |
ssize_t | process_subscribe_events_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the SUBSCRIBE_EVENTS command. More... | |
ssize_t | process_accept_mac_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the ACCEPT_MAC command. More... | |
ssize_t | process_deny_mac_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the DENY_MAC command. More... | |
ssize_t | process_add_nat_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the ADD_NAT command. More... | |
ssize_t | process_remove_nat_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the REMOVE_NAT command. More... | |
ssize_t | process_assign_psk_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the ASSIGN_PSK command. More... | |
ssize_t | process_get_map_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the GET_MAP command. More... | |
ssize_t | process_get_all_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the GET_ALL command. More... | |
ssize_t | process_set_ip_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the SET_IP command. More... | |
ssize_t | process_add_bridge_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the ADD_BRIDGE command. More... | |
ssize_t | process_remove_bridge_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the REMOVE_BRIDGE command. More... | |
ssize_t | process_clear_bridges_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the CLEAR_BRIDGES command. More... | |
ssize_t | process_get_bridges_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the GET_BRIDGES command. More... | |
ssize_t | process_set_fingerprint_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the SET_FINGERPRINT command. More... | |
ssize_t | process_query_fingerprint_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the QUERY_FINGERPRINT command. More... | |
ssize_t | process_register_ticket_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the REGISTER_TICKET command. More... | |
ssize_t | process_clear_psk_cmd (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
Processes the CLEAR_PSK command. More... | |
process_cmd_fn | get_command_function (const char *cmd) |
Get the command function pointer. More... | |
File containing the definition of the command processor functions.
#define CMD_ACCEPT_MAC "ACCEPT_MAC" |
#define CMD_ADD_BRIDGE "ADD_BRIDGE" |
#define CMD_ADD_NAT "ADD_NAT" |
#define CMD_ASSIGN_PSK "ASSIGN_PSK" |
#define CMD_CLEAR_BRIDGES "CLEAR_BRIDGE" |
#define CMD_CLEAR_PSK "CLEAR_PSK" |
#define CMD_DELIMITER '\x20' |
#define CMD_DENY_MAC "DENY_MAC" |
#define CMD_GET_ALL "GET_ALL" |
#define CMD_GET_BRIDGES "GET_BRIDGES" |
#define CMD_GET_MAP "GET_MAP" |
#define CMD_PING "PING_SUPERVISOR" |
#define CMD_REGISTER_TICKET "REGISTER_TICKET" |
#define CMD_REMOVE_BRIDGE "REMOVE_BRIDGE" |
#define CMD_REMOVE_NAT "REMOVE_NAT" |
#define CMD_SET_IP "SET_IP" |
#define CMD_SUBSCRIBE_EVENTS "SUBSCRIBE_EVENTS" |
#define FAIL_REPLY "FAIL\n" |
#define MAX_QUERY_OP_LEN 3 |
#define OK_REPLY "OK\n" |
typedef ssize_t(* process_cmd_fn) (int sock, const struct client_address *client_addr, struct supervisor_context *context, UT_array *cmd_arr) |
process_cmd_fn get_command_function | ( | const char * | cmd | ) |
Get the command function pointer.
cmd | The command string |
ssize_t process_accept_mac_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the ACCEPT_MAC command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_add_bridge_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the ADD_BRIDGE command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_add_nat_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the ADD_NAT command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_assign_psk_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the ASSIGN_PSK command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_clear_bridges_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the CLEAR_BRIDGES command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_clear_psk_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the CLEAR_PSK command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_deny_mac_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the DENY_MAC command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
bool process_domain_buffer | ( | char * | domain_buffer, |
size_t | domain_buffer_len, | ||
UT_array * | cmd_arr, | ||
char | sep | ||
) |
Processes the domain command string.
domain_buffer | The domain command string |
domain_buffer_len | The domain command string length |
cmd_arr | The processed command array |
sep | The string separator |
ssize_t process_get_all_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the GET_ALL command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
-1
on failure ssize_t process_get_bridges_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the GET_BRIDGES command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_get_map_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the GET_MAP command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_ping_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the PING command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_query_fingerprint_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the QUERY_FINGERPRINT command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_register_ticket_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the REGISTER_TICKET command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
strlen(FAIL_REPLY)
on error. ssize_t process_remove_bridge_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the REMOVE_BRIDGE command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_remove_nat_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the REMOVE_NAT command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_set_fingerprint_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the SET_FINGERPRINT command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_set_ip_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the SET_IP command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |
ssize_t process_subscribe_events_cmd | ( | int | sock, |
const struct client_address * | client_addr, | ||
struct supervisor_context * | context, | ||
UT_array * | cmd_arr | ||
) |
Processes the SUBSCRIBE_EVENTS command.
sock | The domain server socket |
client_addr | The client address for replies |
context | The supervisor structure instance |
cmd_arr | The array of received commands |