mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-13 11:47:00 +08:00
Improve TFTP implementation
- implement server/client mode (API is nicer to use) - Increase TFTP_MAX_MODE_LEN to be able to contain "netascii" transfer mode - Adapt tftp_example to changes
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "lwip/apps/tftp_common.h"
|
||||
|
||||
err_t tftp_init_client(const struct tftp_context* ctx);
|
||||
err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode);
|
||||
err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode);
|
||||
|
||||
|
||||
@@ -94,7 +94,11 @@ struct tftp_context {
|
||||
void (*error)(void* handle, int err, const char* msg, int size);
|
||||
};
|
||||
|
||||
err_t tftp_init(const struct tftp_context* ctx);
|
||||
#define LWIP_TFTP_MODE_SERVER 0x01
|
||||
#define LWIP_TFTP_MODE_CLIENT 0x02
|
||||
#define LWIP_TFTP_MODE_CLIENTSERVER (LWIP_TFTP_MODE_SERVER | LWIP_TFTP_MODE_CLIENT)
|
||||
|
||||
err_t tftp_init_common(u8_t mode, const struct tftp_context* ctx);
|
||||
void tftp_cleanup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
* Max. length of TFTP mode
|
||||
*/
|
||||
#if !defined TFTP_MAX_MODE_LEN || defined __DOXYGEN__
|
||||
#define TFTP_MAX_MODE_LEN 7
|
||||
#define TFTP_MAX_MODE_LEN 10
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification,are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -37,4 +37,6 @@
|
||||
|
||||
#include "lwip/apps/tftp_common.h"
|
||||
|
||||
err_t tftp_init_server(const struct tftp_context* ctx);
|
||||
|
||||
#endif /* LWIP_HDR_APPS_TFTP_SERVER_H */
|
||||
|
||||
Reference in New Issue
Block a user