Path: blob/a-new-beginning/SharedDependencies/Sources/libslirp/include/tftp.h
2 views
/* SPDX-License-Identifier: BSD-3-Clause */1/* tftp defines */23#ifndef SLIRP_TFTP_H4#define SLIRP_TFTP_H56#include "util.h"78#define TFTP_SESSIONS_MAX 20910#define TFTP_SERVER 691112#define TFTP_RRQ 113#define TFTP_WRQ 214#define TFTP_DATA 315#define TFTP_ACK 416#define TFTP_ERROR 517#define TFTP_OACK 61819#define TFTP_FILENAME_MAX 51220#define TFTP_BLOCKSIZE_MAX 14282122SLIRP_PACKED_BEGIN23struct tftphdr {24struct udphdr udp;25uint16_t tp_op;26} SLIRP_PACKED_END;2728SLIRP_PACKED_BEGIN29struct tftp_t {30struct tftphdr hdr;31union {32struct {33uint16_t tp_block_nr;34uint8_t tp_buf[TFTP_BLOCKSIZE_MAX];35} tp_data;36struct {37uint16_t tp_error_code;38uint8_t tp_msg[TFTP_BLOCKSIZE_MAX];39} tp_error;40char tp_buf[TFTP_BLOCKSIZE_MAX + 2];41} x;42} SLIRP_PACKED_END;4344struct tftp_session {45Slirp *slirp;46char *filename;47int fd;48uint16_t block_size;4950struct sockaddr_storage client_addr;51uint16_t client_port;52uint32_t block_nr;5354int timestamp;55};5657/* Process TFTP packet coming from the guest */58void tftp_input(struct sockaddr_storage *srcsas, struct mbuf *m);5960/* Clear remaining sessions */61void tftp_cleanup(Slirp *slirp);6263#endif646566