More work on IPStack (Also fixed Proc_SpawnWorker)
[tpg/acess2.git] / Modules / IPStack / icmp.c
1 /*
2  * Acess2 IP Stack
3  * - ICMP Handling
4  */
5 #include "ipstack.h"
6 #include "ipv4.h"
7 #include "icmp.h"
8
9 // === PROTOTYPES ===
10 void    ICMP_Initialise();
11 void    ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffer);
12
13 // === GLOBALS ===
14
15 // === CODE ===
16 /**
17  * \fn void ICMP_Initialise()
18  * \brief Initialise the ICMP Layer
19  */
20 void ICMP_Initialise()
21 {
22         IPv4_RegisterCallback(IP4PROT_ICMP, ICMP_GetPacket);
23 }
24
25 /**
26  * \fn void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffer)
27  * \brief Handles a packet from the IP Layer
28  */
29 void ICMP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffer)
30 {
31         tICMPHeader     *hdr = Buffer;
32         
33         Log("[ICMP ] hdr->Type = %i", hdr->Type);
34         Log("[ICMP ] hdr->Code = %i", hdr->Code);
35         Log("[ICMP ] hdr->Checksum = 0x%x", ntohs(hdr->Checksum));
36         Log("[ICMP ] hdr->ID = 0x%x", ntohs(hdr->ID));
37         Log("[ICMP ] hdr->Sequence = 0x%x", ntohs(hdr->Sequence));
38 }

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