Subversion Repositories Kolibri OS

Rev

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

Rev 2612 Rev 2614
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: 2612 $
17
$Revision: 2614 $
18
 
18
 
19
; Socket states
19
; Socket states
20
TCPS_CLOSED             equ 0
20
TCPS_CLOSED             = 0
21
TCPS_LISTEN             equ 1
21
TCPS_LISTEN             = 1
22
TCPS_SYN_SENT           equ 2
22
TCPS_SYN_SENT           = 2
23
TCPS_SYN_RECEIVED       equ 3
23
TCPS_SYN_RECEIVED       = 3
24
TCPS_ESTABLISHED        equ 4
24
TCPS_ESTABLISHED        = 4
25
TCPS_CLOSE_WAIT         equ 5
25
TCPS_CLOSE_WAIT         = 5
26
TCPS_FIN_WAIT_1         equ 6
26
TCPS_FIN_WAIT_1         = 6
27
TCPS_CLOSING            equ 7
27
TCPS_CLOSING            = 7
28
TCPS_LAST_ACK           equ 8
28
TCPS_LAST_ACK           = 8
Line 29... Line 29...
29
TCPS_FIN_WAIT_2         equ 9
29
TCPS_FIN_WAIT_2         = 9
30
TCPS_TIMED_WAIT         equ 10
30
TCPS_TIMED_WAIT         = 10
31
 
31
 
32
; Socket Flags
32
; Socket Flags
33
TF_ACKNOW               equ 1 shl 0     ; ack peer immediately
33
TF_ACKNOW               = 1 shl 0     ; ack peer immediately
34
TF_DELACK               equ 1 shl 1     ; ack, but try to delay it
34
TF_DELACK               = 1 shl 1     ; ack, but try to delay it
35
TF_NODELAY              equ 1 shl 2     ; don't delay packets to coalesce
35
TF_NODELAY              = 1 shl 2     ; don't delay packets to coalesce
36
TF_NOOPT                equ 1 shl 3     ; don't use tcp options
36
TF_NOOPT                = 1 shl 3     ; don't use tcp options
37
TF_SENTFIN              equ 1 shl 4     ; have sent FIN
37
TF_SENTFIN              = 1 shl 4     ; have sent FIN
38
TF_REQ_SCALE            equ 1 shl 5     ; have/will request window scaling
38
TF_REQ_SCALE            = 1 shl 5     ; have/will request window scaling
39
TF_RCVD_SCALE           equ 1 shl 6     ; other side has requested scaling
39
TF_RCVD_SCALE           = 1 shl 6     ; other side has requested scaling
Line 40... Line 40...
40
TF_REQ_TSTMP            equ 1 shl 7     ; have/will request timestamps
40
TF_REQ_TSTMP            = 1 shl 7     ; have/will request timestamps
41
TF_RCVD_TSTMP           equ 1 shl 8     ; a timestamp was received in SYN
41
TF_RCVD_TSTMP           = 1 shl 8     ; a timestamp was received in SYN
42
TF_SACK_PERMIT          equ 1 shl 9     ; other side said I could SACK
42
TF_SACK_PERMIT          = 1 shl 9     ; other side said I could SACK
43
 
43
 
44
; Segment flags
44
; Segment flags
45
TH_FIN                  equ 1 shl 0
45
TH_FIN                  = 1 shl 0
46
TH_SYN                  equ 1 shl 1
46
TH_SYN                  = 1 shl 1
Line 47... Line 47...
47
TH_RST                  equ 1 shl 2
47
TH_RST                  = 1 shl 2
48
TH_PUSH                 equ 1 shl 3
48
TH_PUSH                 = 1 shl 3
49
TH_ACK                  equ 1 shl 4
49
TH_ACK                  = 1 shl 4
50
TH_URG                  equ 1 shl 5
50
TH_URG                  = 1 shl 5
51
 
51
 
52
; Segment header options
52
; Segment header options
Line 53... Line 53...
53
TCP_OPT_EOL             equ 0           ; End of option list.
53
TCP_OPT_EOL             = 0           ; End of option list.
54
TCP_OPT_NOP             equ 1           ; No-Operation.
54
TCP_OPT_NOP             = 1           ; No-Operation.
55
TCP_OPT_MAXSEG          equ 2           ; Maximum Segment Size.
55
TCP_OPT_MAXSEG          = 2           ; Maximum Segment Size.
56
TCP_OPT_WINDOW          equ 3           ; window scale
56
TCP_OPT_WINDOW          = 3           ; window scale
57
TCP_OPT_TIMESTAMP       equ 8
57
TCP_OPT_TIMESTAMP       = 8
58
 
58
 
