Classes | Macros | Typedefs | Enumerations | Functions | Variables
tftp.c File Reference
#include "curl_setup.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 "multiif.h"
#include "url.h"
#include "strcase.h"
#include "speedcheck.h"
#include "select.h"
#include "escape.h"
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
Include dependency graph for tftp.c:

Go to the source code of this file.

Classes

struct  tftp_packet
 
struct  tftp_state_data
 

Macros

#define NEXT_BLOCKNUM(x)   (((x) + 1)&0xffff)
 
#define TFTP_BLKSIZE_DEFAULT   512
 
#define TFTP_BLKSIZE_MAX   65464
 
#define TFTP_BLKSIZE_MIN   8
 
#define TFTP_OPTION_BLKSIZE   "blksize"
 
#define TFTP_OPTION_INTERVAL   "timeout"
 
#define TFTP_OPTION_TSIZE   "tsize"
 

Typedefs

typedef struct tftp_packet tftp_packet_t
 
typedef struct tftp_state_data tftp_state_data_t
 

Enumerations

enum  tftp_error_t {
  TFTP_ERR_UNDEF = 0, TFTP_ERR_NOTFOUND, TFTP_ERR_PERM, TFTP_ERR_DISKFULL,
  TFTP_ERR_ILLEGAL, TFTP_ERR_UNKNOWNID, TFTP_ERR_EXISTS, TFTP_ERR_NOSUCHUSER,
  TFTP_ERR_NONE = -100, TFTP_ERR_TIMEOUT, TFTP_ERR_NORESPONSE
}
 
enum  tftp_event_t {
  TFTP_EVENT_NONE = -1, TFTP_EVENT_INIT = 0, TFTP_EVENT_RRQ = 1, TFTP_EVENT_WRQ = 2,
  TFTP_EVENT_DATA = 3, TFTP_EVENT_ACK = 4, TFTP_EVENT_ERROR = 5, TFTP_EVENT_OACK = 6,
  TFTP_EVENT_TIMEOUT
}
 
enum  tftp_mode_t { TFTP_MODE_NETASCII = 0, TFTP_MODE_OCTET }
 
enum  tftp_state_t { TFTP_STATE_START = 0, TFTP_STATE_RX, TFTP_STATE_TX, TFTP_STATE_FIN }
 

Functions

static size_t Curl_strnlen (const char *string, size_t maxlen)
 
static unsigned short getrpacketblock (const tftp_packet_t *packet)
 
static unsigned short getrpacketevent (const tftp_packet_t *packet)
 
static void setpacketblock (tftp_packet_t *packet, unsigned short num)
 
static void setpacketevent (tftp_packet_t *packet, unsigned short num)
 
static CURLcode tftp_connect (struct connectdata *conn, bool *done)
 
static CURLcode tftp_connect_for_rx (tftp_state_data_t *state, tftp_event_t event)
 
static CURLcode tftp_connect_for_tx (tftp_state_data_t *state, tftp_event_t event)
 
static CURLcode tftp_disconnect (struct connectdata *conn, bool dead_connection)
 
static CURLcode tftp_do (struct connectdata *conn, bool *done)
 
static CURLcode tftp_doing (struct connectdata *conn, bool *dophase_done)
 
static CURLcode tftp_done (struct connectdata *conn, CURLcode, bool premature)
 
static int tftp_getsock (struct connectdata *conn, curl_socket_t *socks, int numsocks)
 
static CURLcode tftp_multi_statemach (struct connectdata *conn, bool *done)
 
static size_t tftp_option_add (tftp_state_data_t *state, size_t csize, char *buf, const char *option)
 
static const char * tftp_option_get (const char *buf, size_t len, const char **option, const char **value)
 
static CURLcode tftp_parse_option_ack (tftp_state_data_t *state, const char *ptr, int len)
 
static CURLcode tftp_perform (struct connectdata *conn, bool *dophase_done)
 
static CURLcode tftp_receive_packet (struct connectdata *conn)
 
static CURLcode tftp_rx (tftp_state_data_t *state, tftp_event_t event)
 
static CURLcode tftp_send_first (tftp_state_data_t *state, tftp_event_t event)
 
static CURLcode tftp_set_timeouts (tftp_state_data_t *state)
 
static CURLcode tftp_setup_connection (struct connectdata *conn)
 
static CURLcode tftp_state_machine (tftp_state_data_t *state, tftp_event_t event)
 
static long tftp_state_timeout (struct connectdata *conn, tftp_event_t *event)
 
static CURLcode tftp_translate_code (tftp_error_t error)
 
static CURLcode tftp_tx (tftp_state_data_t *state, tftp_event_t event)
 

Variables

const struct Curl_handler Curl_handler_tftp
 

Macro Definition Documentation

#define NEXT_BLOCKNUM (   x)    (((x) + 1)&0xffff)

Definition at line 579 of file tftp.c.

#define TFTP_BLKSIZE_DEFAULT   512

Definition at line 69 of file tftp.c.

#define TFTP_BLKSIZE_MAX   65464

Definition at line 71 of file tftp.c.

#define TFTP_BLKSIZE_MIN   8

Definition at line 70 of file tftp.c.

#define TFTP_OPTION_BLKSIZE   "blksize"

Definition at line 72 of file tftp.c.

#define TFTP_OPTION_INTERVAL   "timeout"

Definition at line 76 of file tftp.c.

#define TFTP_OPTION_TSIZE   "tsize"

Definition at line 75 of file tftp.c.

