1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/pkg/edhoc_c/main.c
2024-02-12 18:23:54 +01:00

77 lines
1.7 KiB
C

/*
* Copyright (C) 2021 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief EDHOC handhshake over COAP using EDHOC-C
*
* @author Timothy Claeys <timothy.claeys@inria.fr>
* @author Francisco Molina <francois-xavier.molina@inria.fr>
*/
#include <stdio.h>
#include "net/nanocoap_sock.h"
#include "shell.h"
#include "thread.h"
#include "edhoc/edhoc.h"
#include "edhoc_keys.h"
#define MAIN_QUEUE_SIZE (4)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
#if IS_ACTIVE(CONFIG_RESPONDER)
extern int responder_cli_init(void);
extern int responder_cmd(int argc, char **argv);
#endif
#if IS_ACTIVE(CONFIG_INITIATOR)
extern int initiator_cmd(int argc, char **argv);
extern int initiator_cli_init(void);
#endif
static const shell_command_t shell_commands[] = {
#if IS_ACTIVE(CONFIG_INITIATOR)
{ "init", "EDHOC Initiator cli", initiator_cmd },
#endif
#if IS_ACTIVE(CONFIG_RESPONDER)
{ "resp", "EDHOC Responder cli", responder_cmd },
#endif
{ NULL, NULL, NULL }
};
int main(void)
{
#if IS_ACTIVE(CONFIG_INITIATOR)
if (initiator_cli_init()) {
return -1;
}
#endif
#if IS_ACTIVE(CONFIG_RESPONDER)
if (responder_cli_init()) {
return -1;
}
#endif
/* the shell contains commands that receive packets via GNRC and thus
needs a msg queue */
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
puts("Starting the shell");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
/* should be never reached */
return 0;
}