aboutsummaryrefslogtreecommitdiffstats
path: root/core/fs/pxe/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/fs/pxe/tcp.c')
-rw-r--r--core/fs/pxe/tcp.c59
1 files changed, 3 insertions, 56 deletions
diff --git a/core/fs/pxe/tcp.c b/core/fs/pxe/tcp.c
index 576aa293..0fb6efd0 100644
--- a/core/fs/pxe/tcp.c
+++ b/core/fs/pxe/tcp.c
@@ -16,63 +16,10 @@
* Common operations for TCP-based network protocols
*/
-#include <lwip/api.h>
#include "pxe.h"
-#include "version.h"
-#include "url.h"
-
-void tcp_close_file(struct inode *inode)
-{
- struct pxe_pvt_inode *socket = PVT(inode);
-
- if (socket->net.lwip.conn) {
- netconn_delete(socket->net.lwip.conn);
- socket->net.lwip.conn = NULL;
- }
- if (socket->net.lwip.buf) {
- netbuf_delete(socket->net.lwip.buf);
- socket->net.lwip.buf = NULL;
- }
-}
-
-void tcp_fill_buffer(struct inode *inode)
-{
- struct pxe_pvt_inode *socket = PVT(inode);
- void *data;
- u16_t len;
- err_t err;
-
- /* Clean up or advance an inuse netbuf */
- if (socket->net.lwip.buf) {
- if (netbuf_next(socket->net.lwip.buf) < 0) {
- netbuf_delete(socket->net.lwip.buf);
- socket->net.lwip.buf = NULL;
- }
- }
- /* If needed get a new netbuf */
- if (!socket->net.lwip.buf) {
- err = netconn_recv(socket->net.lwip.conn, &(socket->net.lwip.buf));
- if (!socket->net.lwip.buf || err) {
- socket->tftp_goteof = 1;
- if (inode->size == -1)
- inode->size = socket->tftp_filepos;
- socket->ops->close(inode);
- return;
- }
- }
- /* Report the current fragment of the netbuf */
- err = netbuf_data(socket->net.lwip.buf, &data, &len);
- if (err) {
- printf("netbuf_data err: %d\n", err);
- kaboom();
- }
- socket->tftp_dataptr = data;
- socket->tftp_filepos += len;
- socket->tftp_bytesleft = len;
- return;
-}
+#include "net.h"
const struct pxe_conn_ops tcp_conn_ops = {
- .fill_buffer = tcp_fill_buffer,
- .close = tcp_close_file,
+ .fill_buffer = core_tcp_fill_buffer,
+ .close = core_tcp_close_file,
};