aboutsummaryrefslogtreecommitdiff
path: root/echoplus.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2020-12-18 16:28:05 +0000
committerrodri <rgl@antares-labs.eu>2020-12-18 16:28:05 +0000
commit6b56dcfb94347af43b0213863b79bcee3530b742 (patch)
tree6f73352fd7c20522e84ee106e1630d2873f22720 /echoplus.c
parent47b8a9471fe006cef74d1ba8f8a2839fd8164041 (diff)
downloadechod-6b56dcfb94347af43b0213863b79bcee3530b742.tar.gz
echod-6b56dcfb94347af43b0213863b79bcee3530b742.tar.bz2
echod-6b56dcfb94347af43b0213863b79bcee3530b742.zip
added echo+ support.
Diffstat (limited to 'echoplus.c')
-rw-r--r--echoplus.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/echoplus.c b/echoplus.c
new file mode 100644
index 0000000..fa83e3d
--- /dev/null
+++ b/echoplus.c
@@ -0,0 +1,47 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <utf.h>
+#include <fmt.h>
+#include "dat.h"
+#include "fns.h"
+
+int
+getechoplus(UDPEchoPlus *ephdr, uchar *data)
+{
+ ephdr->gensn = get32(data);
+ data += 4;
+ ephdr->ressn = get32(data);
+ data += 4;
+ ephdr->rxtime = get32(data);
+ data += 4;
+ ephdr->txtime = get32(data);
+ data += 4;
+ ephdr->ntxfails = get32(data);
+ data += 4;
+ ephdr->iterno = get32(data);
+
+ return 0;
+}
+
+void
+putechoplus(UDPEchoPlus *ephdr, uchar *data)
+{
+ put32(data, ephdr->gensn);
+ data += 4;
+ put32(data, ephdr->ressn);
+ data += 4;
+ put32(data, ephdr->rxtime);
+ data += 4;
+ put32(data, ephdr->txtime);
+ data += 4;
+ put32(data, ephdr->ntxfails);
+ data += 4;
+ put32(data, ephdr->iterno);
+}