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

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