Typedef Documentation

typedef struct tftp_packet tftp_packet_t

Enumeration Type Documentation

Enumerator
TFTP_ERR_UNDEF 
TFTP_ERR_NOTFOUND 
TFTP_ERR_PERM 
TFTP_ERR_DISKFULL 
TFTP_ERR_ILLEGAL 
TFTP_ERR_UNKNOWNID 
TFTP_ERR_EXISTS 
TFTP_ERR_NOSUCHUSER 
TFTP_ERR_NONE 
TFTP_ERR_TIMEOUT 
TFTP_ERR_NORESPONSE 

Definition at line 102 of file tftp.c.

Enumerator
TFTP_EVENT_NONE 
TFTP_EVENT_INIT 
TFTP_EVENT_RRQ 
TFTP_EVENT_WRQ 
TFTP_EVENT_DATA 
TFTP_EVENT_ACK 
TFTP_EVENT_ERROR 
TFTP_EVENT_OACK 
TFTP_EVENT_TIMEOUT 

Definition at line 90 of file tftp.c.

Enumerator
TFTP_MODE_NETASCII 
TFTP_MODE_OCTET 

Definition at line 78 of file tftp.c.

Enumerator
TFTP_STATE_START 
TFTP_STATE_RX 
TFTP_STATE_TX 
TFTP_STATE_FIN 

Definition at line 83 of file tftp.c.

Function Documentation

static size_t Curl_strnlen ( const char *  string,
size_t  maxlen 
)
static

Definition at line 306 of file tftp.c.

static unsigned short getrpacketblock ( const tftp_packet_t packet)
static

Definition at line 301 of file tftp.c.

static unsigned short getrpacketevent ( const tftp_packet_t packet)
static

Definition at line 296 of file tftp.c.

static void setpacketblock ( tftp_packet_t packet,
unsigned short  num 
)
static

Definition at line 290 of file tftp.c.

static void setpacketevent ( tftp_packet_t packet,
unsigned short  num 
)
static

Definition at line 283 of file tftp.c.

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

Definition at line 969 of file tftp.c.

static CURLcode tftp_connect_for_rx ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 432 of file tftp.c.

static CURLcode tftp_connect_for_tx ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 416 of file tftp.c.

static CURLcode tftp_disconnect ( struct connectdata conn,
bool  dead_connection 
)
static

Definition at line 947 of file tftp.c.

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

Definition at line 1339 of file tftp.c.

static CURLcode tftp_doing ( struct connectdata conn,
bool dophase_done 
)
static

Definition at line 1281 of file tftp.c.

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

Definition at line 1055 of file tftp.c.

static int tftp_getsock ( struct connectdata conn,
curl_socket_t socks,
int  numsocks 
)
static

Definition at line 1081 of file tftp.c.

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

Definition at line 1222 of file tftp.c.

static size_t tftp_option_add ( tftp_state_data_t state,
size_t  csize,
char *  buf,
const char *  option 
)
static

Definition at line 407 of file tftp.c.

static const char* tftp_option_get ( const char *  buf,
size_t  len,
const char **  option,
const char **  value 
)
static

Definition at line 312 of file tftp.c.

static CURLcode tftp_parse_option_ack ( tftp_state_data_t state,
const char *  ptr,
int  len 
)
static

Definition at line 334 of file tftp.c.

static CURLcode tftp_perform ( struct connectdata conn,
bool dophase_done 
)
static

Definition at line 1308 of file tftp.c.

static CURLcode tftp_receive_packet ( struct connectdata conn)
static

Definition at line 1099 of file tftp.c.

static CURLcode tftp_rx ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 588 of file tftp.c.

static CURLcode tftp_send_first ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 448 of file tftp.c.

static CURLcode tftp_set_timeouts ( tftp_state_data_t state)
static

Definition at line 200 of file tftp.c.

static CURLcode tftp_setup_connection ( struct connectdata conn)
static

Definition at line 1367 of file tftp.c.

static CURLcode tftp_state_machine ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 908 of file tftp.c.

static long tftp_state_timeout ( struct connectdata conn,
tftp_event_t event 
)
static

Definition at line 1187 of file tftp.c.

static CURLcode tftp_translate_code ( tftp_error_t  error)
static

Definition at line 856 of file tftp.c.

static CURLcode tftp_tx ( tftp_state_data_t state,
tftp_event_t  event 
)
static

Definition at line 709 of file tftp.c.

Variable Documentation

const struct Curl_handler Curl_handler_tftp
Initial value:
= {
"TFTP",
}
static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)
Definition: tftp.c:1281
#define PROTOPT_NOURLQUERY
Definition: urldata.h:711
#define PORT_TFTP
Definition: urldata.h:37
static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks)
Definition: tftp.c:1081
static CURLcode tftp_connect(struct connectdata *conn, bool *done)
Definition: tftp.c:969
static CURLcode tftp_done(struct connectdata *conn, CURLcode, bool premature)
Definition: tftp.c:1055
static CURLcode tftp_setup_connection(struct connectdata *conn)
Definition: tftp.c:1367
#define ZERO_NULL
Definition: curlx.c:131
#define CURLPROTO_TFTP
Definition: curl.h:855
static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
Definition: tftp.c:1222
#define PROTOPT_NONE
Definition: urldata.h:699
static CURLcode tftp_do(struct connectdata *conn, bool *done)
Definition: tftp.c:1339
static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection)
Definition: tftp.c:947

Definition at line 169 of file tftp.c.



rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:17