aboutsummaryrefslogtreecommitdiff
path: root/src/telnet.h
blob: 673ad1c75ccba647d0234c6a49621229ac8471c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 *   NetCosm - a MUD server
 *   Copyright (C) 2016 Franklin Wei
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

/* commands */
#define IAC  255
#define DONT 254
#define DO   253
#define WONT 252
#define WILL 251
#define SB   250
#define GA   249
#define EL   248
#define EC   247
#define AYT  246
#define IP   244
#define NOP  241
#define SE   240

/* options */
#define ECHO     1
#define SGA      3
#define STATUS   5
#define NAWS     31
#define LINEMODE 34

void telnet_init(void);

#define TELNET_OK 0
#define TELNET_EXIT 1

/* returns either 0 or TELNET_EXIT */
int telnet_handle_command(const unsigned char*);

void telnet_echo_on(void);
void telnet_echo_off(void);