Files
2023-Webservices_And_Applic…/project/Core/Src/tftp.c
Sander Speetjens 1a6a2db34e TFTP
make the context more readable
2023-11-06 22:05:43 +01:00

40 lines
930 B
C

/**
* @file tftp.c
* @brief tftp server
* @author Speetjens S.
*/
#include "tftp.h"
static const char* TAG = "tftp_server";
void *tftp_open(const char *fname, const char *mode, u8_t write) {
LOG_INFO(TAG, "Opening %s", fname);
}
void tftp_close(void *handle) {
LOG_INFO(TAG, "closing file");
}
int tftp_read(void* handle, void* buf, int bytes) {
LOG_INFO(TAG, "reading file");
}
int tftp_write(void* handle, struct pbuf* p) {
LOG_INFO(TAG, "Writing file");
}
struct tftp_context tftpContext_s = {
.open = tftp_open,
.close = tftp_close,
.read = tftp_read,
.write = tftp_write
};
void tftp_server_init(void) {
LOG_INFO(TAG, "Initializing tftp server");
if (tftp_init(&tftpContext_s) != ERR_OK) {
LOG_FATAL(TAG, "Could not initialize tftp server");
return;
}
LOG_INFO(TAG, "tftp server initialized successfully");
}