/*
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  pxe/tftp.h
 * Purpose: Definitions for TFTP API services
 * Entries: None
 *
 **************************************************************************
 *
 * Copyright (C) 1998-2003 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: tftp.h,v 1.4 2003/01/25 23:29:40 gkminix Exp $
 */

#ifndef _PXE_TFTP_H
#define _PXE_TFTP_H


/*
 **************************************************************************
 *
 * This file contains the TFTP API definitions as per Intels PXE
 * specification version 1.0.
 *
 **************************************************************************
 *
 * TFTP opcodes:
 */
#define TFTP_OPEN		0x0020
#define TFTP_CLOSE		0x0021
#define TFTP_READ_DATA		0x0022
#define TFTP_READ_FILE		0x0023
#define TFTP_GET_FILE_SIZE	0x0025

#define TFTP_MINNUM		0x0020
#define TFTP_MAXNUM		0x0025



/*
 **************************************************************************
 *
 * Definition of structure for TFTP_OPEN function:
 */
#ifndef _USE_ASSEMBLER

typedef struct s_tftp_open {
	unsigned int  status;		/* Out: function status */
	unsigned long server;		/* In: server IP address */
	unsigned long gateway;		/* In: gateway IP address */
	unsigned char filename[128];	/* In: name of file */
	unsigned int  port;		/* In: port number */
	unsigned int  pktsize;		/* In: packet size */
} t_tftp_open;

#else

o_to_status		equ	$0000	! Out: status
o_to_server		equ	$0002	! In: server IP address
o_to_gateway		equ	$0006	! In: gateway IP address
o_to_filename		equ	$000A	! In: name of file
o_to_port		equ	$008A	! In: port number
o_to_pktsize		equ	$008C	! In: packet size

tftp_open_size		equ	$008C	! size of function structure

#endif				/* _USE_ASSEMBLER */



/*
 **************************************************************************
 *
 * Definition of structure for TFTP_CLOSE function:
 */
#ifndef _USE_ASSEMBLER

typedef struct s_tftp_close {
	unsigned int  status;		/* Out: function status */
} t_tftp_close;

#else

o_tc_status		equ	$0000	! Out: status

tftp_close_size		equ	$0002	! size of function structure

#endif				/* _USE_ASSEMBLER */



/*
 **************************************************************************
 *
 * Definition of structure for TFTP_READ_DATA function:
 */
#ifndef _USE_ASSEMBLER

typedef struct s_tftp_read_data {
	unsigned int  status;		/* Out: function status */
	unsigned int  packetno;		/* Out: packet number */
	unsigned int  bufsize;		/* In/Out: size of receive buffer */
	unsigned int  bufofs;		/* In: far pointer to receive buffer */
	unsigned int  bufseg;
} t_tftp_read_data;

#else

o_trd_status		equ	$0000	! Out: status
o_trd_packetno		equ	$0002	! Out: packet number
o_trd_bufsize		equ	$0004	! In/Out: size of receive buffer
o_trd_buffer		equ	$0006	! In: far pointer to receive buffer

tftp_read_data_size	equ	$000A	! size of function structure

#endif				/* _USE_ASSEMBLER */



/*
 **************************************************************************
 *
 * Definition of structure for TFTP_READ_FILE function:
 */
#ifndef _USE_ASSEMBLER

typedef struct s_tftp_read_file {
	unsigned int  status;		/* Out: function status */
	unsigned char filename[128];	/* In: file name */
	unsigned long bufsize;		/* In: size of receive buffer */
	unsigned long buffer;		/* In: linear address of buffer */
	unsigned long server;		/* In: server IP address */
	unsigned long gateway;		/* In: gateway IP address */
	unsigned long mcast;		/* In: file multicast IP address */
	unsigned int  clntport;		/* In: client multicast port */
	unsigned int  srvport;		/* In: server multicast port */
	unsigned int  opentimeout;	/* In: open/ack timeout */
	unsigned int  reopendelay;	/* In: MTFTP reopen delay */
} t_tftp_read_file;

#else

o_trf_status		equ	$0000	! Out: status
o_trf_filename		equ	$0002	! In: file name
o_trf_bufsize		equ	$0082	! In: size of receive buffer
o_trf_buffer		equ	$0086	! In: linear address of buffer
o_trf_server		equ	$008A	! In: server IP address
o_trf_gateway		equ	$008E	! In: gateway IP address
o_trf_mcast		equ	$0092	! In: file multicast IP address
o_trf_clntport		equ	$0096	! In: client multicast port
o_trf_srvport		equ	$0098	! In: server multicast port
o_trf_opentimeout	equ	$009A	! In: open/ack timeout
o_trf_reopendelay	equ	$009C	! In: MTFTP reopen delay

tftp_read_file_size	equ	$009E	! size of function structure

#endif				/* _USE_ASSEMBLER */



/*
 **************************************************************************
 *
 * Definition of structure for TFTP_GET_FILE_SIZE function:
 */
#ifndef _USE_ASSEMBLER

typedef struct s_tftp_get_file_size {
	unsigned int  status;		/* Out: function status */
	unsigned long server;		/* In: server IP address */
	unsigned long gateway;		/* In: gateway IP address */
	unsigned char filename[128];	/* In: file name */
	unsigned long filesize;		/* Out: size of file in bytes */
} t_tftp_get_file_size;

#else

o_trfs_status		equ	$0000	! Out: status
o_trfs_server		equ	$0002	! In: server IP address
o_trfs_gateway		equ	$0006	! In: gateway IP address
o_trfs_filename		equ	$000A	! In: file name
o_trfs_filesize		equ	$008A	! Out: size of file in bytes

tftp_get_file_size_size	equ	$008E	! size of function structure

#endif				/* _USE_ASSEMBLER */
#endif				/* _PXE_TFTP_H */



syntax highlighted by Code2HTML, v. 0.9.1