summaryrefslogtreecommitdiff
path: root/net/inet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/inet.c')
-rw-r--r--net/inet.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/inet.c b/net/inet.c
index 67895d5..88698c5 100644
--- a/net/inet.c
+++ b/net/inet.c
@@ -1,4 +1,8 @@
#include "inet.h"
+#include "icmp.h"
+#include "kmalloc.h"
+#include "udp.h"
+#include "ntp.h"
uint16_t ntohs(uint16_t val)
{
@@ -36,3 +40,21 @@ uint16_t checksum(void *addr, int count)
return ~sum;
}
+
+bool net_packet(struct netdev *dev)
+{
+ uint32_t packet=kballoc(1)+4096; // we start one byte after the end;
+ //
+ uint32_t addr=(144)+(76<<8)+(106<<16)+(46<<24);
+ uint32_t google_time=216+(239<<8)+(35<<16)+(0<<24);
+ // this should of course be filled dynamically!
+ //uint32_t pos=icmp_ping(dev,addr,packet,packet); // create ping packet and get new position;
+ //uint32_t pos=udp_generic(dev, addr, 666, 123, packet,packet);
+ uint32_t pos=ntp_generic(dev, google_time, 6666, 123, packet,packet);
+
+ //
+ dev->transmit(pos,(packet-pos));
+
+ kbfree(packet-4096); // TODO: take care it is not overwritten before transmitted!
+ return true;
+}