657bce5abf347861a5997fe9f06c6f6e69dae418
[tpg/acess2.git] / Modules / IPStack / udp.h
1 /*
2  * Acess2 IP Stack
3  * - UDP Definitions
4  */
5 #ifndef _UDP_H_
6 #define _UDP_H_
7
8 #include "ipstack.h"
9 #include "ipv4.h"
10
11 typedef struct sUDPHeader       tUDPHeader;
12 typedef struct sUDPServer       tUDPServer;
13 typedef struct sUDPPacket       tUDPPacket;
14 typedef struct sUDPChannel      tUDPChannel;
15
16 struct sUDPHeader
17 {
18         Uint16  SourcePort;
19         Uint16  DestPort;
20         Uint16  Length;
21         Uint16  Checksum;
22         Uint8   Data[];
23 };
24
25 struct sUDPPacket
26 {
27         struct sUDPPacket       *Next;
28         size_t  Length;
29         Uint8   Data[];
30 };
31
32 struct sUDPChannel
33 {
34         struct sUDPChannel      *Next;
35         tInterface      *Interface;
36         Uint16  LocalPort;
37         union {
38                 tIPv4   v4;
39                 tIPv6   v6;
40         }       RemoteAddr;
41         Uint16  RemotePort;
42         tVFS_Node       Node;
43         tShortSpinlock  lQueue;
44         tUDPPacket      * volatile Queue;
45         tUDPPacket      *QueueEnd;
46 };
47
48 struct sUDPServer
49 {
50         struct sUDPServer       *Next;
51         
52         tVFS_Node       Node;
53         
54         tInterface      *Interface;
55         Uint16  ListenPort;
56          int    NextID;
57          int    NumChannels;
58         tUDPChannel     *Channels;
59         tMutex  Lock;
60         tUDPChannel     * volatile NewChannels;
61 };
62
63 #endif

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