--- sbbs/sbbs3/telnet.h 2018/04/24 16:39:34 1.1.1.1 +++ sbbs/sbbs3/telnet.h 2018/04/24 16:39:50 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet telnet-related constants and function prototypes */ -/* $Id: telnet.h,v 1.1.1.1 2018/04/24 16:39:34 root Exp $ */ +/* $Id: telnet.h,v 1.1.1.2 2018/04/24 16:39:50 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -35,41 +35,46 @@ * Note: If this box doesn't appear square, then you need to fix your tabs. * ****************************************************************************/ +#ifndef _TELNET_H +#define _TELNET_H + +#include "gen_defs.h" /* uchar */ + /* commands */ -#define TELNET_IAC 255 // Interpret as command -#define TELNET_DONT 254 // Don't do option -#define TELNET_DO 253 // Do option -#define TELNET_WONT 252 // Won't do option -#define TELNET_WILL 251 // Will do option - -#define TELNET_SB 250 // sub-negotiation -#define TELNET_GA 249 // Go ahead -#define TELNET_EL 248 // Erase line -#define TELNET_EC 247 // Erase char -#define TELNET_AYT 246 // Are you there? -#define TELNET_AO 245 // Abort output -#define TELNET_IP 244 // Interrupt process -#define TELNET_BRK 243 // Break -#define TELNET_SYNC 242 // Data mark -#define TELNET_NOP 241 // No operation +#define TELNET_IAC 255 /* 0xff - Interpret as command */ +#define TELNET_DONT 254 /* 0xfe - Don't do option */ +#define TELNET_DO 253 /* 0xfd - Do option */ +#define TELNET_WONT 252 /* 0xfc - Won't do option */ +#define TELNET_WILL 251 /* 0xfb - Will do option */ + +#define TELNET_SB 250 /* sub-negotiation */ +#define TELNET_GA 249 /* Go ahead */ +#define TELNET_EL 248 /* Erase line */ +#define TELNET_EC 247 /* Erase char */ +#define TELNET_AYT 246 /* Are you there? */ +#define TELNET_AO 245 /* Abort output */ +#define TELNET_IP 244 /* Interrupt process */ +#define TELNET_BRK 243 /* Break */ +#define TELNET_SYNC 242 /* Data mark */ +#define TELNET_NOP 241 /* No operation */ -#define TELNET_SE 240 // End of subnegotiation parameters. +#define TELNET_SE 240 /* End of subnegotiation parameters. */ /* options */ enum { - TELNET_BINARY + TELNET_BINARY_TX ,TELNET_ECHO ,TELNET_RECONN - ,TELNET_SUP_GA // supress go ahead + ,TELNET_SUP_GA /* suppress go ahead */ ,TELNET_APPROX_MSG_SIZE ,TELNET_STATUS ,TELNET_TIMING_MARK ,TELNET_REMOTE_CTRL ,TELNET_OUTPUT_LINE_WIDTH ,TELNET_OUTPUT_PAGE_SIZE - ,TELNET_OUTPUT_CR_DISP + ,TELNET_OUTPUT_CR_DISP /* 10 */ ,TELNET_OUTPUT_HTAB_STOPS ,TELNET_OUTPUT_HTAB_DISP ,TELNET_OUTPUT_FF_DISP @@ -79,7 +84,7 @@ enum { ,TELNET_EXASCII ,TELNET_LOGOUT ,TELNET_BYTE_MACRO - ,TELNET_DATA_ENTRY_TERM + ,TELNET_DATA_ENTRY_TERM /* 20 */ ,TELNET_SUPDUP ,TELNET_SUPDUP_OUTPUT ,TELNET_SEND_LOCATION @@ -89,7 +94,7 @@ enum { ,TELNET_OUTPUT_MARKING ,TELNET_TERM_LOCATION_NUMBER ,TELNET_3270 - ,TELNET_X3_PAD + ,TELNET_X3_PAD /* 30 */ ,TELNET_NEGOTIATE_WINDOW_SIZE ,TELNET_TERM_SPEED ,TELNET_REMOTE_FLOW @@ -98,23 +103,56 @@ enum { ,TELNET_ENV_OPTION ,TELNET_AUTH_OPTION ,TELNET_ENCRYPTION_OPTION - ,TELNET_NEW_ENV_OPTION - ,TELNET_3270E + ,TELNET_NEW_ENV_OPTION + ,TELNET_3270E /* 40 */ - ,TELNET_EXOPL=255 // Extended options list + ,TELNET_EXOPL=255 /* Extended options list */ }; +/* Terminal-type sub option codes, see RFC 1091 */ +#define TELNET_TERM_IS 0 +#define TELNET_TERM_SEND 1 +#define TELNET_TERM_MAXLEN 40 + /* bits for telnet_mode */ -#define TELNET_MODE_BIN_RX (1<<0) -#define TELNET_MODE_ECHO (1<<1) -#define TELNET_MODE_GATE (1<<2) // Pass-through telnet commands/responses +#define TELNET_MODE_GATE (1<<2) /* Pass-through telnet commands/responses */ +#define TELNET_MODE_OFF (1<<3) /* This is not a Telnet connection */ + +#ifdef DLLEXPORT +#undef DLLEXPORT +#endif +#ifdef DLLCALL +#undef DLLCALL +#endif + +#ifdef _WIN32 + #ifdef SBBS_EXPORTS + #define DLLEXPORT __declspec(dllexport) + #else + #define DLLEXPORT __declspec(dllimport) + #endif + #ifdef __BORLANDC__ + #define DLLCALL __stdcall + #else + #define DLLCALL + #endif +#else + #define DLLEXPORT + #define DLLCALL +#endif #ifdef __cplusplus extern "C" { #endif -const char *telnet_cmd_desc(uchar cmd); -const char *telnet_opt_desc(uchar opt); + +DLLEXPORT const char* DLLCALL telnet_cmd_desc(uchar cmd); +DLLEXPORT const char* DLLCALL telnet_opt_desc(uchar opt); +DLLEXPORT const uchar DLLCALL telnet_opt_ack(uchar cmd); +DLLEXPORT const uchar DLLCALL telnet_opt_nak(uchar cmd); + #ifdef __cplusplus } -#endif \ No newline at end of file +#endif + +#endif /* don't add anything after this line */