824d6ffa7f
I want to get to the point where any header in include/ reflects a standard user-level header (e.g. a POSIX header), while everything that's specific to gPXE lives in include/gpxe/. Headers that reflect a Linux header (e.g. if_ether.h) should also be in include/gpxe/, with the same name as the Linux header and, preferably, the same names used for the definitions.
47 lines
862 B
C
47 lines
862 B
C
#ifndef _GPXE_HELLO_H
|
|
#define _GPXE_HELLO_H
|
|
|
|
/** @file
|
|
*
|
|
* "Hello world" TCP protocol
|
|
*
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <gpxe/tcp.h>
|
|
|
|
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 );
|
|
/** Connection complete indicator */
|
|
int complete;
|
|
};
|
|
|
|
extern int hello_connect ( struct hello_request *hello );
|
|
|
|
#endif
|