diff --git a/project/Core/Src/tftp.c b/project/Core/Src/tftp.c index 790c733..c3b8aa4 100644 --- a/project/Core/Src/tftp.c +++ b/project/Core/Src/tftp.c @@ -24,7 +24,11 @@ static tftp_custom_file_t virt_file[] = {{.name = "index.txt", .data = NULL, .le {.name = "virtImage.bmp", .data = NULL, .len = 0, .offset = 0}, {.name = "virtImage.gif", .data = NULL, .len = 0, .offset = 0}, {.name = "virtText.txt", .data = NULL, .len = 0, .offset = 0}}; - +static void* tftp_open(const char* fname, const char* mode, uint8_t write); +static void tftp_close(void* handle); +static int tftp_read(void* handle, void* buf, int bytes); +static int tftp_write(void* handle, struct pbuf* p); +static struct tftp_context tftpContext_s = {.open = tftp_open, .close = tftp_close, .read = tftp_read, .write = tftp_write}; /** * @brief tftp custom file functions to set the offset and read the data * @param[in,out] handle Custom file handles @@ -109,7 +113,7 @@ size_t tftp_custom_fwrite(const void* buf, size_t bytes, tftp_custom_file_t* han * @param write Flag indicating read (0) or write (!= 0) access * @return void* File handle supplied to other functions */ -void* tftp_open(const char* fname, const char* mode, uint8_t write) { +static void* tftp_open(const char* fname, const char* mode, uint8_t write) { LOG_INFO(TAG, "Opening %s", fname); UNUSED(mode); @@ -133,7 +137,7 @@ void* tftp_open(const char* fname, const char* mode, uint8_t write) { * * @param handle The handle to the file to close */ -void tftp_close(void* handle) { +static void tftp_close(void* handle) { LOG_INFO(TAG, "closing file"); if (handle == NULL) { LOG_CRIT(TAG, "handle is null"); @@ -177,7 +181,7 @@ void tftp_close(void* handle) { * @param bytes Number of bytes to copy to buf * @return int >= 0: Success; < 0: Error */ -int tftp_read(void* handle, void* buf, int bytes) { +static int tftp_read(void* handle, void* buf, int bytes) { int ret = 0; LOG_INFO(TAG, "reading file"); if (handle == NULL) { @@ -215,7 +219,7 @@ int tftp_read(void* handle, void* buf, int bytes) { * In other words, TFTP headers are stripped off. * @return int >= 0: Success; < 0: Error */ -int tftp_write(void* handle, struct pbuf* p) { +static int tftp_write(void* handle, struct pbuf* p) { LOG_INFO(TAG, "Writing file"); tftp_custom_file_t* file = (tftp_custom_file_t*)handle; if (file == &virt_file[VIRT_IMAGE_BMP] || file == &virt_file[VIRT_IMAGE_GIF] || file == &virt_file[VIRT_TEXT_TXT]) { @@ -264,8 +268,6 @@ void init_index(void) { LOG_INFO(TAG, "index.txt created"); } -struct tftp_context tftpContext_s = {.open = tftp_open, .close = tftp_close, .read = tftp_read, .write = tftp_write}; - /** * @brief Initialize tftp server */