#include "server_setup.h"
#include "tftp.h"
#include <setjmp.h>
#include "curlx.h"
#include "getpart.h"
#include "util.h"
#include "server_sockaddr.h"
#include "memdebug.h"
Go to the source code of this file.
Classes | |
struct | bf |
struct | errmsg |
struct | formats |
struct | testcase |
union | tftphdr_storage_t |
Defines | |
#define | BF_ALLOC -3 /* alloc'd but not yet filled */ |
#define | BF_FREE -2 /* free */ |
#define | DEFAULT_LOGFILE "log/tftpd.log" |
#define | DEFAULT_PORT 8999 /* UDP */ |
#define | ENABLE_CURLX_PRINTF |
#define | MIN(x, y) ((x)<(y)?(x):(y)) |
#define | opcode_ACK 4 |
#define | opcode_DATA 3 |
#define | opcode_ERROR 5 |
#define | opcode_RRQ 1 |
#define | opcode_WRQ 2 |
#define | PKTSIZE (SEGSIZE + 4) /* SEGSIZE defined in arpa/tftp.h */ |
#define | REQUEST_DUMP "log/server.input" |
#define | siginterrupt(x, y) do {} while(0) |
#define | TIMEOUT 5 |
Typedefs | |
typedef RETSIGTYPE(* | SIGHANDLER_T )(int) |
Functions | |
static int | do_tftp (struct testcase *test, struct tftphdr *tp, ssize_t size) |
static RETSIGTYPE | exit_signal_handler (int signum) |
static void | install_signal_handlers (void) |
int | main (int argc, char **argv) |
static void | nak (int error) |
static int | parse_servercmd (struct testcase *req) |
static struct tftphdr * | r_init (void) |
static void | read_ahead (struct testcase *test, int convert) |
static int | readit (struct testcase *test, struct tftphdr **dpp, int convert) |
static void | recvtftp (struct testcase *test, struct formats *pf) |
static void | restore_signal_handlers (void) |
static struct tftphdr * | rw_init (int) |
static void | sendtftp (struct testcase *test, struct formats *pf) |
static int | synchnet (curl_socket_t) |
static int | validate_access (struct testcase *test, const char *fname, int mode) |
static struct tftphdr * | w_init (void) |
static ssize_t | write_behind (struct testcase *test, int convert) |
static int | writeit (struct testcase *test, struct tftphdr *volatile *dpp, int ct, int convert) |
Variables | |
static tftphdr_storage_t | ackbuf |
static struct bf | bfs [2] |
static tftphdr_storage_t | buf |
static int | current |
static struct errmsg | errmsgs [] |
static volatile int | exit_signal = 0 |
static struct formats | formata [] |
static srvr_sockaddr_union_t | from |
static curl_socklen_t | fromlen |
SIG_ATOMIC_T | got_exit_signal = 0 |
static const char * | ipv_inuse = "IPv4" |
static int | maxtimeout = 5 * TIMEOUT |
static int | newline = 0 |
static int | nextone |
static curl_socket_t | peer = CURL_SOCKET_BAD |
static char * | pidname = ".tftpd.pid" |
static int | prevchar = -1 |
const char * | serverlogfile = DEFAULT_LOGFILE |
static int | serverlogslocked = 0 |
static int | timeout |
static int | wrotepidfile = 0 |
#define DEFAULT_LOGFILE "log/tftpd.log" |
#define DEFAULT_PORT 8999 /* UDP */ |
#define ENABLE_CURLX_PRINTF |
#define opcode_ACK 4 |
#define opcode_DATA 3 |
#define opcode_ERROR 5 |
#define opcode_RRQ 1 |
#define opcode_WRQ 2 |
#define REQUEST_DUMP "log/server.input" |
#define siginterrupt | ( | x, | |
y | |||
) | do {} while(0) |
typedef RETSIGTYPE(* SIGHANDLER_T)(int) |
static RETSIGTYPE exit_signal_handler | ( | int | signum | ) | [static] |
static void install_signal_handlers | ( | void | ) | [static] |
static int parse_servercmd | ( | struct testcase * | req | ) | [static] |
static void read_ahead | ( | struct testcase * | test, |
int | convert | ||
) | [static] |
static void restore_signal_handlers | ( | void | ) | [static] |
static int synchnet | ( | curl_socket_t | f | ) | [static] |
static int validate_access | ( | struct testcase * | test, |
const char * | fname, | ||
int | mode | ||
) | [static] |
static ssize_t write_behind | ( | struct testcase * | test, |
int | convert | ||
) | [static] |
tftphdr_storage_t ackbuf [static] |
tftphdr_storage_t buf [static] |
{ { EUNDEF, "Undefined error code" }, { ENOTFOUND, "File not found" }, { EACCESS, "Access violation" }, { ENOSPACE, "Disk full or allocation exceeded" }, { EBADOP, "Illegal TFTP operation" }, { EBADID, "Unknown transfer ID" }, { EEXISTS, "File already exists" }, { ENOUSER, "No such user" }, { -1, 0 } }
volatile int exit_signal = 0 [static] |
srvr_sockaddr_union_t from [static] |
int maxtimeout = 5 * TIMEOUT [static] |
curl_socket_t peer = CURL_SOCKET_BAD [static] |
const char* serverlogfile = DEFAULT_LOGFILE |
int serverlogslocked = 0 [static] |
int wrotepidfile = 0 [static] |