Rev 1256 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1256 | Rev 1257 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | ;; GNU GENERAL PUBLIC LICENSE ;; |
15 | ;; GNU GENERAL PUBLIC LICENSE ;; |
16 | ;; Version 2, June 1991 ;; |
16 | ;; Version 2, June 1991 ;; |
17 | ;; ;; |
17 | ;; ;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 19... | Line 19... | ||
19 | 19 | ||
Line 20... | Line 20... | ||
20 | $Revision: 1256 $ |
20 | $Revision: 1257 $ |
21 | 21 | ||
22 | uglobal |
22 | uglobal |
23 | last_1sTick db ? |
23 | last_1sTick db ? |
Line 27... | Line 27... | ||
27 | MAX_NET_DEVICES equ 16 |
27 | MAX_NET_DEVICES equ 16 |
Line 28... | Line 28... | ||
28 | 28 | ||
29 | MIN_EPHEMERAL_PORT equ 49152 |
29 | MIN_EPHEMERAL_PORT equ 49152 |
Line 30... | Line 30... | ||
30 | MAX_EPHEMERAL_PORT equ 61000 |
30 | MAX_EPHEMERAL_PORT equ 61000 |
31 | 31 | ||
Line 32... | Line 32... | ||
32 | ETHER equ 1337 |
32 | ETHER equ 1337 ; TODO: find another value for this (how does it work in posix ?) |
33 | ETHER_ARP equ 0x0608 |
33 | ETHER_ARP equ 0x0608 |
34 | 34 | ||
Line 103... | Line 103... | ||
103 | include "socket.inc" |
103 | include "socket.inc" |
104 | include "tcp.inc" |
104 | include "tcp.inc" |
105 | include "udp.inc" |
105 | include "udp.inc" |
106 | include "icmp.inc" |
106 | include "icmp.inc" |
Line 107... | Line 107... | ||
107 | 107 | ||
108 | ;----------------------------------------------- |
108 | ;----------------------------------------------------------------- |
109 | ; |
109 | ; |
110 | ; stack_init |
110 | ; stack_init |
111 | ; |
111 | ; |
112 | ; This function calls all network init procedures |
112 | ; This function calls all network init procedures |
113 | ; |
113 | ; |
114 | ; IN: / |
114 | ; IN: / |
115 | ; OUT: / |
115 | ; OUT: / |
116 | ; |
116 | ; |
117 | ;----------------------------------------------- |
- | |
118 | 117 | ;----------------------------------------------------------------- |
|
119 | align 4 |
118 | align 4 |
Line 120... | Line 119... | ||
120 | stack_init: |
119 | stack_init: |
121 | 120 | ||
Line 134... | Line 133... | ||
134 | 133 | ||
Line 135... | Line 134... | ||
135 | ret |
134 | ret |
136 | 135 | ||
137 | 136 | ||
138 | 137 | ||
139 | ;----------------------------------------------- |
138 | ;----------------------------------------------------------------- |
140 | ; |
139 | ; |
141 | ; stack_handler |
140 | ; stack_handler |
142 | ; |
141 | ; |
143 | ; This function calls all network init procedures |
142 | ; This function calls all network init procedures |
144 | ; |
143 | ; |
145 | ; IN: / |
- | |
146 | ; OUT: / |
144 | ; IN: / |
147 | ; |
145 | ; OUT: / |
Line 148... | Line 146... | ||
148 | ;----------------------------------------------- |
146 | ; |
149 | 147 | ;----------------------------------------------------------------- |
|
Line 181... | Line 179... | ||
181 | 179 | ||
182 | .exit: |
180 | .exit: |
Line 183... | Line -... | ||
183 | ret |
- | |
184 | - | ||
185 | - | ||
186 | 181 | ret |
|
187 | 182 | ||
188 | 183 | ||
189 | ;----------------------------------------------------------------- |
184 | ;----------------------------------------------------------------- |
190 | ; |
185 | ; |
Line 196... | Line 191... | ||
196 | ; esi = pointer to data |
191 | ; esi = pointer to data |
197 | ; ecx = data size |
192 | ; ecx = data size |
198 | ; OUT: edx = semi-checksum |
193 | ; OUT: edx = semi-checksum |
199 | ; |
194 | ; |
200 | ;----------------------------------------------------------------- |
195 | ;----------------------------------------------------------------- |
201 | - | ||
202 | align 4 |
196 | align 4 |
203 | checksum_1: |
197 | checksum_1: |
Line 204... | Line 198... | ||
204 | 198 | ||
205 | xor eax, eax |
199 | xor eax, eax |
Line 220... | Line 214... | ||
220 | .end: |
214 | .end: |
Line 221... | Line 215... | ||
221 | 215 | ||
Line 222... | Line -... | ||
222 | ret |
- | |
223 | 216 | ret |
|
224 | 217 | ||
225 | 218 | ||
226 | ;----------------------------------------------------------------- |
219 | ;----------------------------------------------------------------- |
227 | ; |
220 | ; |
228 | ; checksum_2 |
221 | ; checksum_2 |
229 | ; |
222 | ; |
230 | ; This function calculates the final ip/tcp/udp checksum for you |
223 | ; This function calculates the final ip/tcp/udp checksum for you |
231 | ; |
224 | ; |
232 | ; IN: edx = semi-checksum |
225 | ; IN: edx = semi-checksum |
233 | ; OUT: dx = checksum (in INET byte order) |
- | |
234 | ; |
226 | ; OUT: dx = checksum (in INET byte order) |
235 | ;----------------------------------------------------------------- |
227 | ; |
Line 236... | Line 228... | ||
236 | 228 | ;----------------------------------------------------------------- |
|
237 | align 4 |
229 | align 4 |
Line 260... | Line 252... | ||
260 | ;---------------------------------------------------------------- |
252 | ;---------------------------------------------------------------- |
261 | ; |
253 | ; |
262 | ; System function to work with network devices (73) |
254 | ; System function to work with network devices (73) |
263 | ; |
255 | ; |
264 | ;---------------------------------------------------------------- |
256 | ;---------------------------------------------------------------- |
265 | - | ||
266 | align 4 |
257 | align 4 |
267 | sys_network: |
258 | sys_network: |
Line 268... | Line 259... | ||
268 | 259 | ||
269 | cmp ebx, -1 |
260 | cmp ebx, -1 |
Line 344... | Line 335... | ||
344 | ;---------------------------------------------------------------- |
335 | ;---------------------------------------------------------------- |
345 | ; |
336 | ; |
346 | ; System Function To work with Protocols (75) |
337 | ; System Function To work with Protocols (75) |
347 | ; |
338 | ; |
348 | ;---------------------------------------------------------------- |
339 | ;---------------------------------------------------------------- |
349 | - | ||
350 | align 4 |
340 | align 4 |
351 | sys_protocols: |
341 | sys_protocols: |
352 | cmp bh, MAX_NET_DEVICES ; Check if device number exists |
342 | cmp bh, MAX_NET_DEVICES ; Check if device number exists |
353 | jge .doesnt_exist |
343 | jge .doesnt_exist |