Subversion Repositories Kolibri OS

Rev

Rev 7680 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3545 hidnplayr 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
7974 hidnplayr 3
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved.    ;;
3545 hidnplayr 4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
6
;;  Part of the TCP/IP network stack for KolibriOS                 ;;
7
;;                                                                 ;;
8
;;   Written by hidnplayr@kolibrios.org                            ;;
9
;;                                                                 ;;
10
;;    Based on the code of 4.4BSD                                  ;;
11
;;                                                                 ;;
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
13
;;             Version 2, June 1991                                ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16
 
4850 mario79 17
$Revision: 7974 $
3545 hidnplayr 18
 
19
align 4
20
iglobal
21
        TCP_backoff     db 0,1,2,3,4,5,6,6,6,6,6,6,6
22
endg
23
 
6011 hidnplayr 24
macro   tcp_checksum IP1, IP2 {
3545 hidnplayr 25
 
26
;-------------
27
; Pseudoheader
28
 
29
        ; protocol type
30
        mov     edx, IP_PROTO_TCP
31
 
32
        ; source address
33
        add     dl, byte [IP1+1]
34
        adc     dh, byte [IP1+0]
35
        adc     dl, byte [IP1+3]
36
        adc     dh, byte [IP1+2]
37
 
38
        ; destination address
39
        adc     dl, byte [IP2+1]
40
        adc     dh, byte [IP2+0]
41
        adc     dl, byte [IP2+3]
42
        adc     dh, byte [IP2+2]
43
 
44
        ; size
45
        adc     dl, cl
46
        adc     dh, ch
47
 
48
        adc     edx, 0
49
 
50
;---------------------
51
; Real header and data
52
 
53
        push    esi
54
        call    checksum_1
55
        call    checksum_2
56
        pop     esi
57
 
58
}       ; returns in dx only
59
 
60
 
61
 
62
 
6011 hidnplayr 63
macro   tcp_sendseqinit ptr {
3545 hidnplayr 64
 
6011 hidnplayr 65
        push    edi                     ;;;; FIXME: i dont like this static use of edi
3545 hidnplayr 66
        mov     edi, [ptr + TCP_SOCKET.ISS]
67
        mov     [ptr + TCP_SOCKET.SND_UP], edi
68
        mov     [ptr + TCP_SOCKET.SND_MAX], edi
69
        mov     [ptr + TCP_SOCKET.SND_NXT], edi
70
        mov     [ptr + TCP_SOCKET.SND_UNA], edi
71
        pop     edi
72
 
73
}
74
 
75
 
76
 
6011 hidnplayr 77
macro   tcp_rcvseqinit ptr {
3545 hidnplayr 78
 
79
        push    edi
80
        mov     edi, [ptr + TCP_SOCKET.IRS]
6476 hidnplayr 81
        inc     edi                             ; SYN ocupies a sequence number
3545 hidnplayr 82
        mov     [ptr + TCP_SOCKET.RCV_NXT], edi
83
        mov     [ptr + TCP_SOCKET.RCV_ADV], edi
84
        pop     edi
85
 
86
}
87
 
88
 
89
 
6011 hidnplayr 90
macro   tcp_init_socket socket {
3545 hidnplayr 91
 
7680 hidnplayr 92
; new tcp control block
93
 
3545 hidnplayr 94
        mov     [socket + TCP_SOCKET.t_maxseg], TCP_mss_default
95
        mov     [socket + TCP_SOCKET.t_flags], TF_REQ_SCALE or TF_REQ_TSTMP
96
 
97
        mov     [socket + TCP_SOCKET.t_srtt], TCP_time_srtt_default
98
        mov     [socket + TCP_SOCKET.t_rttvar], TCP_time_rtt_default * 4
99
        mov     [socket + TCP_SOCKET.t_rttmin], TCP_time_re_min
100
;;; TODO: TCP_time_rangeset
101
 
102
        mov     [socket + TCP_SOCKET.SND_CWND], TCP_max_win shl TCP_max_winshift
103
        mov     [socket + TCP_SOCKET.SND_SSTHRESH], TCP_max_win shl TCP_max_winshift
104
 
7974 hidnplayr 105
        mov     [socket + TCP_SOCKET.RCV_SCALE], 0
106
        mov     [socket + TCP_SOCKET.SND_SCALE], 0
3545 hidnplayr 107
 
108
}
109
 
110
 
5976 hidnplayr 111
;-----------------------------------------------------------------;
112
;                                                                 ;
6011 hidnplayr 113
; tcp_pull_out_of_band                                            ;
5976 hidnplayr 114
;                                                                 ;
115
;  IN:  eax = ?                                                   ;
116
;       ebx = socket ptr                                          ;
117
;       edx = tcp packet ptr                                      ;
118
;                                                                 ;
119
; OUT:  /                                                         ;
120
;                                                                 ;
121
;-----------------------------------------------------------------;
3545 hidnplayr 122
align 4
6011 hidnplayr 123
tcp_pull_out_of_band:
3545 hidnplayr 124
 
6011 hidnplayr 125
        DEBUGF  DEBUG_NETWORK_VERBOSE, "tcp_pull_out_of_band\n"
3545 hidnplayr 126
 
127
        ;;;; 1282-1305
128
 
129
        ret
130
 
131
 
132
 
5976 hidnplayr 133
;-----------------------------------------------------------------;
134
;                                                                 ;
6011 hidnplayr 135
; tcp_drop                                                        ;
5976 hidnplayr 136
;                                                                 ;
137
;  IN:  eax = socket ptr                                          ;
138
;       ebx = error number                                        ;
139
;                                                                 ;
140
;  OUT: eax = socket ptr                                          ;
141
;                                                                 ;
142
;-----------------------------------------------------------------;
3545 hidnplayr 143
align 4
7974 hidnplayr 144
tcp_drop:
3545 hidnplayr 145
 
7974 hidnplayr 146
;;; TODO: check if error code is "Connection timed out' and handle accordingly
147
 
6011 hidnplayr 148
        DEBUGF  DEBUG_NETWORK_VERBOSE, "tcp_drop: %x\n", eax
3545 hidnplayr 149
 
150
        cmp     [eax + TCP_SOCKET.t_state], TCPS_SYN_RECEIVED
151
        jb      .no_syn_received
152
 
153
        mov     [eax + TCP_SOCKET.t_state], TCPS_CLOSED
154
 
4365 hidnplayr 155
        push    eax
6011 hidnplayr 156
        call    tcp_output
4365 hidnplayr 157
        pop     eax
3545 hidnplayr 158
 
7974 hidnplayr 159
        inc     [TCPS_drops]
3545 hidnplayr 160
 
7974 hidnplayr 161
        mov     [eax + SOCKET.errorcode], ebx
6011 hidnplayr 162
        jmp     tcp_close
3545 hidnplayr 163
 
164
  .no_syn_received:
7974 hidnplayr 165
        inc     [TCPS_conndrops]
3545 hidnplayr 166
 
7974 hidnplayr 167
        mov     [eax + SOCKET.errorcode], ebx
168
        jmp     tcp_close
3545 hidnplayr 169
 
170
 
5976 hidnplayr 171
;-----------------------------------------------------------------;
172
;                                                                 ;
6011 hidnplayr 173
; tcp_disconnect                                                  ;
5976 hidnplayr 174
;                                                                 ;
175
;  IN:  eax = socket ptr                                          ;
176
;                                                                 ;
177
;  OUT: eax = socket ptr / 0                                      ;
178
;                                                                 ;
179
;-----------------------------------------------------------------;
4366 hidnplayr 180
align 4
6011 hidnplayr 181
tcp_disconnect:
3545 hidnplayr 182
 
4366 hidnplayr 183
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_disconnect: %x\n", eax
3545 hidnplayr 184
 