59
; Fundamental timer values
59
; Fundamental timer values
60
TCP_time_MSL            equ 47          ; max segment lifetime (30s)
60
TCP_time_MSL            = 47          ; max segment lifetime (30s)
61
TCP_time_re_min         equ 2           ; min retransmission (1,28s)
61
TCP_time_re_min         = 2           ; min retransmission (1,28s)
62
TCP_time_re_max         equ 100         ; max retransmission (64s)
62
TCP_time_re_max         = 100         ; max retransmission (64s)
63
TCP_time_pers_min       equ 8           ; min persist (5,12s)
63
TCP_time_pers_min       = 8           ; min persist (5,12s)
Line 64... Line 64...
64
TCP_time_pers_max       equ 94          ; max persist (60,16s)
64
TCP_time_pers_max       = 94          ; max persist (60,16s)
65
TCP_time_keep_init      equ 118         ; connectione stablishment (75,52s)
65
TCP_time_keep_init      = 118         ; connectione stablishment (75,52s)
66
TCP_time_keep_idle      equ 4608        ; idle time before 1st probe (2h)
66
TCP_time_keep_idle      = 4608        ; idle time before 1st probe (2h)
Line 67... Line 67...
67
TCP_time_keep_interval  equ 118         ; between probes when no response (75,52s)
67
TCP_time_keep_interval  = 118         ; between probes when no response (75,52s)
68
TCP_time_rtt_default    equ 5           ; default Round Trip Time (3,2s)
68
TCP_time_rtt_default    = 5           ; default Round Trip Time (3,2s)
69
TCP_time_srtt_default   equ 0           ;
69
TCP_time_srtt_default   = 0           ;
Line 70... Line 70...
70
 
70
 
Line 71... Line 71...
71
; timer constants
71
; timer constants
Line 72... Line 72...
72
TCP_max_rxtshift        equ 12          ; max retransmissions waiting for ACK
72
TCP_max_rxtshift        = 12          ; max retransmissions waiting for ACK
Line 73... Line 73...
73
TCP_max_keepcnt         equ 8           ; max keepalive probes
73
TCP_max_keepcnt         = 8           ; max keepalive probes
74
 
74
 
Line 94... Line 94...
94
 
94
 
Line 95... Line 95...
95
ends
95
ends
96
 
96
 
97
align 4
97
align 4
98
uglobal
98
uglobal
99
        TCP_headers_tx          rd IP_MAX_INTERFACES
99
        TCP_segments_tx         rd IP_MAX_INTERFACES
100
        TCP_headers_rx          rd IP_MAX_INTERFACES
100
        TCP_segments_rx         rd IP_MAX_INTERFACES
101
        TCP_bytes_rx            rq IP_MAX_INTERFACES
101
        TCP_bytes_rx            rq IP_MAX_INTERFACES
102
        TCP_bytes_tx            rq IP_MAX_INTERFACES
102
        TCP_bytes_tx            rq IP_MAX_INTERFACES
Line 112... Line 112...
112
;
112
;
113
;-----------------------------------------------------------------
113
;-----------------------------------------------------------------
114
macro   TCP_init {
114
macro   TCP_init {
Line 115... Line 115...
115
 
115
 
116
        xor     eax, eax
116
        xor     eax, eax
117
        mov     edi, TCP_headers_tx
117
        mov     edi, TCP_segments_tx
118
        mov     ecx, (6*IP_MAX_INTERFACES)
118
        mov     ecx, (6*IP_MAX_INTERFACES)
Line 119... Line 119...
119
        rep     stosd
119
        rep     stosd
120
 
120
 
Line 142... Line 142...
142
;
142
;
143
; OUT:
143
; OUT:
144
;
144
;
145
;---------------------------------------------------------------------------
145
;---------------------------------------------------------------------------
146
align 4
146
align 4
147
TCP_API:
147
TCP_api:
Line 148... Line 148...
148
 
148
 
149
        movzx   eax, bh
149
        movzx   eax, bh
Line 150... Line 150...
150
        shl     eax, 2
150
        shl     eax, 2
Line 157... Line 157...
157
.error:
157
  .error:
158
        mov     eax, -1
158
        mov     eax, -1
159
        ret
159
        ret
Line 160... Line 160...
160
 
160
 
161
.packets_tx:
161
  .packets_tx:
162
        add     eax, TCP_headers_tx
-
 
163
        mov     eax, [eax]
162
        mov     eax, [TCP_segments_tx + eax]
Line 164... Line 163...
164
        ret
163
        ret
165
 
164
 
166
.packets_rx:
-
 
167
        add     eax, TCP_headers_rx
165
  .packets_rx: