Rev 3861 | Rev 4035 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3861 | Rev 4030 | ||
---|---|---|---|
Line 180... | Line 180... | ||
180 | ; jne .next_socket |
180 | ; jne .next_socket |
181 | ; @@: |
181 | ; @@: |
182 | ; |
182 | ; |
183 | ; FIXME: UDP should check remote IP, but not under all circumstances! |
183 | ; FIXME: UDP should check remote IP, but not under all circumstances! |
Line 184... | Line 184... | ||
184 | 184 | ||
185 | cmp [eax + UDP_SOCKET.firstpacket], 0 |
185 | cmp [eax + UDP_SOCKET.RemotePort], 0 |
Line 186... | Line 186... | ||
186 | je .updateport |
186 | je .updateport |
187 | 187 | ||
Line 209... | Line 209... | ||
209 | call mutex_lock |
209 | call mutex_lock |
210 | popa |
210 | popa |
Line 211... | Line 211... | ||
211 | 211 | ||
212 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: new remote port=%x\n", cx ; FIXME: find a way to print big endian values with debugf |
212 | DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: new remote port=%x\n", cx ; FIXME: find a way to print big endian values with debugf |
213 | mov [eax + UDP_SOCKET.RemotePort], cx |
- | |
214 | inc [eax + UDP_SOCKET.firstpacket] |
- | |
215 | 213 | mov [eax + UDP_SOCKET.RemotePort], cx |
|
Line 216... | Line 214... | ||
216 | jmp .updatesock |
214 | jmp .updatesock |
Line 217... | Line 215... | ||
217 | 215 | ||
Line 309... | Line 307... | ||
309 | or eax, -1 |
307 | or eax, -1 |
310 | ret |
308 | ret |
Line -... | Line 309... | ||
- | 309 | ||
- | 310 | ||
- | 311 | ||
- | 312 | ||
- | 313 | ;----------------------------------------------------------------- |
|
- | 314 | ; |
|
- | 315 | ; UDP_connect |
|
- | 316 | ; |
|
- | 317 | ; IN: eax = socket pointer |
|
- | 318 | ; OUT: eax = 0 ok / -1 error |
|
- | 319 | ; ebx = error code |
|
- | 320 | ; |
|
- | 321 | ;------------------------- |
|
- | 322 | align 4 |
|
- | 323 | UDP_connect: |
|
- | 324 | ||
- | 325 | test [eax + SOCKET.state], SS_ISCONNECTED |
|
- | 326 | jz @f |
|
- | 327 | call UDP_disconnect |
|
- | 328 | @@: |
|
- | 329 | ||
- | 330 | push eax |
|
- | 331 | lea ecx, [eax + SOCKET.mutex] |
|
- | 332 | call mutex_lock |
|
- | 333 | pop eax |
|
- | 334 | ||
- | 335 | ; Fill in local IP |
|
- | 336 | cmp [eax + IP_SOCKET.LocalIP], 0 |
|
- | 337 | jne @f |
|
- | 338 | push [IP_LIST + 4] ; FIXME: use correct local IP |
|
- | 339 | pop [eax + IP_SOCKET.LocalIP] |
|
- | 340 | ||
- | 341 | ; Fill in remote port and IP, overwriting eventually previous values |
|
- | 342 | pushw [edx + 2] |
|
- | 343 | pop [eax + UDP_SOCKET.RemotePort] |
|
- | 344 | ||
- | 345 | pushd [edx + 4] |
|
- | 346 | pop [eax + IP_SOCKET.RemoteIP] |
|
- | 347 | ||
- | 348 | ; Find a local port, if user didnt define one |
|
- | 349 | cmp [eax + UDP_SOCKET.LocalPort], 0 |
|
- | 350 | jne @f |
|
- | 351 | call SOCKET_find_port |
|
- | 352 | @@: |
|
- | 353 | ||
- | 354 | push eax |
|
- | 355 | init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue |
|
- | 356 | pop eax |
|
- | 357 | ||
- | 358 | push eax |
|
- | 359 | lea ecx, [eax + SOCKET.mutex] |
|
- | 360 | call mutex_unlock |
|
- | 361 | pop eax |
|
- | 362 | ||
- | 363 | call SOCKET_is_connected |
|
- | 364 | ||
- | 365 | xor eax, eax |
|
- | 366 | ret |
|
- | 367 | ||
- | 368 | ||
- | 369 | ;----------------------------------------------------------------- |
|
- | 370 | ; |
|
- | 371 | ; UDP_disconnect |
|
- | 372 | ; |
|
- | 373 | ; IN: eax = socket pointer |
|
- | 374 | ; OUT: eax = socket pointer |
|
- | 375 | ; |
|
- | 376 | ;------------------------- |
|
- | 377 | align 4 |
|
- | 378 | UDP_disconnect: |
|
- | 379 | ||
- | 380 | ; TODO: remove the pending received data |
|
- | 381 | ||
- | 382 | call SOCKET_is_disconnected |
|
- | 383 | ||
- | 384 | ret |
|
- | 385 | ||
- | 386 | ||
311 | 387 | ||
312 | 388 | ||
313 | 389 | ||
314 | ;--------------------------------------------------------------------------- |
390 | ;--------------------------------------------------------------------------- |
315 | ; |
391 | ; |