4366 hidnplayr 185
        cmp     [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
6011 hidnplayr 186
        jb      tcp_close       ; Connection not yet synchronised, just get rid of the socket
3545 hidnplayr 187
 
4366 hidnplayr 188
; TODO: implement LINGER
3545 hidnplayr 189
 
6011 hidnplayr 190
        call    socket_is_disconnecting
191
        call    tcp_usrclosed
4366 hidnplayr 192
 
193
        test    eax, eax
194
        jz      @f
195
        push    eax
6011 hidnplayr 196
        call    tcp_output
4366 hidnplayr 197
        pop     eax
198
  @@:
199
        ret
200
 
201
 
5976 hidnplayr 202
;-----------------------------------------------------------------;
203
;                                                                 ;
6011 hidnplayr 204
; tcp_close                                                       ;
5976 hidnplayr 205
;                                                                 ;
206
;  IN:  eax = socket ptr                                          ;
207
;                                                                 ;
208
;  OUT: /                                                         ;
209
;                                                                 ;
210
;-----------------------------------------------------------------;
3545 hidnplayr 211
align 4
6011 hidnplayr 212
tcp_close:
3545 hidnplayr 213
 
3556 hidnplayr 214
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_close: %x\n", eax
3545 hidnplayr 215
 
216
;;; TODO: update RTT and mean deviation
217
;;; TODO: update slow start threshold
218
 
6011 hidnplayr 219
        call    socket_is_disconnected
220
        call    socket_free
3545 hidnplayr 221
 
6476 hidnplayr 222
        inc     [TCPS_closed]
223
 
4366 hidnplayr 224
        xor     eax, eax
3545 hidnplayr 225
        ret
226
 
227
 
228
 
5976 hidnplayr 229
;-----------------------------------------------------------------;
230
;                                                                 ;
6011 hidnplayr 231
; tcp_outflags                                                    ;
5976 hidnplayr 232
;                                                                 ;
233
;  IN:  eax = socket ptr                                          ;
234
;                                                                 ;
235
;  OUT: edx = flags                                               ;
236
;                                                                 ;
237
;-----------------------------------------------------------------;
3545 hidnplayr 238
align 4
6011 hidnplayr 239
tcp_outflags:
3545 hidnplayr 240
 
241
        mov     edx, [eax + TCP_SOCKET.t_state]
6011 hidnplayr 242
        movzx   edx, byte[edx + .flaglist]
3545 hidnplayr 243
 
3556 hidnplayr 244
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_outflags: socket=%x flags=%x\n", eax, dl
3545 hidnplayr 245
 
246
        ret
247
 
248
  .flaglist:
249
        db      TH_RST + TH_ACK         ; TCPS_CLOSED
250
        db      0                       ; TCPS_LISTEN
251
        db      TH_SYN                  ; TCPS_SYN_SENT
252
        db      TH_SYN + TH_ACK         ; TCPS_SYN_RECEIVED
253
        db               TH_ACK         ; TCPS_ESTABLISHED
254
        db               TH_ACK         ; TCPS_CLOSE_WAIT
255
        db      TH_FIN + TH_ACK         ; TCPS_FIN_WAIT_1
256
        db      TH_FIN + TH_ACK         ; TCPS_CLOSING
257
        db      TH_FIN + TH_ACK         ; TCPS_LAST_ACK
258
        db               TH_ACK         ; TCPS_FIN_WAIT_2
6476 hidnplayr 259
        db               TH_ACK         ; TCPS_TIME_WAIT
3545 hidnplayr 260
 
261
 
5976 hidnplayr 262
;-----------------------------------------------------------------;
263
;                                                                 ;
264
; TCP_respond: Fast way to send an ACK/RST/keepalive segment.     ;
265
;                                                                 ;
266
;  IN:  ebx = socket ptr                                          ;
267
;        cl = flags                                               ;
268
;                                                                 ;
269
; OUT:  /                                                         ;
270
;                                                                 ;
271
;-----------------------------------------------------------------;
3545 hidnplayr 272
align 4
6011 hidnplayr 273
tcp_respond:
3545 hidnplayr 274
 
3556 hidnplayr 275
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_respond_socket: socket=%x flags=%x\n", ebx, cl
3545 hidnplayr 276
 
277
;---------------------
278
; Create the IP packet
279
 
280
        push    cx ebx
281
        mov     edx, [ebx + IP_SOCKET.LocalIP]
5842 hidnplayr 282
        mov     edi, [ebx + IP_SOCKET.RemoteIP]
283
        mov     al, [ebx + IP_SOCKET.ttl]
284
        mov     ah, IP_PROTO_TCP
285
        mov     ecx, sizeof.TCP_header
5584 hidnplayr 286
        mov     ebx, [ebx + IP_SOCKET.device]
6011 hidnplayr 287
        call    ipv4_output
3545 hidnplayr 288
        jz      .error
289
        pop     esi cx
5522 hidnplayr 290
        push    eax
3545 hidnplayr 291
 
292
;-----------------------------------------------
293
; Fill in the TCP header by using the socket ptr
294
 
295
        mov     ax, [esi + TCP_SOCKET.LocalPort]
296
        stosw
297
        mov     ax, [esi + TCP_SOCKET.RemotePort]
298
        stosw
299
        mov     eax, [esi + TCP_SOCKET.SND_NXT]
300
        bswap   eax
301
        stosd
302
        mov     eax, [esi + TCP_SOCKET.RCV_NXT]
303
        bswap   eax
304
        stosd
305
        mov     al, 0x50        ; Dataoffset: 20 bytes (TCP_header.DataOffset)
306
        stosb
307
        mov     al, cl
308
        stosb
7098 ashmew2 309
        mov     eax, SOCKET_BUFFER_SIZE
310
        sub     eax, [esi + STREAM_SOCKET.rcv.size]
311
        cmp     eax, TCP_max_win
312
        jbe     .lessthanmax
313
        mov     eax, TCP_max_win
314
.lessthanmax:
315
        mov     cl, [esi + TCP_SOCKET.RCV_SCALE]
316
        shr     eax, cl
317
 
6913 ashmew2 318
        xchg    al, ah
3545 hidnplayr 319
        stosw                   ; window
320
        xor     eax, eax
321
        stosd                   ; checksum + urgentpointer
322
 
323
;---------------------
324
; Fill in the checksum
325
 
326
  .checksum:
327
        sub     edi, sizeof.TCP_header
328
        mov     ecx, sizeof.TCP_header
329
        xchg    esi, edi
6011 hidnplayr 330
        tcp_checksum (edi + IP_SOCKET.LocalIP), (edi + IP_SOCKET.RemoteIP)
3545 hidnplayr 331
        mov     [esi+TCP_header.Checksum], dx
332
 
333
;--------------------
334
; And send the segment
335
 
336
        call    [ebx + NET_DEVICE.transmit]
3644 hidnplayr 337
        test    eax, eax
338
        jnz     @f
6011 hidnplayr 339
        call    net_ptr_to_num4
3644 hidnplayr 340
        inc     [TCP_segments_tx + edi]
341
       @@:
3545 hidnplayr 342
        ret
343
 
344
  .error:
3556 hidnplayr 345
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_respond_socket: failed\n"
3545 hidnplayr 346
        add     esp, 2 + 4
347
 
348
        ret
349
 
350
 
5976 hidnplayr 351
;-----------------------------------------------------------------;
352
;                                                                 ;
6011 hidnplayr 353
; tcp_respond_segment                                             ;
5976 hidnplayr 354
;                                                                 ;
355
;  IN:  ebx = device ptr                                          ;
356
;       edx = segment ptr (a previously received segment)         ;
357
;       edi = ptr to IPv4 header                                  ;
358
;        cl = flags                                               ;
359
;                                                                 ;
360
;  OUT: /                                                         ;
361
;                                                                 ;
362
;-----------------------------------------------------------------;
3545 hidnplayr 363
align 4
6011 hidnplayr 364
tcp_respond_segment:
3545 hidnplayr 365
 
5842 hidnplayr 366
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_respond_segment: frame=%x flags=%x\n", edx, cl
3545 hidnplayr 367
 
368
;---------------------
369
; Create the IP packet
370
 
371
        push    cx edx
5842 hidnplayr 372
        mov     edx, [edi + IPv4_header.DestinationAddress]
373
        mov     edi, [edi + IPv4_header.SourceAddress]
3545 hidnplayr 374
        mov     ecx, sizeof.TCP_header
5842 hidnplayr 375
        mov     ax, IP_PROTO_TCP shl 8 + 128
6011 hidnplayr 376
        call    ipv4_output
3545 hidnplayr 377
        jz      .error
378
        pop     esi cx
379
 
5522 hidnplayr 380
        push    eax
3545 hidnplayr 381
 
382
;---------------------------------------------------
383
; Fill in the TCP header by using a received segment
384
 
385
        mov     ax, [esi + TCP_header.DestinationPort]
386
        stosw
387
        mov     ax, [esi + TCP_header.SourcePort]
388
        stosw
389
        mov     eax, [esi + TCP_header.AckNumber]
390
        bswap   eax
391
        stosd
392
        xor     eax, eax
393
        stosd
394
        mov     al, 0x50        ; Dataoffset: 20 bytes (sizeof.TCP_header/4 shl 4)
395
        stosb
396
        mov     al, cl
397
        stosb
398
        mov     ax, 1280
399
        rol     ax, 8
400
        stosw                   ; window
401
        xor     eax, eax
402
        stosd                   ; checksum + urgentpointer
403
 
404
;---------------------
405
; Fill in the checksum
406
 
407
        lea     esi, [edi - sizeof.TCP_header]
408
        mov     ecx, sizeof.TCP_header
6011 hidnplayr 409
        tcp_checksum (esi - sizeof.IPv4_header + IPv4_header.DestinationAddress),\      ; FIXME
3545 hidnplayr 410
                     (esi - sizeof.IPv4_header + IPv4_header.SourceAddress)
411
        mov     [esi + TCP_header.Checksum], dx
412
 
413
;--------------------
414
; And send the segment
415
 
416
        call    [ebx + NET_DEVICE.transmit]
3644 hidnplayr 417
        test    eax, eax
418
        jnz     @f
6011 hidnplayr 419
        call    net_ptr_to_num4
3644 hidnplayr 420
        inc     [TCP_segments_tx + edi]
421
       @@:
3545 hidnplayr 422
        ret
423
 
424
  .error:
3556 hidnplayr 425
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_respond_segment: failed\n"
3545 hidnplayr 426
        add     esp, 2+4
427
 
428
        ret
429
 
430
 
6011 hidnplayr 431
macro   tcpt_rangeset   timer, value, min, max {
3545 hidnplayr 432
 
433
local   .min
434
local   .max
435
local   .done
436
 
437
        cmp     value, min
438
        jb      .min
439
        cmp     value, max
440
        ja      .max
441
        mov     timer, value
442
        jmp     .done
443
  .min:
6512 hidnplayr 444
        mov     timer, min
3545 hidnplayr 445
        jmp     .done
446
  .max:
6512 hidnplayr 447
        mov     timer, max
3545 hidnplayr 448
  .done:
449
}
450
 
5976 hidnplayr 451
;-----------------------------------------------------------------;
452
;                                                                 ;
6011 hidnplayr 453
; tcp_set_persist                                                 ;
5976 hidnplayr 454
;                                                                 ;
455
;-----------------------------------------------------------------;
3545 hidnplayr 456
align 4
6011 hidnplayr 457
tcp_set_persist:
3545 hidnplayr 458
 
3556 hidnplayr 459
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_set_persist\n"
3545 hidnplayr 460
 
461
; First, check if retransmit timer is not set, retransmit and persist are mutually exclusive
462
 
3600 hidnplayr 463
        test    [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission
464
        jnz     .exit
3545 hidnplayr 465
 
466
; calculate RTO
467
        push    ebx
468
        mov     ebx, [eax + TCP_SOCKET.t_srtt]
469
        shr     ebx, 2
470
        add     ebx, [eax + TCP_SOCKET.t_rttvar]
471
        shr     ebx, 1
472
 
473
        mov     cl, [eax + TCP_SOCKET.t_rxtshift]
474
        shl     ebx, cl
475
 
476
; Start/restart persistance timer.
477
 
6011 hidnplayr 478
        tcpt_rangeset [eax + TCP_SOCKET.timer_persist], ebx, TCP_time_pers_min, TCP_time_pers_max
3600 hidnplayr 479
        or      [ebx + TCP_SOCKET.timer_flags], timer_flag_persist
3545 hidnplayr 480
        pop     ebx
481
 
482
        cmp     [eax + TCP_SOCKET.t_rxtshift], TCP_max_rxtshift
483
        jae     @f
484
        inc     [eax + TCP_SOCKET.t_rxtshift]
485
      @@:
3600 hidnplayr 486
  .exit:
3545 hidnplayr 487
 
488
        ret
489
 
490
 
491
 
5976 hidnplayr 492
;-----------------------------------------------------------------;
493
;                                                                 ;
6011 hidnplayr 494
; tcp_xmit_timer: Calculate new smoothed RTT.                     ;
5976 hidnplayr 495
;                                                                 ;
496
;   IN: eax = rtt                                                 ;
497
;       ebx = socket ptr                                          ;
498
;                                                                 ;
499
;  OUT: /                                                         ;
500
;                                                                 ;
501
;-----------------------------------------------------------------;
3545 hidnplayr 502
align 4
6011 hidnplayr 503
tcp_xmit_timer:
3545 hidnplayr 504
 
5976 hidnplayr 505
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_xmit_timer: socket=0x%x rtt=%d0ms\n", ebx, eax
3545 hidnplayr 506
 
6476 hidnplayr 507
        inc     [TCPS_rttupdated]
3545 hidnplayr 508
 
509
        cmp     [ebx + TCP_SOCKET.t_rtt], 0
510
        je      .no_rtt_yet
511
 
512
; srtt is stored as a fixed point with 3 bits after the binary point.
513
; The following magic is equivalent of the smoothing algorithm in rfc793 with an alpha of .875
514
; (srtt = rtt/8 + srtt*7/8 in fixed point)
515
; Adjust rtt to origin 0.
516
 
517
        push    ecx
518
        mov     ecx, [ebx + TCP_SOCKET.t_srtt]
519
        shr     ecx, TCP_RTT_SHIFT
520
        sub     eax, ecx
521
        dec     eax
522
        pop     ecx
523
 
524
        add     [ebx + TCP_SOCKET.t_srtt], eax
525
        ja      @f
526
        mov     [ebx + TCP_SOCKET.t_srtt], 1
527
  @@:
528
 
529
; We accumulate a smoothed rtt variance (actually, a smoothed mean difference),
530
; then set the retransmit timer to smoothed rtt + 4 times the smoothed variance.
531
; rttvar is stored as fixed point with 2 bits after the binary point.
532
; The following is equivalent to rfc793 smoothing with an alpha of .75
533
; (rttvar = rttvar*3/4 + delta/4) (delta = eax)
534
 
535
; get abs(eax)
536
        push    edx
537
        cdq
538
        xor     eax, edx
539
        sub     eax, edx
540
 
541
        mov     edx, [ebx + TCP_SOCKET.t_rttvar]
542
        shr     edx, TCP_RTTVAR_SHIFT
543
        sub     eax, edx
544
        pop     edx
545
 
546
        add     [ebx + TCP_SOCKET.t_rttvar], eax
547
        ja      @f
548
        mov     [ebx + TCP_SOCKET.t_rttvar], 1
549
  @@:
550
        ret
551
 
552
 
553
  .no_rtt_yet:
554
        push    ecx
555
        mov     ecx, eax
556
        shl     ecx, TCP_RTT_SHIFT
557
        mov     [ebx + TCP_SOCKET.t_srtt], ecx
558
 
559
        shl     eax, TCP_RTTVAR_SHIFT - 1
560
        mov     [ebx + TCP_SOCKET.t_rttvar], eax
561
        pop     ecx
562
 
563
        ret
564
 
565
 
5976 hidnplayr 566
;-----------------------------------------------------------------;
567
;                                                                 ;
6011 hidnplayr 568
; tcp_mss: Update maximum segment size                            ;
5976 hidnplayr 569
;                                                                 ;
570
;  IN:  eax = max segment size                                    ;
571
;       ebx = socket ptr                                          ;
572
;                                                                 ;
573
;  OUT: /                                                         ;
574
;                                                                 ;
575
;-----------------------------------------------------------------;
3545 hidnplayr 576
align 4
6011 hidnplayr 577
tcp_mss:
3545 hidnplayr 578
 
5976 hidnplayr 579
        cmp     eax, 1420       ; FIXME
3545 hidnplayr 580
        jbe     @f
581
        mov     eax, 1420
582
  @@:
583
        mov     [ebx + TCP_SOCKET.t_maxseg], eax
584
 
585
 
586
        ret
587
 
588
 
589
 
5976 hidnplayr 590
;-----------------------------------------------------------------;
591
;                                                                 ;
6011 hidnplayr 592
; tcp_reassemble                                                  ;
5976 hidnplayr 593
;                                                                 ;
594
;   IN: ebx = socket ptr                                          ;
595
;       edx = segment ptr                                         ;
596
;                                                                 ;
597
;  OUT: /                                                         ;
598
;                                                                 ;
599
;-----------------------------------------------------------------;
3545 hidnplayr 600
align 4
6011 hidnplayr 601
tcp_reassemble:
3545 hidnplayr 602
 
5976 hidnplayr 603
        ;;;;; TODO
3545 hidnplayr 604
 
605
        ret
606