114 DBG (
" buffer underrun at %zx (min %zx)",
119 DBG (
" buffer overrun at %zx (max %zx)",
189 memset ( &server, 0,
sizeof ( server ) );
190 server.sin.sin_family =
AF_INET;
191 server.sin.sin_addr.s_addr = ipaddress;
192 server.sin.sin_port =
port;
196 DBG (
":%s", filename );
197 uri =
pxe_uri ( &server.sa, ( (
char * ) filename ) );
199 DBG (
" could not create URI\n" );
257 DBG (
"PXENV_TFTP_OPEN" );
306 DBG (
"PXENV_TFTP_CLOSE" );
377 DBG (
"PXENV_TFTP_READ to %04x:%04x",
382 tftp_read->
Buffer.offset );
484 DBG (
"PXENV_TFTP_READ_FILE to %08x+%x", tftp_read_file->
Buffer,
489 tftp_read_file->
FileName, 0 ) ) != 0 ) {
555 DBG (
"PXENV_TFTP_GET_FSIZE" );
559 tftp_get_fsize->
FileName, 0 ) ) != 0 ) {
UINT16_t PacketNumber
TFTP packet number.
struct pxe_api_call pxe_tftp_api [] __pxe_api_call
PXE TFTP API.
An object interface operation.
static int pxe_tftp_open(IP4_t ipaddress, UDP_PORT_t port, UINT8_t *filename, UINT16_t blksize)
Open PXE TFTP connection.
IP4_t ServerIPAddress
TFTP server IP address.
struct arbelprm_rc_send_wqe rc
void intf_close(struct interface *intf, int rc)
Close an object interface.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
#define PXENV_EXIT_FAILURE
An error occurred.
#define XFER_FL_ABS_OFFSET
Offset is absolute.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct uri * pxe_uri(struct sockaddr *sa_server, const char *filename)
Construct URI from server address and filename.
#define INTF_INIT(descriptor)
Initialise a static object interface.
Parameter block for pxenv_tftp_read()
int xfer_open_uri(struct interface *intf, struct uri *uri)
Open URI.
#define PXENV_TFTP_READ
PXE API function code for pxenv_tftp_read()
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
PXENV_EXIT_t pxenv_tftp_read_file(struct s_PXENV_TFTP_READ_FILE *tftp_read_file)
TFTP/MTFTP read file.
size_t size
Size of data buffer.
static size_t pxe_tftp_xfer_window(struct pxe_tftp_connection *pxe_tftp)
Check flow control window.
Uniform Resource Identifiers.
unsigned int blkidx
Block index.
Access to external ("user") memory.
size_t xfer_window(struct interface *intf)
Check flow control window.
PXENV_STATUS_t Status
PXE status code.
UINT32_t BufferSize
Size of data buffer.
#define PXE_API_CALL(_opcode, _entry, _params_type)
Define a PXE API call.
Data transfer interfaces.
UINT16_t BufferSize
Size of data buffer.
#define ENOMEM
Not enough space.
static struct interface_descriptor pxe_tftp_xfer_desc
PXE TFTP connection interface descriptor.
UINT16_t PXENV_EXIT_t
A PXE exit code.
IP4_t ServerIPAddress
TFTP server IP address.
uint32_t userptr_t
A pointer to a user buffer.
UINT8_t FileName[128]
File name.
#define PXENV_TFTP_READ_FILE
PXE API function code for pxenv_tftp_read_file()
struct interface xfer
Data transfer interface.
static int tftp_open(struct interface *xfer, struct uri *uri)
Initiate TFTP download.
UINT16_t UDP_PORT_t
A UDP port.
userptr_t buffer
Data buffer.
uint8_t UINT8_t
An 8-bit unsigned integer.
static void pxe_tftp_close(struct pxe_tftp_connection *pxe_tftp, int rc)
Close PXE TFTP connection.
size_t max_offset
Maximum file position.
static struct pxe_tftp_connection pxe_tftp
The PXE TFTP connection.
Parameter block for pxenv_tftp_get_fsize()
static void tftp_close(struct tftp_request *tftp, int rc)
Terminate download.
#define EINPROGRESS
Operation in progress.
Generalized socket address structure.
An object interface descriptor.
char * strerror(int errno)
Retrieve string representation of error number.
#define PXENV_TFTP_OPEN
PXE API function code for pxenv_tftp_open()
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
UINT8_t FileName[128]
File name.
static int pxe_tftp_xfer_deliver(struct pxe_tftp_connection *pxe_tftp, struct io_buffer *iobuf, struct xfer_metadata *meta)
Receive new data.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
int rc
Overall return status code.
Data transfer interface opening.
Parameter block for pxenv_tftp_close()
PXENV_STATUS_t Status
PXE status code.
#define PXENV_EXIT_SUCCESS
No error occurred.
#define PXENV_TFTP_CLOSE
PXE API function code for pxenv_tftp_close()
PXENV_STATUS_t Status
PXE status code.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
const char * sock_ntoa(struct sockaddr *sa)
Transcribe socket address.
size_t start
Starting offset of data buffer.
#define UNULL
Equivalent of NULL for user pointers.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define ENOBUFS
No buffer space available.
uint16_t UINT16_t
A 16-bit unsigned integer.
void * data
Start of data.
void step(void)
Single-step a single process.
Parameter block for pxenv_tftp_read_file()
UINT32_t FileSize
Size of the file.
Parameter block for pxenv_tftp_open()
#define TFTP_DEFAULT_BLKSIZE
Default TFTP data block size.
ADDR32_t Buffer
Address of data buffer.
#define PXENV_TFTP_GET_FSIZE
PXE API function code for pxenv_tftp_get_fsize()
SEGOFF16_t Buffer
Address of data buffer.
A Uniform Resource Identifier.
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
uint32_t blksize
Cipher block size.
static PXENV_EXIT_t pxenv_tftp_read(struct s_PXENV_TFTP_READ *tftp_read)
TFTP READ.
static PXENV_EXIT_t pxenv_tftp_close(struct s_PXENV_TFTP_CLOSE *tftp_close)
TFTP CLOSE.
UINT32_t IP4_t
An IPv4 address.
static PXENV_EXIT_t pxenv_tftp_open(struct s_PXENV_TFTP_OPEN *tftp_open)
TFTP OPEN.
#define PXENV_STATUS_SUCCESS
static PXENV_EXIT_t pxenv_tftp_get_fsize(struct s_PXENV_TFTP_GET_FSIZE *tftp_get_fsize)
TFTP GET FILE SIZE.
#define DBG(...)
Print a debugging message.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define NULL
NULL pointer (VOID *)
static struct interface_operation pxe_tftp_xfer_ops[]
PXE TFTP connection interface operations.
#define PXENV_STATUS(rc)
Derive PXENV_STATUS code from iPXE error number.
#define AF_INET
IPv4 Internet addresses.
size_t blksize
Block size.
size_t offset
File position.
void * memset(void *dest, int character, size_t len) __nonnull