summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2005-06-02 00:18:38 +0200
committerMichael Brown2005-06-02 00:18:38 +0200
commit85a380530d70deb3634d62fdb1330bb90f1b363a (patch)
treeca1cbbd782c5011ee9a8fefdb4f179ed0f9b6222 /src/core
parentIGMP functions separated out from nic.c (diff)
downloadipxe-85a380530d70deb3634d62fdb1330bb90f1b363a.tar.gz
ipxe-85a380530d70deb3634d62fdb1330bb90f1b363a.tar.xz
ipxe-85a380530d70deb3634d62fdb1330bb90f1b363a.zip
Add generic mechanism for background protocols (e.g. ARP, IGMP)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/background.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/core/background.c b/src/core/background.c
new file mode 100644
index 000000000..1cec05a51
--- /dev/null
+++ b/src/core/background.c
@@ -0,0 +1,47 @@
+#include "background.h"
+
+static struct background backgrounds[0] __table_start ( background );
+static struct background backgrounds_end[0] __table_end ( background );
+
+/** @file */
+
+/**
+ * Call send method of all background protocols
+ *
+ * @v timestamp Current time
+ * @ret None -
+ * @err None -
+ *
+ * This calls each background protocol's background::send() method.
+ */
+void background_send ( unsigned long timestamp ) {
+ struct background *background;
+
+ for ( background = backgrounds ; background < backgrounds_end ;
+ background++ ) {
+ if ( background->send )
+ background->send ( timestamp );
+ }
+}
+
+/**
+ * Call process method of all background protocols
+ *
+ * @v timestamp Current time
+ * @v ptype Packet type
+ * @v ip IP header, if present
+ * @ret None -
+ * @err None -
+ *
+ * This calls each background protocol's background::process() method.
+ */
+void background_process ( unsigned long timestamp, unsigned short ptype,
+ struct iphdr *ip ) {
+ struct background *background;
+
+ for ( background = backgrounds ; background < backgrounds_end ;
+ background++ ) {
+ if ( background->process )
+ background->process ( timestamp, ptype, ip );
+ }
+}