Subversion Repositories Kolibri OS

Rev

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

Rev 3626 Rev 3725
Line 19... Line 19...
19
;;          GNU GENERAL PUBLIC LICENSE                             ;;
19
;;          GNU GENERAL PUBLIC LICENSE                             ;;
20
;;             Version 2, June 1991                                ;;
20
;;             Version 2, June 1991                                ;;
21
;;                                                                 ;;
21
;;                                                                 ;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 23... Line 23...
23
 
23
 
Line 24... Line 24...
24
$Revision: 3626 $
24
$Revision: 3725 $
25
 
25
 
26
uglobal
26
uglobal
27
        net_10ms        dd ?
27
        net_10ms        dd ?
Line 79... Line 79...
79
SO_REUSEADDR            = 1 shl 6
79
SO_REUSEADDR            = 1 shl 6
80
SO_REUSEPORT            = 1 shl 7
80
SO_REUSEPORT            = 1 shl 7
81
SO_USELOOPBACK          = 1 shl 8
81
SO_USELOOPBACK          = 1 shl 8
82
SO_BINDTODEVICE         = 1 shl 9
82
SO_BINDTODEVICE         = 1 shl 9
Line 83... Line -...
83
 
-
 
84
SO_BLOCK                = 1 shl 10      ; TO BE REMOVED
83
 
Line 85... Line 84...
85
SO_NONBLOCK             = 1 shl 31
84
SO_NONBLOCK             = 1 shl 31
86
 
85
 
87
; Socket flags for user calls
86
; Socket flags for user calls
Line 102... Line 101...
102
SS_RCVATMARK            = 0x0040        ; at mark on input
101
SS_RCVATMARK            = 0x0040        ; at mark on input
103
SS_ISABORTING           = 0x0080        ; aborting fd references - close()
102
SS_ISABORTING           = 0x0080        ; aborting fd references - close()
104
SS_RESTARTSYS           = 0x0100        ; restart blocked system calls
103
SS_RESTARTSYS           = 0x0100        ; restart blocked system calls
105
SS_ISDISCONNECTED       = 0x0800        ; socket disconnected from peer
104
SS_ISDISCONNECTED       = 0x0800        ; socket disconnected from peer
Line 106... Line 105...
106
 
105
 
107
SS_ASYNC                = 0x0100        ; async i/o notify
106
SS_ASYNC                = 0x1000        ; async i/o notify
108
SS_ISCONFIRMING         = 0x0200        ; deciding to accept connection req
107
SS_ISCONFIRMING         = 0x2000        ; deciding to accept connection req
Line 109... Line 108...
109
SS_MORETOCOME           = 0x0400
108
SS_MORETOCOME           = 0x4000
Line 110... Line 109...
110
 
109
 
111
SS_BLOCKED              = 0x8000
110
SS_BLOCKED              = 0x8000
Line 112... Line 111...
112
 
111
 
113
 
112
 
-
 
113
SOCKET_MAXDATA          = 4096*32       ; must be 4096*(power of 2) where 'power of 2' is at least 8
-
 
114
MAX_backlog             = 20            ; maximum backlog for stream sockets
-
 
115
 
-
 
116
; Error Codes
-
 
117
ENOBUFS                 = 1
-
 
118
EOPNOTSUPP              = 4
-
 
119
EWOULDBLOCK             = 6
-
 
120
ENOTCONN                = 9
114
SOCKET_MAXDATA          = 4096*32       ; must be 4096*(power of 2) where 'power of 2' is at least 8
121
EALREADY                = 10
115
MAX_backlog             = 20            ; maximum backlog for stream sockets
122
EINVAL                  = 11
116
 
123
EMSGSIZE                = 12
117
; Error Codes
124
ENOMEM                  = 18
Line 211... Line 218...
211
 
218
 
Line 212... Line -...
212
include "socket.inc"
-
 
213
 
219
include "socket.inc"
-
 
220
 
Line 214... Line 221...
214
 
221
 
215
 
222
 
Line 216... Line 223...
216
align 4
223
uglobal
Line 448... Line 455...
448
; OUT: edi = -1 on error, device number otherwise
455
; OUT: edi = -1 on error, device number otherwise
449
;
456
;
450
;-----------------------------------------------------------------
457
;-----------------------------------------------------------------
451
align 4
458
align 4
452
NET_ptr_to_num:
459
NET_ptr_to_num:
-
 
460
 
-
 
461
        call    NET_ptr_to_num4
-
 
462
        ror     edi, 2          ; If -1, stay -1
-
 
463
                                ; valid device numbers have last two bits 0, so do just shr
-
 
464
 
-
 
465
        ret
-
 
466
 
-
 
467
align 4
-
 
468
NET_ptr_to_num4:                ; Todo, place number in device structure so we only need to verify?
-
 
469
 
453
        push    ecx
470
        push    ecx
Line 454... Line 471...
454
 
471
 
455
        mov     ecx, NET_DEVICES_MAX
472
        mov     ecx, NET_DEVICES_MAX
456
        mov     edi, NET_DRV_LIST
-
 
457
 
473
        mov     edi, NET_DRV_LIST
458
  .loop:
474
  .loop:
459
        cmp     ebx, [edi]
475
        cmp     ebx, [edi]
460
        jz      .found
476
        je      .found
461
        add     edi, 4
477
        add     edi, 4
462
        dec     ecx
478
        dec     ecx
Line 463... Line -...
463
        jnz     .loop
-
 
464
 
-
 
465
        ; repnz  scasd could work too if eax is used instead of ebx!
479
        jnz     .loop
466
 
-
 
467
        or      edi, -1
480
 
468
 
481
        or      edi, -1
Line 469... Line 482...
469
        pop     ecx
482
        pop     ecx
470
        ret
483
        ret
471
 
-
 
472
  .found:
-
 
473
        sub     edi, NET_DRV_LIST
484
 
474
        shr     edi, 2
485
  .found:
Line 475... Line 486...
475
 
486
        sub     edi, NET_DRV_LIST
476
        pop     ecx
487
        pop     ecx