Rev 6011 | Rev 7679 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6011 | Rev 6911 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; UDP.INC ;; |
6 | ;; UDP.INC ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Part of the tcp/ip network stack for KolibriOS ;; |
8 | ;; Part of the tcp/ip network stack for KolibriOS ;; |
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 6011 $ |
17 | $Revision: 6911 $ |
Line 18... | Line 18... | ||
18 | 18 | ||
Line 322... | Line 322... | ||
322 | push eax edx |
322 | push eax edx |
323 | lea ecx, [eax + SOCKET.mutex] |
323 | lea ecx, [eax + SOCKET.mutex] |
324 | call mutex_lock |
324 | call mutex_lock |
325 | pop edx eax |
325 | pop edx eax |
Line 326... | Line 326... | ||
326 | 326 | ||
327 | ; Fill in local IP |
- | |
328 | cmp [eax + IP_SOCKET.LocalIP], 0 |
- | |
329 | jne @f |
- | |
330 | push [IP_LIST + 4] ; FIXME: use correct local IP |
- | |
331 | pop [eax + IP_SOCKET.LocalIP] |
- | |
332 | - | ||
333 | ; Fill in remote port and IP, overwriting eventually previous values |
327 | ; Fill in remote port and IP |
334 | pushw [edx + 2] |
328 | pushw [edx + 2] |
Line 335... | Line 329... | ||
335 | pop [eax + UDP_SOCKET.RemotePort] |
329 | pop [eax + UDP_SOCKET.RemotePort] |
336 | 330 | ||
- | 331 | pushd [edx + 4] |
|
- | 332 | pop [eax + UDP_SOCKET.RemoteIP] |
|
- | 333 | ||
- | 334 | ; Find route to host |
|
- | 335 | pusha |
|
- | 336 | push eax |
|
- | 337 | mov ebx, [eax + UDP_SOCKET.device] |
|
- | 338 | mov edx, [eax + UDP_SOCKET.LocalIP] |
|
- | 339 | mov eax, [eax + UDP_SOCKET.RemoteIP] |
|
- | 340 | call ipv4_route |
|
- | 341 | test eax, eax |
|
- | 342 | jz .enoroute |
|
- | 343 | pop eax |
|
- | 344 | mov ebx, [NET_DRV_LIST + edi] |
|
- | 345 | mov [eax + UDP_SOCKET.device], ebx |
|
Line 337... | Line 346... | ||
337 | pushd [edx + 4] |
346 | mov [eax + UDP_SOCKET.LocalIP], edx |
338 | pop [eax + IP_SOCKET.RemoteIP] |
347 | popa |
339 | 348 | ||
340 | ; Find a local port, if user didnt define one |
349 | ; Find a local port, if user didnt define one |
Line 351... | Line 360... | ||
351 | call socket_is_connected |
360 | call socket_is_connected |
Line 352... | Line 361... | ||
352 | 361 | ||
353 | xor eax, eax |
362 | xor eax, eax |
Line -... | Line 363... | ||
- | 363 | ret |
|
- | 364 | ||
- | 365 | .enoroute: |
|
- | 366 | pop eax |
|
- | 367 | popa |
|
- | 368 | xor eax, eax |
|
- | 369 | dec eax |
|
- | 370 | mov ebx, EADDRNOTAVAIL |
|
Line 354... | Line 371... | ||
354 | ret |
371 | ret |
355 | 372 | ||
356 | 373 | ||
357 | ;-----------------------------------------------------------------; |
374 | ;-----------------------------------------------------------------; |