#ifndef __CLI_H #define __CLI_H #include #include #include "FreeRTOS.h" #include "fr_timers.h" #include "settings_api.h" /* Dimensions the buffer into which input characters are placed. */ #define cmdMAX_INPUT_SIZE 144 #define MAX_SESSIONS 2 typedef enum{ CLI_AUTH = 0, CLI_AUTH_PASSW, CLI_CMD, CLI_CHANGE_PWD, CLI_CHANGE_PWD_ACK } input_state_t; typedef enum { STATE_UNUSED, STATE_NORMAL, STATE_IAC, STATE_OPT, STATE_SB, STATE_OPTDAT, STATE_SE, STATE_CLOSE, } conn_state_t; /** * A cli connection structure. */ typedef struct { TimerHandle_t RepeatSensorInfoTimer; conn_state_t state; // uint8_t code; char buf[cmdMAX_INPUT_SIZE]; uint_fast8_t bufptr; char prev_cmd[cmdMAX_INPUT_SIZE]; unsigned char optdata[cmdMAX_INPUT_SIZE]; uint8_t optlen; input_state_t input_state; user_level_t user_id; char login[MAX_WEB_LOGIN_LEN]; uint8_t login_err; // the number of failed password entry attempts // bool active_conn; bool flag_telnet_ip_option; // wtf is this //send( cli_states[num_timer].num_connect, pcOutputString, strlen( ( const char * ) pcOutputString ), 0 ); void (*send)(intptr_t fd, const char *str, unsigned len); intptr_t num_connect; // fd } cli_state_t; void cli_init(void); void cli_getchar(cli_state_t *s, char incoming_char); cli_state_t *alloc_state(void); void cli_hello(cli_state_t *cli_state); user_level_t cli_auth_user(char *user, char *password); #endif