blob: fd217a2eff3603c07422b8153f2fe0992faaec68 [file] [log] [blame]
Sean Middleditchb9e48642009-03-12 23:33:27 -04001=====================================================================
2 libtelnet - TELNET protocol handling library
3=====================================================================
4
Sean Middleditch892c5f12009-03-14 13:39:07 -04005 http://github.com/elanthis/libtelnet
6
7 Sean Middleditch
8 sean@sourcemud.org
Sean Middleditchb9e48642009-03-12 23:33:27 -04009
10---------------------------------------------------------------------
11The author or authors of this code dedicate any and all copyright
12interest in this code to the public domain. We make this dedication
13for the benefit of the public at large and to the detriment of our
14heirs and successors. We intend this dedication to be an overt act of
15relinquishment in perpetuity of all present and future rights to this
16code under copyright law.
17---------------------------------------------------------------------
18
Sean Middleditch9d2f98a2009-03-14 05:24:56 -040019*** TODO ***
20
Sean Middleditch9d2f98a2009-03-14 05:24:56 -040021 - automatic MCCP2 handling (controllable by host app)
Sean Middleditch9d2f98a2009-03-14 05:24:56 -040022 ? ZMP parsing
23 ? MSSP parsing
24 ? ENVIRON/NEW-ENVIRON parsing
25 ? telnet-status testing tool
Sean Middleditch9d2f98a2009-03-14 05:24:56 -040026
Sean Middleditchb9e48642009-03-12 23:33:27 -040027I. INTRODUCTION
28=====================================================================
29
30libtelnet provides safe and correct handling of the core TELNET
Sean Middleditch8b788962009-03-16 01:06:27 -040031protocol. In addition to the base TELNET protocol, libtelnet also
32implements the Q method of TELNET option negotiation. libtelnet
33can be used for writing servers, clients, or proxies.
Sean Middleditchb9e48642009-03-12 23:33:27 -040034
Sean Middleditch892c5f12009-03-14 13:39:07 -040035For more information on the TELNET protocol, see:
36
37 http://www.faqs.org/rfcs/rfc854.html
Sean Middleditch8b788962009-03-16 01:06:27 -040038 http://www.faqs.org/rfcs/rfc1143.html
Sean Middleditch892c5f12009-03-14 13:39:07 -040039
Sean Middleditchb9e48642009-03-12 23:33:27 -040040II. LIBTELNET API
41=====================================================================
42
Sean Middleditch892c5f12009-03-14 13:39:07 -040043The libtelnet API contains several distinct parts. The first part is
44the basic initialization and deinitialization routines. The second
45part is a single function for pushing received data into the
46libtelnet processor. The third part is the libtelnet_send_*()
47functions, which generate TELNET commands and ensure data is properly
Sean Middleditch637df7f2009-03-15 12:57:32 -040048formatted before sending over the wire. The final part is the event
49handler interface.
Sean Middleditch892c5f12009-03-14 13:39:07 -040050
51IIa. Initialization
52
53 struct libtelnet_t;
54 This structure represents the state of the TELNET protocol for a
55 single connection. Each connection utilizing TELNET must have
56 its own libtelnet_t structure, which is passed to all libtelnet
57 API calls.
58
Sean Middleditch812358d2009-03-15 23:24:03 -040059 void libtelnet_init(libtelnet_t *telnet, libtelnet_event_handler_t handler,
Sean Middleditch08bb05f2009-03-15 23:29:46 -040060 unsigned char flags, void *user_data);
Sean Middleditch892c5f12009-03-14 13:39:07 -040061 The libtelnet_init() function is responsible for initializing
62 the data in a libtelnet_t structure. It must be called
63 immediately after establishing a connection and before any other
64 libtelnet API calls are made.
65
Sean Middleditch637df7f2009-03-15 12:57:32 -040066 The handler parameter must be a function matching the
67 libtelnet_event_handler_t definition. More information about
68 events can be found in section IId.
Sean Middleditch30323022009-03-14 21:45:28 -040069
Sean Middleditch9f79cc52009-03-15 13:39:24 -040070 The user_data parameter is passed to the event handler whenver it
71 is invoked. This will usually be a structure container
72 information about the connection, including a socket descriptor
73 for implementing LIBTELNET_EV_SEND event handling.
74
Sean Middleditch08bb05f2009-03-15 23:29:46 -040075 The flags parameter can be any of the following flag constants
76 bit-or'd together, or 0 to leave all options disabled.
77
Sean Middleditchc337ba62009-03-16 16:47:27 -040078 LIBTELNET_FLAG_PROXY
79 Operate in proxy mode. This disables the RFC1143 support and
80 enables automatic detection of COMPRESS2 streams.
81
82 LIBTELNET_FLAG_AUTO_CRLF
83 Automatically translate C newlines (\n) into the TELNET
84 newline marker, CRLF (\r\n). This also translates the C
85 carriage return (\r) into the TELNET-correct CRNUL (\r\0).
86
87 Note that this only affects data that is sent. Received
88 data is untranslated, even with this flag set.
Sean Middleditch892c5f12009-03-14 13:39:07 -040089
Sean Middleditch812358d2009-03-15 23:24:03 -040090 boid libtelnet_free(libtelnet_t *telnet);
Sean Middleditch892c5f12009-03-14 13:39:07 -040091 Releases any internal memory allocated by libtelnet. This must
92 be called whenever a connection is closed, or you will incur
93 memory leaks.
94
95IIb. Receiving Data
96
Sean Middleditch812358d2009-03-15 23:24:03 -040097 void libtelnet_push(libtelnet_t *telnet,
Sean Middleditch97a8cb22009-03-16 16:51:41 -040098 const unsigned char *buffer, unsigned int size, void *user_data);
Sean Middleditch892c5f12009-03-14 13:39:07 -040099 When your application receives data over the socket from the
100 remote end, it must pass the received bytes into this function.
Sean Middleditch637df7f2009-03-15 12:57:32 -0400101
102 As the TELNET stream is parsed, events will be generated and
103 passed to the event handler given to libtelnet_init(). Of
104 particular interest for data receiving is the LIBTELNET_EV_DATA
105 event, which is triggered for any regular data such as user
106 input or server process output.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400107
108IIc. Sending Data
109
Sean Middleditch637df7f2009-03-15 12:57:32 -0400110 All of the libtelnet_send_*() functions will invoke the
Sean Middleditch9f79cc52009-03-15 13:39:24 -0400111 LIBTELNET_EV_SEND event.
Sean Middleditch637df7f2009-03-15 12:57:32 -0400112
113 Note: it is very important that ALL data sent to the remote end of
114 the connection be passed through libtelnet. All user input or
115 process output that you wish to send over the wire should be given
116 to libtelnet_send_data(). Do NOT send or buffer unprocessed output
117 data directly!
Sean Middleditch892c5f12009-03-14 13:39:07 -0400118
Sean Middleditch812358d2009-03-15 23:24:03 -0400119 void libtelnet_send_command(libtelnet_t *telnet, unsigned char cmd);
Sean Middleditch892c5f12009-03-14 13:39:07 -0400120 Sends a single "simple" TELNET command, such as the GO-AHEAD
121 commands (255 249).
122
Sean Middleditch2b4bfc42009-03-16 01:25:52 -0400123 void libtelnet_send_command(libtelnet_t *telnet, unsigned char cmd,
124 unsigned char telopt);
125 Sends a TELNET command with an option code following. This is
126 only useful for the WILL, WONT, DO, DONT, and SB commands.
127
Sean Middleditch812358d2009-03-15 23:24:03 -0400128 void libtelnet_send_negotiate(libtelnet_t *telnet,
Sean Middleditch9f79cc52009-03-15 13:39:24 -0400129 unsigned char cmd, unsigned char opt);
Sean Middleditch892c5f12009-03-14 13:39:07 -0400130 Sends a TELNET negotiation command. The cmd parameter must be
131 one of LIBTELNET_WILL, LIBTELNET_DONT, LIBTELNET_DO, or
132 LIBTELNET_DONT. The opt parameter is the option to
133 negotiate.
134
Sean Middleditch97a8cb22009-03-16 16:51:41 -0400135 void libtelnet_send_data(libtelnet_t *telnet,
136 const unsigned char *buffer, unsigned int size);
Sean Middleditch892c5f12009-03-14 13:39:07 -0400137 Sends raw data, which would be either the process output from
138 a server or the user input from a client.
139
Sean Middleditch812358d2009-03-15 23:24:03 -0400140 void libtelnet_send_subnegotiation(libtelnet_t *telnet,
Sean Middleditch97a8cb22009-03-16 16:51:41 -0400141 unsigned char telopt, const unsigned char *buffer,
142 unsigned int size);
Sean Middleditch2b4bfc42009-03-16 01:25:52 -0400143 Sends a TELNET sub-negotiation command. The telopt parameter
Sean Middleditch892c5f12009-03-14 13:39:07 -0400144 is the sub-negotiation option.
145
Sean Middleditch2b4bfc42009-03-16 01:25:52 -0400146 Note that the above function is just a shorthand for:
147 libtelnet_send_telopt(telnet, LIBTELNET_SB, telopt);
148 libtelnet_send_data(telnet, buffer, size);
149 libtelnet_send_command(telnet, LIBTELNET_SE);
150
151 For some subnegotiations that involve a lot of complex formatted
152 data to be sent, it may be easier to manually send the SB telopt
153 header and SE footer around mulitple calls to send_data.
154
155 NOTE: libtelnet_send_subrequest() does have special behavior in
156 PROXY mode, as in that mode this function will automatically
157 detect the COMPRESS2 marker and enable zlib compression.
158
Sean Middleditch637df7f2009-03-15 12:57:32 -0400159IId. Event Handling
Sean Middleditch892c5f12009-03-14 13:39:07 -0400160
Sean Middleditch637df7f2009-03-15 12:57:32 -0400161 libtelnet relies on an event-handling mechanism for processing
162 the parsed TELNET protocol stream as well as for buffering and
163 sending output data.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400164
Sean Middleditch637df7f2009-03-15 12:57:32 -0400165 When you initialize a libtelnet_t structure with libtelnet_init()
166 you had to pass in an event handler function. This function must
167 meet the following prototype:
Sean Middleditch30323022009-03-14 21:45:28 -0400168
Sean Middleditch637df7f2009-03-15 12:57:32 -0400169 void (libtelnet_t *telnet, libtelnet_event_t *event,
Sean Middleditch9f79cc52009-03-15 13:39:24 -0400170 void *user_data);
171
172 The event structure is detailed below. The user_data value is the
173 pointer passed to libtelnet_init().
Sean Middleditch637df7f2009-03-15 12:57:32 -0400174
175 struct libtelnet_event_t {
Sean Middleditch97a8cb22009-03-16 16:51:41 -0400176 const unsigned char *buffer;
Sean Middleditch637df7f2009-03-15 12:57:32 -0400177 unsigned int size;
Sean Middleditch812358d2009-03-15 23:24:03 -0400178 libtelnet_event_type_t type;
179 unsigned char command;
180 unsigned char telopt;
181 unsigned char accept;
Sean Middleditch637df7f2009-03-15 12:57:32 -0400182 };
183
184 The enumeration values of libtelnet_event_type_t are described in
185 detail below. Whenever the the event handler is invoked, the
186 application must look at the event->type value and do any
187 necessary processing.
188
189 The only event that MUST be implemented is LIBTELNET_EV_SEND.
190 Most applications will also always want to implement the event
191 LIBTELNET_EV_DATA.
192
193 Here is an example event handler implementation which includes
194 handlers for several important events.
195
Sean Middleditch812358d2009-03-15 23:24:03 -0400196 void my_event_handler(libtelnet_t *telnet, libtelnet_event_t *ev,
197 void *user_data) {
Sean Middleditch637df7f2009-03-15 12:57:32 -0400198 struct user_info *user = (struct user_info *)user_data;
199
200 switch (ev->type) {
201 case LIBTELNET_EV_DATA:
202 process_user_input(user, event->buffer, event->size);
203 break;
204 case LIBTELNET_EV_SEND:
205 write_to_descriptor(user, event->buffer, event->size);
206 break;
207 case LIBTELNET_EV_ERROR:
208 fatal_error("TELNET error: %s", event->buffer);
209 break;
210 }
Sean Middleditch30323022009-03-14 21:45:28 -0400211 }
212
Sean Middleditch637df7f2009-03-15 12:57:32 -0400213 LIBTELNET_EV_DATA:
214 The DATA event is triggered whenever regular data (not part of
215 any special TELNET command) is received. For a client, this
216 will be process output from the server. For a server, this will
217 be input typed by the user.
Sean Middleditch30323022009-03-14 21:45:28 -0400218
Sean Middleditch637df7f2009-03-15 12:57:32 -0400219 The event->buffer value will contain the bytes received and the
220 event->size value will contain the number of bytes received.
221 Note that event->buffer is not NUL terminated!
Sean Middleditch30323022009-03-14 21:45:28 -0400222
Sean Middleditch637df7f2009-03-15 12:57:32 -0400223 NOTE: there is no guarantee that user input or server output
224 will be received in whole lines. If you wish to process data
225 a line at a time, you are responsible for buffering the data and
226 checking for line terminators yourself!
227
228 LIBTELNET_EV_SEND:
229 This event is sent whenever libtelnet has generated data that
230 must be sent over the wire to the remove end. Generally that
231 means calling send() or adding the data to your application's
232 output buffer.
Sean Middleditch30323022009-03-14 21:45:28 -0400233
Sean Middleditch637df7f2009-03-15 12:57:32 -0400234 The event->buffer value will contain the bytes to send and the
235 event->size value will contain the number of bytes to send.
236 Note that event->buffer is not NUL terminated, and may include
237 NUL characters in its data, so always use event->size!
Sean Middleditch30323022009-03-14 21:45:28 -0400238
Sean Middleditch637df7f2009-03-15 12:57:32 -0400239 NOTE: Your SEND event handler must send or buffer the data in
240 its raw form as provided by libtelnet. If you wish to perform
241 any kind of preprocessing on data you want to send to the other
242
243 LIBTELNET_EV_IAC:
244 The IAC event is triggered whenever a simple IAC command is
245 received, such as the IAC EOR (end of record, also called
246 go ahead or GA) command.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400247
Sean Middleditch637df7f2009-03-15 12:57:32 -0400248 The command received is in the event->command value.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400249
Sean Middleditch637df7f2009-03-15 12:57:32 -0400250 The necessary processing depends on the specific commands; see
251 the TELNET RFC for more information.
252
Sean Middleditch5b5bc922009-03-15 23:02:10 -0400253 LIBTELNET_EV_WILL:
254 LIBTELNET_EV_DO:
255 The WILL and DO events are sent when a TELNET negotiation
256 command of the same name is received.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400257
Sean Middleditch5b5bc922009-03-15 23:02:10 -0400258 WILL events are sent by the remote end when they wish to be
259 allowed to turn an option on on their end, or in confirmation
260 after you have sent a DO command to them.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400261
Sean Middleditch5b5bc922009-03-15 23:02:10 -0400262 DO events are sent by the remote end when they wish for you
263 to turn on an option on your end, or in confirmation after you
264 have sent a WILL command to them.
265
266 In either case, the TELNET option under negotiation will be in
267 event->telopt field.
268
269 If you support the option and wish for it to be enabled you
270 must set the event->accept field to 1, unless this event is
271 a confirmation for a previous WILL/DO command you sent to the
272 remote end. If you do not set event->field to 1 then
273 libtelnet will send a rejection command back to the other end.
274
275 libtelnet manages some of the pecularities of negotiation for
276 you. For information on libtelnet's negotiation method, see:
Sean Middleditch892c5f12009-03-14 13:39:07 -0400277
278 http://www.faqs.org/rfcs/rfc1143.html
279
Sean Middleditch5b5bc922009-03-15 23:02:10 -0400280 Examples:
281
282 You want remote end to use TTYPE, so you send DO TTYPE.
283 Remote accepts and sends WILL TTYPE.
284
285 Remote end wants you to use SGA, so they send DO_SGA.
286 You do not support SGA and set event->accept = 0.
287
288 Remote end wants to use ZMP, so they send WILL ZMP.
289 You support ZMP, so you set event->accept = 1 and enable
290 local ZMP support.
291
292 You want to use MCCP2, so you send WILL COMPRESS2.
293 Remote end accepts and sends DO COMPRESS2.
294
295 Note that in PROXY mode libtelnet will do no processing of its
296 own for you.
297
298 LIBTELNET_EV_WONT:
299 LIBTELNET_EV_DONT:
300 The WONT and DONT events are sent when the remote end of the
301 connection wishes to disable an option, when they are
302 refusing to a support an option that you have asked for, or
303 in confirmation of an option you have asked to be disabled.
304
305 Most commonly WONT and DONT events are sent as rejections of
306 features you requested by sending DO or WILL events. Receiving
307 these events means the TELNET option is not or will not be
308 supported by the remote end, so give up.
309
310 Sometimes WONT or DONT will be sent for TELNET options that are
311 already enabled, but the remote end wishes to stop using. You
312 cannot decline. These events are demands that must be complied
313 with. libtelnet will always send the appropriate response back
314 without consulting your application. These events are sent to
315 allow your application to disable its own use of the features.
316
317 In either case, the TELNET option under negotiation will be in
318 event->telopt field.
319
320 Note that in PROXY mode libtelnet will do no processing of its
321 own for you.
322
Sean Middleditch637df7f2009-03-15 12:57:32 -0400323 LIBTELNET_EV_SUBNEGOTIATION:
324 Triggered whenever a TELNET sub-negotiation has been received.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400325 Sub-negotiations include the NAWS option for communicating
326 terminal size to a server, the NEW-ENVIRON and TTYPE options
327 for negotiating terminal features, and MUD-centric protocols
328 such as ZMP, MSSP, and MCCP2.
329
Sean Middleditch637df7f2009-03-15 12:57:32 -0400330 The event->telopt value is the option under sub-negotiation.
331 The remaining data (if any) is passed in event->buffer and
332 event->size. Note that most subnegotiation commands can
333 include embedded NUL bytes in the subnegotiation data, and
334 the data event->buffer is not NUL terminated, so always use
335 the event->size value!
Sean Middleditch892c5f12009-03-14 13:39:07 -0400336
Sean Middleditch637df7f2009-03-15 12:57:32 -0400337 The meaning and necessary processing for subnegotiations are
338 defined in various TELNET RFCs and other informal
339 specifications. A subnegotiation should never be sent unless
340 the specific option has been enabled through the use of the
341 telnet negotiation feature.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400342
Sean Middleditch637df7f2009-03-15 12:57:32 -0400343 LIBTELNET_EV_COMPRESS
344 The COMPRESS event notifies the app that COMPRESS2/MCCP2
345 compression has begun or ended. Only servers can send compressed
346 data, and hence only clients will receive compressed data.
Sean Middleditchb9e48642009-03-12 23:33:27 -0400347
Sean Middleditch637df7f2009-03-15 12:57:32 -0400348 The event->command value will be 1 if compression has started and
349 will be 0 if compression has ended.
Sean Middleditch16992272009-03-15 19:42:03 -0400350
351 LIBTELNET_EV_WARNING
352 The WARNING event is sent whenever something has gone wrong
353 inside of libtelnet (possibly due to malformed data sent by the
354 other end) but which recovery is (likely) possible. It may be
355 safe to continue using the connection, but some data may have
356 been lost or incorrectly interpreted.
Sean Middleditch637df7f2009-03-15 12:57:32 -0400357
358 The event->buffer value will contain a NUL terminated string
359 explaining the error, and the event->size value containers the
360 length of the string.
361
Sean Middleditch16992272009-03-15 19:42:03 -0400362 LIBTELNET_EV_ERROR
363 Similar to the WARNING event, the ERROR event is sent whenever
364 something has gone wrong. ERROR events are non-recoverable,
365 however, and the application should immediately close the
366 connection. Whatever has happened is likely going only to
367 result in garbage from libtelnet. This is most likely to
368 happen when a COMPRESS2 stream fails, but other problems can
369 occur.
370
371 The event->buffer value will contain a NUL terminated string
372 explaining the error, and the event->size value containers the
373 length of the string.
Sean Middleditch637df7f2009-03-15 12:57:32 -0400374
375III. INTEGRATING LIBTELNET WITH COMMON MUDS
Sean Middleditchb9e48642009-03-12 23:33:27 -0400376=====================================================================
377
Sean Middleditch637df7f2009-03-15 12:57:32 -0400378FIXME: fill in some notes about how to splice in libtelnet with
379common Diku/Merc/Circle/etc. MUD codebases.
Sean Middleditchb9e48642009-03-12 23:33:27 -0400380
Sean Middleditch892c5f12009-03-14 13:39:07 -0400381IV. SAFETY AND CORRECTNESS CONSIDERATIONS
Sean Middleditchb9e48642009-03-12 23:33:27 -0400382=====================================================================
383
Sean Middleditch892c5f12009-03-14 13:39:07 -0400384Your existing application may make heavy use of its own output
385buffering and transmission commands, including hand-made routines
386for sending TELNET commands and sub-negotiation requests. There are
387at times subtle issues that need to be handled when communication
388over the TELNET protocol, not least of which is the need to escape
389any byte value 0xFF with a special TELNET command.
Sean Middleditchb9e48642009-03-12 23:33:27 -0400390
Sean Middleditch892c5f12009-03-14 13:39:07 -0400391For these reasons, it is very important that applications making use
392of libtelnet always make use of the libtelnet_send_*() family of
393functions for all data being sent over the TELNET connection.
394
Sean Middleditch637df7f2009-03-15 12:57:32 -0400395In particular, if you are writing a client, all user input must be
396passed through to libtelnet_send_data(). This also includes any
397input generated automatically by scripts, triggers, or macros.
398
399For a server, any and all output -- including ANSI/VT100 escape
400codes, regular text, newlines, and so on -- must be passed through
401to libtelnet_send_data().
402
403Any TELNET commands that are to be sent must be given to one of the
404following: libtelnet_send_command, libtelnet_send_negotiate, or
405libtelnet_send_subnegotiation().
406
407If you are attempting to enable COMPRESS2/MCCP2, you must use the
408libtelnet_begin_compress2() function.
409
Sean Middleditch892c5f12009-03-14 13:39:07 -0400410V. MCCP2 COMPRESSION
Sean Middleditchb9e48642009-03-12 23:33:27 -0400411=====================================================================
412
Sean Middleditch892c5f12009-03-14 13:39:07 -0400413The MCCP2 (COMPRESS2) TELNET extension allows for the compression of
414all traffic sent from server to client. For more information:
415
416 http://www.mudbytes.net/index.php?a=articles&s=mccp
417
Sean Middleditch637df7f2009-03-15 12:57:32 -0400418In order for libtelnet to support MCCP2, zlib must be installed and
419enabled when compiling libtelnet. Use -DHAVE_ZLIB to enable zlib
420when compiling libtelnet.c and pass -lz to the linker to link in the
421zlib shared library.
422
Sean Middleditch892c5f12009-03-14 13:39:07 -0400423libtelnet transparently supports MCCP2. For a server to support
424MCCP2, the application must begin negotiation of the COMPRESS2
425option using libtelnet_send_negotiate(), for example:
426
427 libtelnet_send_negotiate(&telnet, LIBTELNET_WILL,
428 LIBTELNET_OPTION_COMPRESS2, user_data);
429
Sean Middleditch5b5bc922009-03-15 23:02:10 -0400430If a favorable DO COMPRESS2 is sent back from the client then the
431server application can begin compression at any time by calling
432libtelnet_begin_compress2().
Sean Middleditch892c5f12009-03-14 13:39:07 -0400433
Sean Middleditch637df7f2009-03-15 12:57:32 -0400434If a connection is in PROXY mode and COMPRESS2 support is enabled
435then libtelnet will automatically detect the start of a COMPRESS2
436stream, in either the sending or receiving direction.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400437
438VI. TELNET PROXY UTILITY
439=====================================================================
440
441The telnet-proxy utility is a small application that serves both as
442a testbed for libtelnet and as a powerful debugging tool for TELNET
443servers and clients.
444
445To use telnet-proxy, you must first compile it using:
446
447 $ make
448
449If you do not have zlib installed and wish to disable MCCP2 support
450then you must first edit the Makefile and remove the -DHAVE_ZLIB and
451the -lz from the compile flags.
452
Sean Middleditchd88f1832009-03-15 01:06:17 -0400453To run telnet-proxy, you simply give it the server's host name or
454IP address, the server's port number, and the port number that
455telnet-proxy should listen on. For example, to connect to the server
456on mud.example.com port 7800 and to listen on port 5000, run:
Sean Middleditch892c5f12009-03-14 13:39:07 -0400457
Sean Middleditchd88f1832009-03-15 01:06:17 -0400458 $ ./telnet-proxy mud.example.com 7800 5000
Sean Middleditch892c5f12009-03-14 13:39:07 -0400459
460You can then connect to the host telnet-proxy is running on (e.g.
Sean Middleditchd88f1832009-03-15 01:06:17 -0400461127.0.0.1) on port 500 and you will automatically be proxied into
462mud.example.com.
Sean Middleditch892c5f12009-03-14 13:39:07 -0400463
464telnet-proxy will display status information about the data
Sean Middleditchaefcd0c2009-03-15 13:16:44 -0400465passing through both ends of the tunnel. telnet-proxy can only
466support a single tunnel at a time. It will continue running until
467an error occurs or a terminating signal is sent to the proxy
468process.