From 0fe74493f48c25bb92373e68bf6856eda7ac5667 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 9 May 2005 14:27:29 +0000 Subject: Protocols now load data into a buffer; they don't execute it. --- src/include/dev.h | 13 ++++--------- src/include/proto.h | 10 +++------- src/include/tftp.h | 9 +++------ 3 files changed, 10 insertions(+), 22 deletions(-) (limited to 'src/include') diff --git a/src/include/dev.h b/src/include/dev.h index 8bf173554..0d0d4d8ef 100644 --- a/src/include/dev.h +++ b/src/include/dev.h @@ -3,6 +3,7 @@ #include "stdint.h" #include "string.h" +#include "buffer.h" #include "dhcp.h" /* for dhcp_dev_id */ #include "tables.h" @@ -182,10 +183,7 @@ struct type_driver { struct type_dev *type_dev; /* single instance */ char * ( * describe_device ) ( struct type_dev *type_dev ); int ( * configure ) ( struct type_dev *type_dev ); - int ( * load ) ( struct type_dev *type_dev, - int ( * process ) ( unsigned char *data, - unsigned int blocknum, - unsigned int len, int eof ) ); + int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer ); }; #define __type_driver __attribute__ (( used, __table_section(type_driver,01) )) @@ -277,11 +275,8 @@ static inline int configure ( struct dev *dev ) { return dev->type_driver->configure ( dev->type_dev ); } /* Boot from a device */ -static inline int load ( struct dev *dev, - int ( * process ) ( unsigned char *data, - unsigned int blocknum, - unsigned int len, int eof ) ) { - return dev->type_driver->load ( dev->type_dev, process ); +static inline int load ( struct dev *dev, struct buffer *buffer ) { + return dev->type_driver->load ( dev->type_dev, buffer ); } #endif /* DEV_H */ diff --git a/src/include/proto.h b/src/include/proto.h index 2c157ee4e..fb4e4137c 100644 --- a/src/include/proto.h +++ b/src/include/proto.h @@ -2,18 +2,14 @@ #define PROTO_H #include "tables.h" +#include "buffer.h" #include "in.h" struct protocol { char *name; in_port_t default_port; - int ( * load ) ( char *url, - struct sockaddr_in *server, - char *file, - int ( * process ) ( unsigned char *data, - unsigned int blocknum, - unsigned int len, - int eof ) ); + int ( * load ) ( char *url, struct sockaddr_in *server, char *file, + struct buffer *buffer ); }; /* diff --git a/src/include/tftp.h b/src/include/tftp.h index 5f129ead9..70192067c 100644 --- a/src/include/tftp.h +++ b/src/include/tftp.h @@ -2,6 +2,7 @@ #define TFTP_H #include "in.h" +#include "buffer.h" #include "nic.h" #define TFTP_PORT 69 @@ -83,11 +84,7 @@ struct tftpblk_info_t { */ extern int tftp_block ( struct tftpreq_info_t *request, struct tftpblk_info_t *block ); -extern int tftp ( char *url, - struct sockaddr_in *server, - char *file, - int ( * process ) ( unsigned char *data, - unsigned int blocknum, - unsigned int len, int eof ) ); +extern int tftp ( char *url, struct sockaddr_in *server, char *file, + struct buffer *buffer ); #endif /* TFTP_H */ -- cgit v1.2.3-55-g7522