2006-04-24 15:42:49 +00:00
|
|
|
#ifndef _GPXE_HELLO_H
|
|
|
|
#define _GPXE_HELLO_H
|
2006-03-23 22:37:05 +00:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* "Hello world" TCP protocol
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <gpxe/tcp.h>
|
2006-06-19 15:46:58 +00:00
|
|
|
#include <gpxe/async.h>
|
2006-03-23 22:37:05 +00:00
|
|
|
|
|
|
|
enum hello_state {
|
|
|
|
HELLO_SENDING_MESSAGE = 1,
|
|
|
|
HELLO_SENDING_ENDL,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A "hello world" request
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct hello_request {
|
|
|
|
/** TCP connection for this request */
|
|
|
|
struct tcp_connection tcp;
|
|
|
|
/** Current state */
|
|
|
|
enum hello_state state;
|
|
|
|
/** Message to be transmitted */
|
|
|
|
const char *message;
|
|
|
|
/** Amount of message remaining to be transmitted */
|
|
|
|
size_t remaining;
|
|
|
|
/** Callback function
|
|
|
|
*
|
|
|
|
* @v data Received data
|
|
|
|
* @v len Length of received data
|
|
|
|
*
|
|
|
|
* This function is called for all data received from the
|
|
|
|
* remote server.
|
|
|
|
*/
|
|
|
|
void ( *callback ) ( char *data, size_t len );
|
2006-06-19 15:46:58 +00:00
|
|
|
/** Asynchronous operation */
|
|
|
|
struct async_operation aop;
|
2006-03-23 22:37:05 +00:00
|
|
|
};
|
|
|
|
|
2006-06-19 15:46:58 +00:00
|
|
|
extern struct async_operation * say_hello ( struct hello_request *hello );
|
2006-03-23 22:37:05 +00:00
|
|
|
|
|
|
|
#endif
|