Moved "hello world" protocol implementation out of prototester.c and into
[people/xl0/gpxe.git] / src / include / gpxe / hello.h
1 #ifndef _HELLO_H
2 #define _HELLO_H
3
4 /** @file
5  *
6  * "Hello world" TCP protocol
7  *
8  */
9
10 #include <stdint.h>
11 #include <gpxe/tcp.h>
12
13 enum hello_state {
14         HELLO_SENDING_MESSAGE = 1,
15         HELLO_SENDING_ENDL,
16 };
17
18 /**
19  * A "hello world" request
20  *
21  */
22 struct hello_request {
23         /** TCP connection for this request */
24         struct tcp_connection tcp;
25         /** Current state */
26         enum hello_state state;
27         /** Message to be transmitted */
28         const char *message;
29         /** Amount of message remaining to be transmitted */
30         size_t remaining;
31         /** Callback function
32          *
33          * @v data      Received data
34          * @v len       Length of received data
35          *
36          * This function is called for all data received from the
37          * remote server.
38          */
39         void ( *callback ) ( char *data, size_t len );
40         /** Connection complete indicator */
41         int complete;
42 };
43
44 extern int hello_connect ( struct hello_request *hello );
45
46 #endif