Commit 66e922ad authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Add telnet_opt_enabled() function that returns true for WILL or DO opt status

An option is enabled/supported regardless of which end makes the request, so
the status can be WILL (an ACK to a remote request) or DO (an ACK to a local
request) when an option is enabled.
parent e042d5d9
/* telnet.c */
/* Synchronet telnet command/option functions */
/* $Id: telnet.c,v 1.10 2019/08/24 19:37:11 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -149,6 +133,11 @@ uchar telnet_opt_nak(uchar cmd)
return 0;
}
bool telnet_opt_enabled(uchar val)
{
return (val == TELNET_DO) || (val == TELNET_WILL);
}
/*****************************************************************************/
// Escapes Telnet IACs in 'inbuf' by doubling the IAC char
// 'result' may point to either inbuf (if there were no IACs) or outbuf
......
/* telnet.h */
/* Synchronet telnet-related constants and function prototypes */
/* $Id: telnet.h,v 1.21 2019/08/24 19:37:11 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -39,6 +23,7 @@
#define _TELNET_H
#include "gen_defs.h" /* uchar */
#include <stdbool.h>
/* commands */
......@@ -165,6 +150,7 @@ DLLEXPORT const char* telnet_cmd_desc(uchar cmd);
DLLEXPORT const char* telnet_opt_desc(uchar opt);
DLLEXPORT uchar telnet_opt_ack(uchar cmd);
DLLEXPORT uchar telnet_opt_nak(uchar cmd);
DLLEXPORT bool telnet_opt_enabled(uchar value);
DLLEXPORT size_t telnet_expand(const uchar* inbuf, size_t inlen, uchar* outbuf, size_t outlen
,BOOL expand_cr, uchar** result);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment