Classes | Macros | Enumerations | Functions | Variables
telnet.c File Reference
#include "curl_setup.h"
#include "urldata.h"
#include <curl/curl.h>
#include "transfer.h"
#include "sendf.h"
#include "telnet.h"
#include "connect.h"
#include "progress.h"
#include "system_win32.h"
#include "arpa_telnet.h"
#include "select.h"
#include "strcase.h"
#include "warnless.h"
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
Include dependency graph for telnet.c:

Go to the source code of this file.

Classes

struct  TELNET
 

Macros

#define bufferflush()   startskipping()
 
#define CURL_EMPTY   0
 
#define CURL_NO   0
 
#define CURL_OPPOSITE   1
 
#define CURL_SB_ACCUM(x, c)
 
#define CURL_SB_CLEAR(x)   x->subpointer = x->subbuffer
 
#define CURL_SB_GET(x)   ((*x->subpointer++)&0xff)
 
#define CURL_SB_LEN(x)   (x->subend - x->subpointer)
 
#define CURL_SB_TERM(x)
 
#define CURL_WANTNO   3
 
#define CURL_WANTYES   2
 
#define CURL_YES   1
 
#define startskipping()
 
#define SUBBUFSIZE   512
 
#define TELCMDS
 
#define TELOPTS
 
#define writebyte()
 

Enumerations

enum  TelnetReceive {
  CURL_TS_DATA = 0, CURL_TS_IAC, CURL_TS_WILL, CURL_TS_WONT,
  CURL_TS_DO, CURL_TS_DONT, CURL_TS_CR, CURL_TS_SB,
  CURL_TS_SE
}
 

Functions

static CURLcode check_telnet_options (struct connectdata *conn)
 
static CURLcode init_telnet (struct connectdata *conn)
 
static void negotiate (struct connectdata *)
 
static void printoption (struct Curl_easy *data, const char *direction, int cmd, int option)
 
static void printsub (struct Curl_easy *data, int direction, unsigned char *pointer, size_t length)
 
static void rec_do (struct connectdata *conn, int option)
 
static void rec_dont (struct connectdata *conn, int option)
 
static void rec_will (struct connectdata *conn, int option)
 
static void rec_wont (struct connectdata *conn, int option)
 
static void send_negotiation (struct connectdata *, int cmd, int option)
 
static CURLcode send_telnet_data (struct connectdata *conn, char *buffer, ssize_t nread)
 
static void sendsuboption (struct connectdata *conn, int option)
 
static void set_local_option (struct connectdata *, int cmd, int option)
 
static void set_remote_option (struct connectdata *, int cmd, int option)
 
static void suboption (struct connectdata *)
 
static CURLcode telnet_do (struct connectdata *conn, bool *done)
 
static CURLcode telnet_done (struct connectdata *conn, CURLcode, bool premature)
 
static CURLcode telrcv (struct connectdata *, const unsigned char *inbuf, ssize_t count)
 

Variables

const struct Curl_handler Curl_handler_telnet
 

Macro Definition Documentation

◆ bufferflush

#define bufferflush ( )    startskipping()

◆ CURL_EMPTY

#define CURL_EMPTY   0

Definition at line 133 of file telnet.c.

◆ CURL_NO

#define CURL_NO   0

Definition at line 128 of file telnet.c.

◆ CURL_OPPOSITE

#define CURL_OPPOSITE   1

Definition at line 134 of file telnet.c.

◆ CURL_SB_ACCUM

