mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 01:22:37 +03:00
Update ftp.c and hello.c to use the generic async_operations API.
This commit is contained in:
@@ -8,8 +8,12 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/async.h>
|
||||
#include <gpxe/tcp.h>
|
||||
|
||||
/** FTP default port */
|
||||
#define FTP_PORT 21
|
||||
|
||||
/**
|
||||
* FTP states
|
||||
*
|
||||
@@ -45,12 +49,8 @@ struct ftp_request {
|
||||
* remote server.
|
||||
*/
|
||||
void ( *callback ) ( char *data, size_t len );
|
||||
/** Completion indicator
|
||||
*
|
||||
* This will be set to a non-zero value when the transfer is
|
||||
* complete. A negative value indicates an error.
|
||||
*/
|
||||
int complete;
|
||||
/** Asynchronous operation for this FTP operation */
|
||||
struct async_operation aop;
|
||||
|
||||
/** Current state */
|
||||
enum ftp_state state;
|
||||
@@ -69,6 +69,6 @@ struct ftp_request {
|
||||
struct tcp_connection tcp_data;
|
||||
};
|
||||
|
||||
extern void ftp_connect ( struct ftp_request *ftp );
|
||||
struct async_operation * ftp_get ( struct ftp_request *ftp );
|
||||
|
||||
#endif
|
||||
#endif /* _GPXE_FTP_H */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gpxe/tcp.h>
|
||||
#include <gpxe/async.h>
|
||||
|
||||
enum hello_state {
|
||||
HELLO_SENDING_MESSAGE = 1,
|
||||
@@ -37,10 +38,10 @@ struct hello_request {
|
||||
* remote server.
|
||||
*/
|
||||
void ( *callback ) ( char *data, size_t len );
|
||||
/** Connection complete indicator */
|
||||
int complete;
|
||||
/** Asynchronous operation */
|
||||
struct async_operation aop;
|
||||
};
|
||||
|
||||
extern void hello_connect ( struct hello_request *hello );
|
||||
extern struct async_operation * say_hello ( struct hello_request *hello );
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user