moxanix/moxerver/telnet.h
2017-01-11 17:30:13 +01:00

29 lines
1 KiB
C

/* Handles details related to telnet protocol. */
#pragma once
#include <common.h>
#define TELNET_MSG_LEN_CHARMODE 9
/**
* Creates a telnet protocol message that tells client to go into "character"
* mode. The passed data buffer must be big enough to hold the message payload
* with the size defined by TELNET_MSG_LEN_CHARMODE.
* Operates directly on the passed data buffer.
*/
void telnet_message_set_character_mode(char *databuf);
/**
* Handles special characters in the data buffer after receiving them from the
* client. Used to filter out the handshake commands of telnet protocol.
* Operates directly on the passed data buffer and modifies the payload length.
*/
void telnet_filter_client_read(char *databuf, int *datalen);
/**
* Handles special characters in the data buffer before sending them to the
* client. Used to correctly echo the characters to the telnet client.
* Operates directly on the passed data buffer and modifies the payload length.
*/
void telnet_filter_client_write(char *databuf, int *datalen);