#define CURL_SB_ACCUM (   x,
 
)
Value:
do { \
if(x->subpointer < (x->subbuffer + sizeof x->subbuffer)) \
*x->subpointer++ = (c); \

Definition at line 77 of file telnet.c.

◆ CURL_SB_CLEAR

#define CURL_SB_CLEAR (   x)    x->subpointer = x->subbuffer

Definition at line 71 of file telnet.c.

◆ CURL_SB_GET

#define CURL_SB_GET (   x)    ((*x->subpointer++)&0xff)

Definition at line 83 of file telnet.c.

◆ CURL_SB_LEN

#define CURL_SB_LEN (   x)    (x->subend - x->subpointer)

Definition at line 84 of file telnet.c.

◆ CURL_SB_TERM

#define CURL_SB_TERM (   x)
Value:
do { \
x->subend = x->subpointer; \
CURL_SB_CLEAR(x); \

Definition at line 72 of file telnet.c.

◆ CURL_WANTNO

#define CURL_WANTNO   3

Definition at line 131 of file telnet.c.

◆ CURL_WANTYES

#define CURL_WANTYES   2

Definition at line 130 of file telnet.c.

◆ CURL_YES

#define CURL_YES   1

Definition at line 129 of file telnet.c.

◆ startskipping

#define startskipping ( )
Value:
if(startwrite >= 0) { \
result = Curl_client_write(conn, \
(char *)&inbuf[startwrite], \
in-startwrite); \
if(result) \
return result; \
} \
startwrite = -1

◆ SUBBUFSIZE

#define SUBBUFSIZE   512

Definition at line 69 of file telnet.c.

◆ TELCMDS

#define TELCMDS

Definition at line 57 of file telnet.c.

◆ TELOPTS

#define TELOPTS

Definition at line 56 of file telnet.c.

◆ writebyte

#define writebyte ( )
Value:
if(startwrite < 0) \
startwrite = in

Enumeration Type Documentation

◆ TelnetReceive

Enumerator
CURL_TS_DATA 
CURL_TS_IAC 
CURL_TS_WILL 
CURL_TS_WONT 
CURL_TS_DO 
CURL_TS_DONT 
CURL_TS_CR 
CURL_TS_SB 
CURL_TS_SE 

Definition at line 139 of file telnet.c.

Function Documentation

◆ check_telnet_options()

static CURLcode check_telnet_options ( struct connectdata conn)
static

Definition at line 821 of file telnet.c.

◆ init_telnet()

static CURLcode init_telnet ( struct connectdata conn)
static

Definition at line 243 of file telnet.c.

◆ negotiate()

static void negotiate ( struct connectdata conn)
static

Definition at line 293 of file telnet.c.

◆ printoption()

static void printoption ( struct Curl_easy data,
const char *  direction,
int  cmd,
int  option 
)
static

Definition at line 311 of file telnet.c.

◆ printsub()

static void printsub ( struct Curl_easy data,
int  direction,
unsigned char *  pointer,
size_t  length 
)
static

Definition at line 708 of file telnet.c.

◆ rec_do()

static void rec_do ( struct connectdata conn,
int  option 
)
static

Definition at line 606 of file telnet.c.

◆ rec_dont()

static void rec_dont ( struct connectdata conn,
int  option 
)
static

Definition at line 666 of file telnet.c.

◆ rec_will()

static void rec_will ( struct connectdata conn,
int  option 
)
static

Definition at line 442 of file telnet.c.

◆ rec_wont()

static void rec_wont ( struct connectdata conn,
int  option 
)
static

Definition at line 490 of file telnet.c.

◆ send_negotiation()

static void send_negotiation ( struct connectdata conn,
int  cmd,
int  option 
)
static

Definition at line 347 of file telnet.c.

◆ send_telnet_data()

static CURLcode send_telnet_data ( struct connectdata conn,
char *  buffer,
ssize_t  nread 
)
static

Definition at line 1224 of file telnet.c.

◆ sendsuboption()

static void sendsuboption ( struct connectdata conn,
int  option 
)
static

Definition at line 1003 of file telnet.c.

◆ set_local_option()

static void set_local_option ( struct connectdata conn,
int  cmd,
int  option 
)
static

Definition at line 532 of file telnet.c.

◆ set_remote_option()

static void set_remote_option ( struct connectdata conn,
int  cmd,
int  option 
)
static

Definition at line 368 of file telnet.c.

◆ suboption()

static void suboption ( struct connectdata conn)
static

Definition at line 925 of file telnet.c.

◆ telnet_do()

static CURLcode telnet_do ( struct connectdata conn,
bool done 
)
static

Definition at line 1302 of file telnet.c.

◆ telnet_done()

static CURLcode telnet_done ( struct connectdata conn,
CURLcode  status,
bool  premature 
)
static

Definition at line 1284 of file telnet.c.

◆ telrcv()

static CURLcode telrcv ( struct connectdata conn,
const unsigned char *  inbuf,
ssize_t  count 
)
static

Definition at line 1060 of file telnet.c.

Variable Documentation

◆ Curl_handler_telnet

const struct Curl_handler Curl_handler_telnet
PORT_TELNET
#define PORT_TELNET
Definition: urldata.h:31
ZERO_NULL
#define ZERO_NULL
Definition: curlx.c:131
CLIENTWRITE_BODY
#define CLIENTWRITE_BODY
Definition: sendf.h:50
Curl_client_write
CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr, size_t len)
Definition: sendf.c:624
PROTOPT_NONE
#define PROTOPT_NONE
Definition: urldata.h:697
telnet_done
static CURLcode telnet_done(struct connectdata *conn, CURLcode, bool premature)
Definition: telnet.c:1284
CURLPROTO_TELNET
#define CURLPROTO_TELNET
Definition: curl.h:848
telnet_do
static CURLcode telnet_do(struct connectdata *conn, bool *done)
Definition: telnet.c:1302
result
UNITTEST_START int result
Definition: unit1304.c:49
WHILE_FALSE
#define WHILE_FALSE
Definition: curl_setup_once.h:356
PROTOPT_NOURLQUERY
#define PROTOPT_NOURLQUERY
Definition: urldata.h:708


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sun May 15 2022 02:25:02