EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the command processor functions. More...
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/un.h>
#include "cmd_processor.h"
#include "mac_mapper.h"
#include "network_commands.h"
#include "system_commands.h"
#include "utils/allocs.h"
#include "utils/base64.h"
#include "utils/log.h"
#include "utils/net.h"
#include "utils/os.h"
#include "utils/sockctl.h"
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... | |
int | write_newline_socket_data (int sock, char *data, const struct client_address *client_addr) |
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_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 implementation of the command processor functions.
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_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_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 |
int write_newline_socket_data | ( | int | sock, |
char * | data, | ||
const struct client_address * | client_addr | ||
) |