#include "setup.h"#include <stdio.h>#include <string.h>#include <stdarg.h>#include <stdlib.h>#include <ctype.h>#include <netinet/in.h>#include <netdb.h>#include <sys/ioctl.h>#include <signal.h>#include "urldata.h"#include <curl/curl.h>#include "transfer.h"#include "sendf.h"#include "telnet.h"#include "connect.h"#include <curl/mprintf.h>#include "arpa_telnet.h"#include "memory.h"#include "select.h"#include "memdebug.h"Go to the source code of this file.
Classes | |
| struct | TELNET |
Defines | |
| #define | _MPRINTF_REPLACE |
| #define | TELOPTS |
| #define | TELCMDS |
| #define | SUBBUFSIZE 512 |
| #define | CURL_SB_CLEAR(x) x->subpointer = x->subbuffer; |
| #define | CURL_SB_TERM(x) { x->subend = x->subpointer; CURL_SB_CLEAR(x); } |
| #define | CURL_SB_ACCUM(x, c) |
| #define | CURL_SB_GET(x) ((*x->subpointer++)&0xff) |
| #define | CURL_SB_PEEK(x) ((*x->subpointer)&0xff) |
| #define | CURL_SB_EOF(x) (x->subpointer >= x->subend) |
| #define | CURL_SB_LEN(x) (x->subend - x->subpointer) |
| #define | CURL_NO 0 |
| #define | CURL_YES 1 |
| #define | CURL_WANTYES 2 |
| #define | CURL_WANTNO 3 |
| #define | CURL_EMPTY 0 |
| #define | CURL_OPPOSITE 1 |
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 void | telrcv (struct connectdata *, unsigned char *inbuf, ssize_t count) |
| static void | printoption (struct SessionHandle *data, const char *direction, int cmd, int option) |
| static void | negotiate (struct connectdata *) |
| static void | send_negotiation (struct connectdata *, int cmd, 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 | printsub (struct SessionHandle *data, int direction, unsigned char *pointer, size_t length) |
| static void | suboption (struct connectdata *) |
| static CURLcode | init_telnet (struct connectdata *conn) |
| static void | rec_will (struct connectdata *conn, int option) |
| static void | rec_wont (struct connectdata *conn, int option) |
| static void | rec_do (struct connectdata *conn, int option) |
| static void | rec_dont (struct connectdata *conn, int option) |
| static CURLcode | check_telnet_options (struct connectdata *conn) |
| CURLcode | Curl_telnet_done (struct connectdata *conn, CURLcode status, bool premature) |
| CURLcode | Curl_telnet (struct connectdata *conn, bool *done) |
| #define CURL_EMPTY 0 |
Definition at line 134 of file telnet.c.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| #define CURL_NO 0 |
Definition at line 129 of file telnet.c.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| #define CURL_OPPOSITE 1 |
Definition at line 135 of file telnet.c.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| #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 | ) | { x->subend = x->subpointer; CURL_SB_CLEAR(x); } |
| #define CURL_WANTNO 3 |
Definition at line 132 of file telnet.c.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| #define CURL_WANTYES 2 |
Definition at line 131 of file telnet.c.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| #define CURL_YES 1 |
Definition at line 130 of file telnet.c.
Referenced by check_telnet_options(), init_telnet(), negotiate(), rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| enum TelnetReceive |
| static CURLcode check_telnet_options | ( | struct connectdata * | conn | ) | [static] |
Definition at line 787 of file telnet.c.
References connectdata::bits, curl_slist_append(), curl_strequal(), CURL_TELOPT_NEW_ENVIRON, CURL_TELOPT_TTYPE, CURL_TELOPT_XDISPLOC, CURL_YES, CURLE_OK, CURLE_OUT_OF_MEMORY, CURLE_TELNET_OPTION_SYNTAX, CURLE_UNKNOWN_TELNET_OPTION, curl_slist::data, connectdata::data, failf, curl_slist::next, HandleData::proto, SessionHandle::reqdata, SessionHandle::set, strdup, TELNET::subopt_ttype, TELNET::subopt_xdisploc, HandleData::telnet, UserDefined::telnet_options, TELNET::telnet_vars, TELNET::us_preferred, connectdata::user, and ConnectBits::user_passwd.
Referenced by Curl_telnet().
| CURLcode Curl_telnet | ( | struct connectdata * | conn, | |
| bool * | done | |||
| ) |
Definition at line 1091 of file telnet.c.
References TELNET::already_negotiated, asio::buffer(), UrlState::buffer, BUFSIZE, check_telnet_options(), connectdata::created, CURL_IAC, Curl_poll(), Curl_read(), Curl_setup_transfer(), Curl_tvdiff, Curl_tvnow, Curl_write(), CURLE_FAILED_INIT, CURLE_OPERATION_TIMEOUTED, connectdata::data, ERRNO, pollfd::events, failf, FALSE, pollfd::fd, FIRSTSOCKET, infof, init_telnet(), negotiate(), NULL, TELNET::please_negotiate, POLLIN, HandleData::proto, asio::read(), SessionHandle::reqdata, SessionHandle::set, connectdata::sock, SOCKERRNO, ssize_t, SessionHandle::state, HandleData::telnet, telrcv(), UserDefined::timeout, and TRUE.
Referenced by CreateConnection().
| CURLcode Curl_telnet_done | ( | struct connectdata * | conn, | |
| CURLcode | status, | |||
| bool | premature | |||
| ) |
Definition at line 1077 of file telnet.c.
References curl_slist_free_all(), CURLE_OK, connectdata::data, free, NULL, HandleData::proto, SessionHandle::reqdata, HandleData::telnet, and TELNET::telnet_vars.
Referenced by CreateConnection().
| static CURLcode init_telnet | ( | struct connectdata * | conn | ) | [static] |
Definition at line 214 of file telnet.c.
References calloc, CURL_SB_CLEAR, CURL_TELOPT_BINARY, CURL_TELOPT_SGA, CURL_TS_DATA, CURL_YES, CURLE_OK, CURLE_OUT_OF_MEMORY, connectdata::data, TELNET::him_preferred, HandleData::proto, SessionHandle::reqdata, HandleData::telnet, TELNET::telrcv_state, and TELNET::us_preferred.
Referenced by Curl_telnet().
| static void negotiate | ( | struct connectdata * | conn | ) | [static] |
Definition at line 238 of file telnet.c.
References CURL_NTELOPTS, CURL_YES, connectdata::data, TELNET::him_preferred, HandleData::proto, SessionHandle::reqdata, set_local_option(), set_remote_option(), HandleData::telnet, and TELNET::us_preferred.
Referenced by Curl_telnet().
| static void printoption | ( | struct SessionHandle * | data, | |
| const char * | direction, | |||
| int | cmd, | |||
| int | option | |||
| ) | [static] |
Definition at line 254 of file telnet.c.
References CURL_DO, CURL_DONT, CURL_IAC, CURL_TELCMD, CURL_TELCMD_OK, CURL_TELOPT, CURL_TELOPT_EXOPL, CURL_TELOPT_OK, CURL_WILL, CURL_WONT, infof, NULL, SessionHandle::set, and UserDefined::verbose.
Referenced by send_negotiation(), and telrcv().
| static void printsub | ( | struct SessionHandle * | data, | |
| int | direction, | |||
| unsigned char * | pointer, | |||
| size_t | length | |||
| ) | [static] |
Definition at line 675 of file telnet.c.
References CURL_IAC, CURL_NEW_ENV_VALUE, CURL_NEW_ENV_VAR, CURL_SE, CURL_TELCMD, CURL_TELCMD_OK, CURL_TELOPT, CURL_TELOPT_NEW_ENVIRON, CURL_TELOPT_OK, CURL_TELOPT_TTYPE, CURL_TELOPT_XDISPLOC, CURL_TELQUAL_INFO, CURL_TELQUAL_IS, CURL_TELQUAL_NAME, CURL_TELQUAL_SEND, infof, SessionHandle::set, and UserDefined::verbose.
Referenced by suboption().
| static void rec_do | ( | struct connectdata * | conn, | |
| int | option | |||
| ) | [static] |
Definition at line 577 of file telnet.c.
References CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_WILL, CURL_WONT, CURL_YES, connectdata::data, TELNET::himq, HandleData::proto, SessionHandle::reqdata, send_negotiation(), HandleData::telnet, TELNET::us, TELNET::us_preferred, and TELNET::usq.
Referenced by telrcv().
| static void rec_dont | ( | struct connectdata * | conn, | |
| int | option | |||
| ) | [static] |
Definition at line 630 of file telnet.c.
References CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_WILL, CURL_WONT, CURL_YES, connectdata::data, HandleData::proto, SessionHandle::reqdata, send_negotiation(), HandleData::telnet, TELNET::us, and TELNET::usq.
Referenced by telrcv().
| static void rec_will | ( | struct connectdata * | conn, | |
| int | option | |||
| ) | [static] |
Definition at line 397 of file telnet.c.
References CURL_DO, CURL_DONT, CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_YES, connectdata::data, TELNET::him, TELNET::him_preferred, TELNET::himq, HandleData::proto, SessionHandle::reqdata, send_negotiation(), and HandleData::telnet.
Referenced by telrcv().
| static void rec_wont | ( | struct connectdata * | conn, | |
| int | option | |||
| ) | [static] |
Definition at line 450 of file telnet.c.
References CURL_DO, CURL_DONT, CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_YES, connectdata::data, TELNET::him, TELNET::himq, HandleData::proto, SessionHandle::reqdata, send_negotiation(), and HandleData::telnet.
Referenced by telrcv().
| static void send_negotiation | ( | struct connectdata * | conn, | |
| int | cmd, | |||
| int | option | |||
| ) | [static] |
Definition at line 294 of file telnet.c.
References CURL_IAC, connectdata::data, failf, FIRSTSOCKET, printoption(), connectdata::sock, SOCKERRNO, and ssize_t.
Referenced by rec_do(), rec_dont(), rec_will(), rec_wont(), set_local_option(), and set_remote_option().
| static void set_local_option | ( | struct connectdata * | conn, | |
| int | cmd, | |||
| int | option | |||
| ) | [static] |
Definition at line 495 of file telnet.c.
References CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_WILL, CURL_WONT, CURL_YES, connectdata::data, HandleData::proto, SessionHandle::reqdata, send_negotiation(), HandleData::telnet, TELNET::us, and TELNET::usq.
Referenced by negotiate().
| static void set_remote_option | ( | struct connectdata * | conn, | |
| int | cmd, | |||
| int | option | |||
| ) | [static] |
Definition at line 315 of file telnet.c.
References CURL_DO, CURL_DONT, CURL_EMPTY, CURL_NO, CURL_OPPOSITE, CURL_WANTNO, CURL_WANTYES, CURL_YES, connectdata::data, TELNET::him, TELNET::himq, HandleData::proto, SessionHandle::reqdata, send_negotiation(), and HandleData::telnet.
Referenced by negotiate().
| static void suboption | ( | struct connectdata * | conn | ) | [static] |
Definition at line 854 of file telnet.c.
References CURL_IAC, CURL_NEW_ENV_VALUE, CURL_NEW_ENV_VAR, CURL_SB, CURL_SB_GET, CURL_SB_LEN, CURL_SE, CURL_TELOPT_NEW_ENVIRON, CURL_TELOPT_TTYPE, CURL_TELOPT_XDISPLOC, CURL_TELQUAL_IS, curl_slist::data, connectdata::data, failf, FIRSTSOCKET, curl_slist::next, printsub(), HandleData::proto, SessionHandle::reqdata, connectdata::sock, SOCKERRNO, ssize_t, TELNET::subbuffer, TELNET::subopt_ttype, TELNET::subopt_xdisploc, HandleData::telnet, and TELNET::telnet_vars.
Referenced by telrcv().
| static void telrcv | ( | struct connectdata * | conn, | |
| unsigned char * | inbuf, | |||
| ssize_t | count | |||
| ) | [static] |
Definition at line 925 of file telnet.c.
References c, CLIENTWRITE_BODY, Curl_client_write(), CURL_DM, CURL_DO, CURL_DONT, CURL_GA, CURL_IAC, CURL_NOP, CURL_SB, CURL_SB_ACCUM, CURL_SB_CLEAR, CURL_SB_TERM, CURL_SE, CURL_TS_CR, CURL_TS_DATA, CURL_TS_DO, CURL_TS_DONT, CURL_TS_IAC, CURL_TS_SB, CURL_TS_SE, CURL_TS_WILL, CURL_TS_WONT, CURL_WILL, CURL_WONT, connectdata::data, TELNET::please_negotiate, printoption(), HandleData::proto, rec_do(), rec_dont(), rec_will(), rec_wont(), SessionHandle::reqdata, suboption(), TELNET::subpointer, HandleData::telnet, and TELNET::telrcv_state.
Referenced by Curl_telnet().
1.5.6