#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 "tftp.h"#include "progress.h"#include "connect.h"#include "strerror.h"#include "sockaddr.h"#include "url.h"#include <curl/mprintf.h>#include "memory.h"#include "select.h"#include "memdebug.h"Go to the source code of this file.
| #define TFTP_BLOCKSIZE 512 |
| typedef struct tftp_packet tftp_packet_t |
| typedef struct tftp_state_data tftp_state_data_t |
| enum tftp_error_t |
| enum tftp_event_t |
| enum tftp_mode_t |
| enum tftp_state_t |
| CURLcode Curl_tftp | ( | struct connectdata * | conn, | |
| bool * | done | |||
| ) |
Definition at line 661 of file tftp.c.
References tftp_state_data::block, CLIENTWRITE_BODY, Curl_client_write(), Curl_pgrsSetDownloadCounter(), Curl_pgrsUpdate(), Curl_readwrite_init(), Curl_setup_transfer(), CURL_SOCKET_BAD, Curl_socket_ready(), Curl_strerror(), Curl_tftp_connect(), CURLE_ABORTED_BY_CALLBACK, CURLE_COULDNT_CONNECT, CURLE_OK, CURLE_OPERATION_TIMEOUTED, CURLE_TFTP_DISKFULL, CURLE_TFTP_EXISTS, CURLE_TFTP_ILLEGAL, CURLE_TFTP_NOSUCHUSER, CURLE_TFTP_NOTFOUND, CURLE_TFTP_PERM, CURLE_TFTP_UNKNOWNID, tftp_packet::data, connectdata::data, DEBUGF, tftp_state_data::error, libtorrent::dht::messages::error, failf, FALSE, getrpacketblock(), getrpacketevent(), infof, HandleData::keep, tftp_state_data::max_time, NULL, HandleData::proto, tftp_state_data::rbytes, asio::detail::socket_ops::recvfrom(), tftp_state_data::remote_addr, tftp_state_data::remote_addrlen, SessionHandle::reqdata, tftp_state_data::retry_time, tftp_state_data::rpacket, SOCKERRNO, tftp_state_data::sockfd, socklen_t, tftp_state_data::state, state(), HandleData::tftp, TFTP_ERR_DISKFULL, TFTP_ERR_EXISTS, TFTP_ERR_ILLEGAL, TFTP_ERR_NORESPONSE, TFTP_ERR_NOSUCHUSER, TFTP_ERR_NOTFOUND, TFTP_ERR_PERM, TFTP_ERR_TIMEOUT, TFTP_ERR_UNKNOWNID, TFTP_EVENT_ACK, TFTP_EVENT_DATA, TFTP_EVENT_ERROR, TFTP_EVENT_INIT, TFTP_EVENT_RRQ, TFTP_EVENT_TIMEOUT, TFTP_EVENT_WRQ, TFTP_STATE_FIN, tftp_state_machine(), and TRUE.
Referenced by CreateConnection().
| CURLcode Curl_tftp_connect | ( | struct connectdata * | conn, | |
| bool * | done | |||
| ) |
Definition at line 576 of file tftp.c.
References Curl_addrinfo::ai_addrlen, Curl_addrinfo::ai_family, asio::detail::socket_ops::bind(), connectdata::bits, calloc, ConnectBits::close, tftp_state_data::conn, Curl_pgrsStartNow(), Curl_strerror(), CURLE_COULDNT_CONNECT, CURLE_OK, CURLE_OUT_OF_MEMORY, connectdata::data, failf, FALSE, FIRSTSOCKET, connectdata::ip_addr, tftp_state_data::local_addr, HandleData::proto, SessionHandle::reqdata, ConnectBits::reuse, connectdata::sock, SOCKERRNO, tftp_state_data::sockfd, tftp_state_data::state, state(), HandleData::tftp, tftp_set_timeouts(), TFTP_STATE_START, and TRUE.
Referenced by CreateConnection(), and Curl_tftp().
| CURLcode Curl_tftp_done | ( | struct connectdata * | conn, | |
| CURLcode | status, | |||
| bool | premature | |||
| ) |
Definition at line 635 of file tftp.c.
References Curl_pgrsDone(), CURLE_OK, connectdata::data, free, NULL, HandleData::proto, SessionHandle::reqdata, and HandleData::tftp.
Referenced by CreateConnection().
| static unsigned short getrpacketblock | ( | tftp_packet_t * | packet | ) | [static] |
Definition at line 248 of file tftp.c.
References tftp_packet::data.
Referenced by Curl_tftp(), tftp_rx(), and tftp_tx().
| static unsigned short getrpacketevent | ( | tftp_packet_t * | packet | ) | [static] |
| static void setpacketblock | ( | tftp_packet_t * | packet, | |
| unsigned short | num | |||
| ) | [static] |
| static void setpacketevent | ( | tftp_packet_t * | packet, | |
| unsigned short | num | |||
| ) | [static] |
Definition at line 230 of file tftp.c.
References tftp_packet::data.
Referenced by tftp_rx(), tftp_send_first(), and tftp_tx().
| static CURLcode tftp_rx | ( | tftp_state_data_t * | state, | |
| tftp_event_t | event | |||
| ) | [static] |
Definition at line 339 of file tftp.c.
References tftp_state_data::block, tftp_state_data::conn, Curl_strerror(), CURLE_OK, CURLE_SEND_ERROR, CURLE_TFTP_ILLEGAL, tftp_packet::data, connectdata::data, tftp_state_data::error, failf, getrpacketblock(), infof, tftp_state_data::rbytes, tftp_state_data::remote_addr, tftp_state_data::remote_addrlen, tftp_state_data::retries, tftp_state_data::retry_max, tftp_state_data::rpacket, SEND_4TH_ARG, asio::detail::socket_ops::sendto(), setpacketblock(), setpacketevent(), SOCKERRNO, tftp_state_data::sockfd, tftp_state_data::spacket, tftp_state_data::state, TFTP_ERR_TIMEOUT, TFTP_EVENT_ACK, TFTP_EVENT_DATA, TFTP_EVENT_ERROR, TFTP_EVENT_TIMEOUT, TFTP_STATE_FIN, and TFTP_STATE_RX.
Referenced by tftp_send_first(), and tftp_state_machine().
| static CURLcode tftp_send_first | ( | tftp_state_data_t * | state, | |
| tftp_event_t | event | |||
| ) | [static] |
Definition at line 253 of file tftp.c.
References Curl_addrinfo::ai_addr, Curl_addrinfo::ai_addrlen, tftp_state_data::conn, curl_easy_unescape(), Curl_pgrsSetUploadSize(), Curl_safefree(), Curl_strerror(), CURLE_OK, CURLE_OUT_OF_MEMORY, tftp_packet::data, connectdata::data, tftp_state_data::error, failf, UserDefined::infilesize, infof, connectdata::ip_addr, NULL, HandleData::path, UserDefined::prefer_ascii, SessionHandle::reqdata, tftp_state_data::retries, tftp_state_data::retry_max, asio::detail::socket_ops::sendto(), SessionHandle::set, setpacketevent(), SOCKERRNO, tftp_state_data::sockfd, tftp_state_data::spacket, tftp_state_data::state, TFTP_BLOCKSIZE, TFTP_ERR_NORESPONSE, TFTP_EVENT_ACK, TFTP_EVENT_DATA, TFTP_EVENT_ERROR, TFTP_EVENT_INIT, TFTP_EVENT_RRQ, TFTP_EVENT_TIMEOUT, TFTP_EVENT_WRQ, tftp_rx(), tftp_set_timeouts(), TFTP_STATE_FIN, TFTP_STATE_RX, TFTP_STATE_TX, tftp_tx(), UserDefined::upload, and HandleData::upload_fromhere.
Referenced by tftp_state_machine().
| void tftp_set_timeouts | ( | tftp_state_data_t * | state | ) |
Definition at line 163 of file tftp.c.
References tftp_state_data::conn, UserDefined::connecttimeout, connectdata::data, infof, tftp_state_data::max_time, tftp_state_data::retry_max, tftp_state_data::retry_time, SessionHandle::set, tftp_state_data::start_time, tftp_state_data::state, TFTP_STATE_START, and UserDefined::timeout.
Referenced by Curl_tftp_connect(), and tftp_send_first().
| static CURLcode tftp_state_machine | ( | tftp_state_data_t * | state, | |
| tftp_event_t | event | |||
| ) | [static] |
Definition at line 538 of file tftp.c.
References tftp_state_data::conn, CURLE_OK, CURLE_TFTP_ILLEGAL, connectdata::data, DEBUGF, failf, infof, tftp_state_data::state, tftp_rx(), tftp_send_first(), TFTP_STATE_FIN, TFTP_STATE_RX, TFTP_STATE_START, TFTP_STATE_TX, and tftp_tx().
Referenced by Curl_tftp().
| static CURLcode tftp_tx | ( | tftp_state_data_t * | state, | |
| tftp_event_t | event | |||
| ) | [static] |
Definition at line 427 of file tftp.c.
References tftp_state_data::block, tftp_state_data::conn, Curl_fillreadbuffer(), Curl_pgrsSetUploadCounter(), Curl_strerror(), CURLE_OK, CURLE_SEND_ERROR, tftp_packet::data, connectdata::data, tftp_state_data::error, failf, getrpacketblock(), infof, HandleData::keep, tftp_state_data::remote_addr, tftp_state_data::remote_addrlen, SessionHandle::reqdata, tftp_state_data::retries, tftp_state_data::retry_max, tftp_state_data::rpacket, tftp_state_data::sbytes, SEND_4TH_ARG, asio::detail::socket_ops::sendto(), setpacketblock(), setpacketevent(), SOCKERRNO, tftp_state_data::sockfd, tftp_state_data::spacket, tftp_state_data::state, TFTP_BLOCKSIZE, TFTP_ERR_TIMEOUT, TFTP_EVENT_ACK, TFTP_EVENT_DATA, TFTP_EVENT_ERROR, TFTP_EVENT_TIMEOUT, TFTP_STATE_FIN, and Curl_transfer_keeper::writebytecount.
Referenced by tftp_send_first(), and tftp_state_machine().
1.5.6