summaryrefslogtreecommitdiff
path: root/src/user/app/ethdump/ethdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/ethdump/ethdump.c')
-rw-r--r--src/user/app/ethdump/ethdump.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/user/app/ethdump/ethdump.c b/src/user/app/ethdump/ethdump.c
deleted file mode 100644
index 17592a1..0000000
--- a/src/user/app/ethdump/ethdump.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "proto.h"
-#include "util.h"
-#include <camellia/syscalls.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <user/lib/thread.h>
-
-struct net_state state = {
- // TODO dynamically get mac
- .mac = {0x52, 0x54, 0x00, 0xCA, 0x77, 0x1A},
- .ip = (192 << 24) + (168 << 16) + 11,
-};
-
-void network_thread(void *arg) { (void)arg;
- const size_t buflen = 4096;
- char *buf = malloc(buflen);
- for (;;) {
- long ret = _syscall_read(state.raw_h, buf, buflen, -1);
- if (ret < 0) break;
- ether_parse((void*)buf, ret);
- }
- free(buf);
-}
-
-void fs_thread(void *arg);
-
-int main(void) {
- const char *path = "/kdev/eth";
- state.raw_h = _syscall_open(path, strlen(path), 0);
- if (state.raw_h < 0) {
- eprintf("couldn't open %s", path);
- return 1;
- }
-
- thread_create(0, network_thread, NULL);
- thread_create(0, fs_thread, NULL);
- _syscall_await();
- return 0;
-}