summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2006-03-23 23:37:05 +0100
committerMichael Brown2006-03-23 23:37:05 +0100
commit7e61f38799366618bc4fa5dfb512c4451098f5ff (patch)
tree8290382db26d6a22f20cd1be95b5e260ffcf24a0 /src/include
parentAdded container_of(). This seems about the best place to put it, since (diff)
downloadipxe-7e61f38799366618bc4fa5dfb512c4451098f5ff.tar.gz
ipxe-7e61f38799366618bc4fa5dfb512c4451098f5ff.tar.xz
ipxe-7e61f38799366618bc4fa5dfb512c4451098f5ff.zip
Moved "hello world" protocol implementation out of prototester.c and into
the first standalong uIP-based protocol module.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/hello.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/include/gpxe/hello.h b/src/include/gpxe/hello.h
new file mode 100644
index 000000000..23ee336f1
--- /dev/null
+++ b/src/include/gpxe/hello.h
@@ -0,0 +1,46 @@
+#ifndef _HELLO_H
+#define _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