mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-01-01 02:06:32 +00:00
81 lines
4.6 KiB
HTML
Executable file
81 lines
4.6 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.07">
|
|
<style type="text/css">
|
|
body {background-color:#1f1f1f;}
|
|
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
|
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
|
.cF2{color:#73a255;background-color:#1f1f1f;}
|
|
.cF3{color:#297582;background-color:#1f1f1f;}
|
|
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
|
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
|
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
|
.cF7{color:#444444;background-color:#1f1f1f;}
|
|
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
|
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
|
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
|
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
|
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
|
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
|
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
|
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> UDP_MAX_PORT </span><span class=cFE>65535</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF1>class</span><span class=cF0> CUDPMessageQueue:</span><span class=cF9>CQueue</span><span class=cF0>
|
|
<a name="l4"></a>{ </span><span class=cF2>// each bound socket queues data. recv functions & handler use this.</span><span class=cF0>
|
|
<a name="l5"></a> </span><span class=cF1>U8</span><span class=cF0> *data; </span><span class=cF2>// contains the UDP payload data.</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> data_length; </span><span class=cF2>// size of payload data.</span><span class=cF0>
|
|
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> received_length; </span><span class=cF2>// amount of the data received so far.</span><span class=cF0>
|
|
<a name="l8"></a> CSocketAddressStorage from_address; </span><span class=cF2>// when UDP Handler sees UDP packet, this is filled with where packet came from.</span><span class=cF0>
|
|
<a name="l9"></a> </span><span class=cF2>// recvfrom uses this to fill its address_out parameter.</span><span class=cF0>
|
|
<a name="l10"></a>};
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF1>class</span><span class=cF0> CUDPSocket
|
|
<a name="l13"></a>{
|
|
<a name="l14"></a> CSocket *socket;
|
|
<a name="l15"></a> CUDPMessageQueue *receive_queue;
|
|
<a name="l16"></a> CSocketAddressStorage receive_address; </span><span class=cF2>// based on ->family, cast or assign to a var as IPV4/IPV6 CSocketAddress</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF9>I64</span><span class=cF0> receive_timeout_ms;
|
|
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> receive_max_timeout;
|
|
<a name="l19"></a> </span><span class=cF9>U16</span><span class=cF0> bound_to; </span><span class=cF2>// represents the currently bound port</span><span class=cF0>
|
|
<a name="l20"></a>};
|
|
<a name="l21"></a>
|
|
<a name="l22"></a></span><span class=cF1>class</span><span class=cF0> CUDPTreeQueue:</span><span class=cF9>CQueue</span><span class=cF0>
|
|
<a name="l23"></a>{
|
|
<a name="l24"></a> CUDPSocket *socket;
|
|
<a name="l25"></a>};
|
|
<a name="l26"></a>
|
|
<a name="l27"></a></span><span class=cF1>class</span><span class=cF0> CUDPTreeNode:CBST
|
|
<a name="l28"></a>{
|
|
<a name="l29"></a> CUDPTreeQueue *queue;
|
|
<a name="l30"></a>};
|
|
<a name="l31"></a>
|
|
<a name="l32"></a></span><span class=cF1>class</span><span class=cF0> CUDPRepEntry:</span><span class=cF9>CQueue</span><span class=cF0>
|
|
<a name="l33"></a>{
|
|
<a name="l34"></a> CUDPTreeNode *node;
|
|
<a name="l35"></a>};
|
|
<a name="l36"></a>
|
|
<a name="l37"></a></span><span class=cF1>class</span><span class=cF0> CUDPHeader
|
|
<a name="l38"></a>{
|
|
<a name="l39"></a> </span><span class=cF9>U16</span><span class=cF0> source_port;
|
|
<a name="l40"></a> </span><span class=cF9>U16</span><span class=cF0> destination_port;
|
|
<a name="l41"></a> </span><span class=cF9>U16</span><span class=cF0> length;
|
|
<a name="l42"></a> </span><span class=cF9>U16</span><span class=cF0> checksum;
|
|
<a name="l43"></a>};
|
|
<a name="l44"></a>
|
|
<a name="l45"></a>
|
|
<a name="l46"></a></span><span class=cF1>class</span><span class=cF0> CUDPGlobals
|
|
<a name="l47"></a>{
|
|
<a name="l48"></a>
|
|
<a name="l49"></a> CUDPTreeNode *bound_socket_tree;
|
|
<a name="l50"></a>
|
|
<a name="l51"></a>} udp_globals;
|
|
<a name="l52"></a>
|
|
</span></pre></body>
|
|
</html>
|