recuperator fan control with esp32
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
esp-recuperator/main/console/telnet_parser.h

48 lines
1.6 KiB

/**
* Telnet middleware that handles characters read by console and acts on telnet escapes,
* removing them from the stream
*
* Created on 2019/02/17.
*/
#ifndef CSPEMU_TELNET_PARSER_H
#define CSPEMU_TELNET_PARSER_H
#include <console/cmddef.h>
/**
* Process a buffer of received characters, handling and removing telnet codes.
* The buffer is modified in place and the number of data characters is returned.
*
* @param[in,out] buffer - buffer to process
* @param len - original number of characters in the buffer
* @return - number of characters left in the buffer, to be passed to the console handler
*/
size_t telnet_middleware_read(console_ctx_t *cctx, uint8_t *buffer, size_t len);
enum telnet_option {
OPT_BINARY = 0,
OPT_ECHO = 1,
OPT_SUPPRESS_GO_AHEAD = 3,
OPT_STATUS = 5,
OPT_TIMING_MARK = 6,
OPT_TERMINAL_TYPE = 24,
OPT_END_OF_RECORD = 25,
OPT_NEGOTIATE_WINDOW_SIZE = 31,
OPT_NEGOTIATE_TERMINAL_SPEED = 32,
OPT_REMOTE_FLOW_CONTROL = 33,
// OPT_COMPORT_OPTION = 34, - according to RFC, but seems replaced by...
OPT_LINEMODE = 34,
OPT_X_DISPLAY_LOCATION = 35,
OPT_NEW_ENVIRON = 39,
OPT_EXOPL = 255,
};
void telnet_send_subnegotiate(console_ctx_t *cctx, enum telnet_option opt, const uint8_t *data, size_t len);
void telnet_send_will(console_ctx_t *cctx, enum telnet_option opt);
void telnet_send_wont(console_ctx_t *cctx, enum telnet_option opt);
void telnet_send_do(console_ctx_t *cctx, enum telnet_option opt);
void telnet_send_dont(console_ctx_t *cctx, enum telnet_option opt);
#endif //CSPEMU_TELNET_PARSER_H