More work on UDI, Added more Login VTerms
[tpg/acess2.git] / Modules / IPStack / icmp.c
index 4eb4fa4..5d53cc6 100644 (file)
@@ -3,11 +3,12 @@
  * - ICMP Handling
  */
 #include "ipstack.h"
+#include "ipv4.h"
 #include "icmp.h"
 
 // === PROTOTYPES ===
 void   ICMP_Initialise();
-void   ICMP_GetPacket(tInterface *Interface, int Length, void *Buffer);
+void   ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffer);
 
 // === GLOBALS ===
 
@@ -18,7 +19,7 @@ void  ICMP_GetPacket(tInterface *Interface, int Length, void *Buffer);
  */
 void ICMP_Initialise()
 {
-       
+       IPv4_RegisterCallback(IP4PROT_ICMP, ICMP_GetPacket);
 }
 
 /**
@@ -27,6 +28,11 @@ void ICMP_Initialise()
  */
 void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffer)
 {
-       //tICMPHeader   *hdr = Buffer;
+       tICMPHeader     *hdr = Buffer;
        
+       Log("[ICMP ] hdr->Type = %i", hdr->Type);
+       Log("[ICMP ] hdr->Code = %i", hdr->Code);
+       Log("[ICMP ] hdr->Checksum = 0x%x", ntohs(hdr->Checksum));
+       Log("[ICMP ] hdr->ID = 0x%x", ntohs(hdr->ID));
+       Log("[ICMP ] hdr->Sequence = 0x%x", ntohs(hdr->Sequence));
 }

UCC git Repository :: git.ucc.asn.au