/usr/share/doc/armagetronad-common/html/net/lower.html is in armagetronad-common 0.2.8.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="date" content="2011-09-11T12:50:24+01:00">
<meta name="author" content="Manuel Moos">
<title>Armagetron: network code documentation</title>
<meta name="description" content="Armagetron: network code documentation">
DEFINE(Armagetron Advanced, Armagetron)
</head><body>
<table width="90%" align=center>
<tr>
<td align=center width="25%">
<a href="index.html" target="_top">Introduction</a>
</td>
<td align=center width="25%">
<a href="lower.html" target="_top">Layer One</a>
</td>
<td align=center width="25%">
<a href="middle.html" target="_top">Layer Two</a>
</td>
<td align=center width="25%">
<a href="upper.html" target="_top">Layer Three</a>
</td>
</tr>
</table>
<a name=><h1 align=center>Layer one: protocol abstraction</h1></a>
<p align=justify>
Skip this layer if you really want to use Armagetron's networking system
fast; it contains details you do not need to know from the start.
</p>
<p align=justify>
This layer is responsible for sending raw data packets to other computers.
The files <code>net_anet.h,net_sysdep.C,net_udp.C</code> and
<code>net_wins.C</code> are responsible for it;
they are written in pure C.
<code>net_anet.h</code> is the header file with the declarations visible to
layer two, and <code>net_systep.C</code> just includes the real
implementation from <code>net_udp.C</code> or <code>net_wins.C</code> depending
on the system Armagetron is compiled for.
</p>
<a name=><h2 align=left>Data structures</h2></a>
<h4 align=left><a name="sockaddr"><code>struct sockaddr:</code></a></h4>
<p align=left>Everything the network protocol needs to identify
a connection to another computer. In the case of UDP, it contains the IP
address and port number.</p><hr>
<h4 align=left><a name="socket"><code>Sockets:</code></a></h4>
<p align=left>represented by integers: in analogy to file descriptors,
all network IO is done
through sockets. Every client has one socket where all the messages to/from
the server are sent/received through. The server has one listening socket for
the messages from new clients, and one IO socket for each client.
(With the UDP protocol, all these sockets are really identical, as there is
no such thing as a connection and no need/possibility to assign a connection
to the sockets.)</p><hr>
<a name=><h2 align=left>Function list</h2></a>
(only the functions layer two actually uses are mentioned)
<h4 align=left><a name="init"><code>Socket ANET_Init();</code></a></h4>
<p align=left>Initialises the network system, returns the
control socket. All future IO is done through that socket.</p><hr>
<h4 align=left><a name="shutdown"><code>void ANET_Shutdown (void);</code></a></h4>
<p align=left>Closes the network system.</p><hr>
<h4 align=left><a name="listen"><code>void ANET_Listen(bool state);</code></a></h4>
<p align=left>If state is true, the listening
socket is initialised (listening at the port <code>net_hostport=4532</code>)
and can be queried by
<code>ANET_CheckNewConnections</code>.</p><hr>
<h4 align=left><a name="checknewconnections"><code>Socket ANET_CheckNewConnections (void);</code></a></h4>
<p align=left>On the server, this checks if there are any new connections
from clients wanting to join the game. Returns a socket ready to receive
the newcomer if there is one, or -1 if not. In case of the UDP protocol,
even the messages from the known clients are caught by this function
(as there is no way to distinguish new and old connections with UDP), so layer
two needs to do some extra checks with this function.
</p><hr>
<h4 align=left><a name="getaddrfromname"><code>int ANET_GetAddrFromName
(const char *name, struct sockaddr *addr);</code></a></h4>
<p align=left>
Fills <code>*addr</code> with the information necessary to reach the server
<code>name</code> (containing the IP address in numerical notation or the
hostname);
the port number is set to <code>net_hostport=4532</code> to match the port
the server listens on.</p><hr>
<h4 align=left><a name="connect"><code>ANET_Connect(Socket s,struct sockaddr *addr);</code></a></h4>
<p align=left>
Opens a connection to the computer given by <code>addr</code> through
the socket <code>s</code>.
As UDP is a connectionless protocol, this does not do
anything currently.</p><hr>
<h4 align=left><a name="write"><code>int ANET_Write (Socket sock, const byte *buf, int len, struct sockaddr *addr);</code></a></h4>
<p align=left>Sends <code>len</code> bytes of data from <code>buf</code> through the socket
<code>sock</code> to the peer identified with <code>*addr</code>. A connection
has to be established before with <code>ANET_Connect()</code>.</p><hr>
<h4 align=left><a name="read"><code>int ANET_Read (Socket sock, byte *buf, int len, struct sockaddr *addr);</code></a></h4>
<p align=left>Reads up to <code>len</code> bytes from the connection associated to
socket <code>sock</code> and stores them in the buffer <code>buf</code>.
(If a connectionless protocol like UDP is used and the socket is a listening
socket, this can mean ANY data coming in at the port the socket listens on...)
The sender's address is stored in <code>*addr</code>, the number of actually
read bytes is returned (Zero means no data was received.)</p><hr>
<h4 align=left><a name="addrtostring"><code>char *ANET_AddrToString (const struct sockaddr *addr);</code></a></h4>
<p align=left>
Returns the information from <code>addr</code> in human readable form.</p><hr>
<h4 align=left><a name="addrcompare"><code>int ANET_AddrCompare (struct sockaddr *addr1, struct sockaddr *addr2);</code></a></h4>
<p align=left>Checks whether <code>*addr1</code> and <code>*addr2</code> are the same
computer (ignoring the port number). If they are, 0 is returned, -1 if not.</p><hr>
<h4 align=left><a name="getsocketport"><code>int ANET_GetSocketPort (struct sockaddr *addr)</code></a></h4>
<p align=left>Returns the port number from <code>*addr</code>.</p><hr>
<br>
<p align=center>This Page was created by
Manuel Moos(<b> </b> <script language="JavaScript"> var b = "sf.net "; var c = "z-man"; var a="users"; document.write(c); document.write("@") ; document.write(a) ; document.write(".") ; document.write(b); </script> ).
<p align=center>
Last modification: Sun Sep 11 12:50:24 CEST 2011
</p>
<table width="90%" align=center>
<tr>
<td align=center width="25%">
<a href="index.html" target="_top">Introduction</a>
</td>
<td align=center width="25%">
<a href="lower.html" target="_top">Layer One</a>
</td>
<td align=center width="25%">
<a href="middle.html" target="_top">Layer Two</a>
</td>
<td align=center width="25%">
<a href="upper.html" target="_top">Layer Three</a>
</td>
</tr>
</table>
</body>
</html>
|