Subversion Repositories Kolibri OS

Rev

Rev 4030 | Rev 4056 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4030 Rev 4052
Line 419... Line 419...
419
        jz      .invalid
419
        jz      .invalid
Line 420... Line 420...
420
 
420
 
421
        cmp     esi, 2
421
        cmp     esi, 2
Line -... Line 422...
-
 
422
        jb      .invalid
-
 
423
 
-
 
424
        cmp     [eax + UDP_SOCKET.LocalPort], 0         ; Socket can only be bound once
422
        jb      .invalid
425
        jnz     .invalid
423
 
426
 
Line 424... Line 427...
424
        cmp     word [edx], AF_INET4
427
        cmp     word [edx], AF_INET4
425
        je      .af_inet4
428
        je      .af_inet4
Line 454... Line 457...
454
 
457
 
Line 455... Line 458...
455
        jmp     .notsupp
458
        jmp     .notsupp
456
 
459
 
457
  .tcp:
-
 
458
  .udp:
-
 
459
        mov     ebx, [edx + 4]                  ; First, fill in the IP
-
 
460
        test    ebx, ebx                        ; If IP is 0, use default
-
 
461
        jnz     @f
-
 
462
        mov     ebx, [IP_LIST + 4]      ;;;;; FIXME !i!i!i
-
 
463
       @@:
-
 
464
        mov     [eax + IP_SOCKET.LocalIP], ebx
-
 
465
 
-
 
466
        mov     bx, [edx + 2]                   ; Now fill in the local port if it's still available
-
 
Line -... Line 460...
-
 
460
  .tcp:
-
 
461
  .udp:
-
 
462
 
-
 
463
        pushd   [edx + 4]                       ; First, fill in the IP
-
 
464
        popd    [eax + IP_SOCKET.LocalIP]
-
 
465
 
-
 
466
        mov     bx, [edx + 2]                   ; Did caller specify a local port?
-
 
467
        test    bx, bx
-
 
468
        jnz     .just_check
-
 
469
        call    SOCKET_find_port                ; Nope, find an ephemeral one
-
 
470
        jmp     .done
-
 
471
 
-
 
472
  .just_check:
-
 
473
        call    SOCKET_check_port               ; Yes, check if it's still available
467
        call    SOCKET_check_port
474
        jz      .addrinuse                      ; ZF is set by socket_check_port on error
468
        jz      .addrinuse                      ; ZF is set by socket_check_port, on error
475
 
469
 
476
  .done:
Line 470... Line 477...
470
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_bind: local ip=%u.%u.%u.%u\n",\
477
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_bind: local ip=%u.%u.%u.%u\n",\