Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1763 hidnplayr 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2362 hidnplayr 3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved.    ;;
1763 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
 
17
$Revision: 2629 $
18
 
1733 hidnplayr 19
;-----------------------------------------------------------------
20
;
21
; TCP_output
22
;
23
; IN:  eax = socket pointer
24
;
25
; OUT: /
26
;
27
;-----------------------------------------------------------------
28
align 4
29
TCP_output:
30
 
2402 hidnplayr 31
        DEBUGF 1,"TCP_output, socket: %x\n", eax
1733 hidnplayr 32
 
33
 
34
; We'll detect the length of the data to be transmitted, and flags to be used
35
; If there is some data, or any critical controls to send (SYN / RST), then transmit
36
; Otherwise, investigate further
37
 
2402 hidnplayr 38
        mov     ebx, [eax + TCP_SOCKET.SND_MAX]
39
        cmp     ebx, [eax + TCP_SOCKET.SND_UNA]
40
        jne     .not_idle
1733 hidnplayr 41
 
2402 hidnplayr 42
        mov     ebx, [eax + TCP_SOCKET.t_idle]
43
        cmp     ebx, [eax + TCP_SOCKET.t_rxtcur]
44
        jbe     .not_idle
1733 hidnplayr 45
 
46
; We have been idle for a while and no ACKS are expected to clock out any data we send..
47
; Slow start to get ack "clock" running again.
48
 
2402 hidnplayr 49
        mov     ebx, [eax + TCP_SOCKET.t_maxseg]
50
        mov     [eax + TCP_SOCKET.SND_CWND], ebx
1733 hidnplayr 51
 
52
  .not_idle:
53
  .again:
2402 hidnplayr 54
        mov     ebx, [eax + TCP_SOCKET.SND_NXT]         ; calculate offset (71)
55
        sub     ebx, [eax + TCP_SOCKET.SND_UNA]         ;
1733 hidnplayr 56
 
2402 hidnplayr 57
        mov     ecx, [eax + TCP_SOCKET.SND_WND]         ; determine window
58
        cmp     ecx, [eax + TCP_SOCKET.SND_CWND]        ;
59
        jb      @f                                      ;
60
        mov     ecx, [eax + TCP_SOCKET.SND_CWND]        ;
61
       @@:                                              ;
1733 hidnplayr 62
 
2402 hidnplayr 63
        call    TCP_outflags                            ; flags in dl
1733 hidnplayr 64
 
1761 hidnplayr 65
;------------------------
66
; data being forced out ?
67
 
1733 hidnplayr 68
; If in persist timeout with window of 0, send 1 byte.
69
; Otherwise, if window is small but nonzero, and timer expired,
70
; we will send what we can and go to transmit state
71
 
2402 hidnplayr 72
        test    [eax + TCP_SOCKET.t_force], -1
73
        jz      .no_force
1733 hidnplayr 74
 
2402 hidnplayr 75
        test    ecx, ecx
76
        jnz     .no_zero_window
1733 hidnplayr 77
 
2402 hidnplayr 78
        cmp     ebx, [eax + STREAM_SOCKET.snd.size]
79
        jae     @f
1733 hidnplayr 80
 
2402 hidnplayr 81
        and     dl, not (TH_FIN)          ; clear the FIN flag    ??? how can it be set before?
1733 hidnplayr 82
 
83
       @@:
2402 hidnplayr 84
        inc     ecx
85
        jmp     .no_force
1733 hidnplayr 86
 
87
  .no_zero_window:
2402 hidnplayr 88
        mov     [eax + TCP_SOCKET.timer_persist], 0
89
        mov     [eax + TCP_SOCKET.t_rxtshift], 0
1733 hidnplayr 90
 
1761 hidnplayr 91
  .no_force:
1733 hidnplayr 92
 
1761 hidnplayr 93
;--------------------------------
94
; Calculate how much data to send (106)
1733 hidnplayr 95
 
2402 hidnplayr 96
        mov     esi, [eax + STREAM_SOCKET.snd.size]
97
        cmp     esi, ecx
98
        jb      @f
99
        mov     esi, ecx
1733 hidnplayr 100
       @@:
2402 hidnplayr 101
        sub     esi, ebx
1733 hidnplayr 102
 
2612 hidnplayr 103
 
1761 hidnplayr 104
;------------------------
105
; check for window shrink (107)
1733 hidnplayr 106
 
1761 hidnplayr 107
; If FIN has been set, but not ACKed, but we havent been called to retransmit, esi will be -1
1733 hidnplayr 108
; Otherwise, window shrank after we sent into it.
109
 
2612 hidnplayr 110
        jae     .not_persist
1761 hidnplayr 111
 
112
; enter persist state
2402 hidnplayr 113
        xor     esi, esi
1733 hidnplayr 114
 
1761 hidnplayr 115
; If window shrank to 0
2402 hidnplayr 116
        test    ecx, ecx
117
        jnz     @f
1733 hidnplayr 118
 
1761 hidnplayr 119
; cancel pending retransmit
2402 hidnplayr 120
        mov     [eax + TCP_SOCKET.timer_retransmission], 0
1733 hidnplayr 121
 
1761 hidnplayr 122
; pull SND_NXT back to (closed) window, We will enter persist state below.
2402 hidnplayr 123
        push    [eax + TCP_SOCKET.SND_UNA]
124
        pop     [eax + TCP_SOCKET.SND_NXT]
1761 hidnplayr 125
 
1733 hidnplayr 126
       @@:
127
 
1761 hidnplayr 128
; If window didn't close completely, just wait for an ACK
1733 hidnplayr 129
 
2612 hidnplayr 130
  .not_persist:
1733 hidnplayr 131
 
1761 hidnplayr 132
;---------------------------
133
; Send one segment at a time (124)
134
 
2402 hidnplayr 135
        cmp     esi, [eax + TCP_SOCKET.t_maxseg]
136
        jbe     @f
1733 hidnplayr 137
 
2402 hidnplayr 138
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
1733 hidnplayr 139
 
1761 hidnplayr 140
;;; sendalot = 1
141
 
1733 hidnplayr 142
       @@:
143
 
1761 hidnplayr 144
;--------------------------------------------
145
; Turn of FIN flag if send buffer not emptied (128)
1733 hidnplayr 146
 
2402 hidnplayr 147
        mov     edi, [eax + TCP_SOCKET.SND_NXT]
148
        add     edi, esi
149
        sub     edi, [eax + TCP_SOCKET.SND_UNA]
150
        sub     edi, [eax + STREAM_SOCKET.snd.size]
151
        jns     @f
1761 hidnplayr 152
 
2402 hidnplayr 153
        and     dl, not (TH_FIN)
1733 hidnplayr 154
 
155
       @@:
156
 
1761 hidnplayr 157
;-------------------------------
158
; calculate window advertisement (130)
1733 hidnplayr 159
 
2402 hidnplayr 160
        mov     ecx, SOCKET_MAXDATA
161
        sub     ecx, [eax + STREAM_SOCKET.rcv.size]
1733 hidnplayr 162
 
163
;------------------------------
1761 hidnplayr 164
; Sender silly window avoidance (131)
1733 hidnplayr 165
 
2402 hidnplayr 166
        test    esi, esi
167
        jz      .len_zero
1761 hidnplayr 168
 
2402 hidnplayr 169
        cmp     esi, [eax + TCP_SOCKET.t_maxseg]
170
        je      .send
1733 hidnplayr 171
 
2402 hidnplayr 172
        test    [eax + TCP_SOCKET.t_flags], TF_NODELAY
173
        jnz     @f
174
        ; TODO: if not 'idle', skip to next codeblock
2362 hidnplayr 175
       @@:
2402 hidnplayr 176
        add     ebx, esi
177
        cmp     ebx, [eax + STREAM_SOCKET.snd.size]
178
        jae     .send
1733 hidnplayr 179
 
2402 hidnplayr 180
        test    [eax + TCP_SOCKET.t_force], -1  ;;;
181
        jnz     .send
1733 hidnplayr 182
 
2402 hidnplayr 183
        mov     ebx, [eax + TCP_SOCKET.max_sndwnd]
184
        shr     ebx, 1
185
        cmp     esi, ebx
186
        jae     .send
1733 hidnplayr 187
 
2402 hidnplayr 188
        mov     ebx, [eax + TCP_SOCKET.SND_NXT]
189
        cmp     ebx, [eax + TCP_SOCKET.SND_MAX]
190
        jb      .send
1733 hidnplayr 191
 
1761 hidnplayr 192
  .len_zero:
193
 
1733 hidnplayr 194
;----------------------------------------
1761 hidnplayr 195
; Check if a window update should be sent (154)
1733 hidnplayr 196
 
2402 hidnplayr 197
        test    ecx, ecx
198
        jz      .no_window
1733 hidnplayr 199
 
2402 hidnplayr 200
        push    ecx
201
        mov     cl, [eax + TCP_SOCKET.RCV_SCALE]
202
        inc     cl                                      ; we want it *2
203
        mov     ebx, TCP_max_win
204
        shl     ebx, cl
205
        pop     ecx
206
        cmp     ebx, ecx
207
        cmovb   ebx, ecx
1733 hidnplayr 208
 
2402 hidnplayr 209
        ; now ebx is TWICE the amount we can increase the window
210
        ; (with TCP_max_win shl rcv_scale as the maximum)
2362 hidnplayr 211
 
2402 hidnplayr 212
        cmp     ebx, [eax + TCP_SOCKET.t_maxseg]
213
        jae     .send
2362 hidnplayr 214
 
215
  ;;;      cmp     ebx, [eax + ]                        ;;; TODO: check receive buffer high water mark
216
    ;;;    jae     .send
217
 
1733 hidnplayr 218
  .no_window:
219
 
220
;--------------------------
1761 hidnplayr 221
; Should a segment be sent? (174)
1733 hidnplayr 222
 
2402 hidnplayr 223
        test    [eax + TCP_SOCKET.t_flags], TF_ACKNOW   ; we need to ACK
224
        jnz     .send
1733 hidnplayr 225
 
2402 hidnplayr 226
        test    dl, TH_SYN + TH_RST                     ; we need to send a SYN or RST
227
        jnz     .send
1733 hidnplayr 228
 
2402 hidnplayr 229
        mov     ebx, [eax + TCP_SOCKET.SND_UP]          ; when urgent pointer is beyond start of send bufer
230
        cmp     ebx, [eax + TCP_SOCKET.SND_UNA]
231
        ja      .send
1733 hidnplayr 232
 
2402 hidnplayr 233
        test    dl, TH_FIN
234
        jz      .enter_persist  ; no reason to send, enter persist state
1733 hidnplayr 235
 
1761 hidnplayr 236
; FIN was set, only send if not already sent, or on retransmit
237
 
2402 hidnplayr 238
        test    [eax + TCP_SOCKET.t_flags], TF_SENTFIN
239
        jnz     .send
1733 hidnplayr 240
 
2402 hidnplayr 241
        mov     ebx, [eax + TCP_SOCKET.SND_NXT]
242
        cmp     ebx, [eax + TCP_SOCKET.SND_UNA]
243
        je      .send
1733 hidnplayr 244
 
245
;--------------------
1761 hidnplayr 246
; Enter persist state (191)
1733 hidnplayr 247
 
248
  .enter_persist:
249
 
2402 hidnplayr 250
        cmp     [eax + STREAM_SOCKET.snd.size], 0       ; Data ready to send?
251
        jne     @f
252
        cmp     [eax + TCP_SOCKET.timer_retransmission], 0
253
        jne     @f
254
        cmp     [eax + TCP_SOCKET.timer_persist], 0     ; Persist timer already expired?
255
        jne     @f
2362 hidnplayr 256
 
2402 hidnplayr 257
        DEBUGF  1,"Entering persist state\n"
1733 hidnplayr 258
 
2402 hidnplayr 259
        mov     [eax + TCP_SOCKET.t_rxtshift], 0
260
        TCP_set_persist eax
2362 hidnplayr 261
       @@:
1733 hidnplayr 262
 
1761 hidnplayr 263
;----------------------------
264
; No reason to send a segment (219)
265
 
2402 hidnplayr 266
        DEBUGF  1,"No reason to send a segment\n"
1733 hidnplayr 267
 
2402 hidnplayr 268
        pusha
269
        lea     ecx, [eax + SOCKET.mutex]
270
        call    mutex_unlock
271
        popa
1733 hidnplayr 272
 
2402 hidnplayr 273
        ret
1733 hidnplayr 274
 
275
 
1761 hidnplayr 276
 
277
 
278
 
279
 
280
 
281
 
282
 
1733 hidnplayr 283
;-----------------------------------------------
284
;
1761 hidnplayr 285
; Send a segment (222)
1733 hidnplayr 286
;
287
; eax = socket pointer
1761 hidnplayr 288
; esi = data len
1733 hidnplayr 289
;  dl = flags
290
;
291
;-----------------------------------------------
292
 
293
  .send:
294
 
2612 hidnplayr 295
        DEBUGF  1,"Preparing to send a segment socket: %x length: %u flags: %x\n", eax, esi, dl
1733 hidnplayr 296
 
2402 hidnplayr 297
        mov     edi, sizeof.TCP_header  ; edi will contain headersize
1733 hidnplayr 298
 
2402 hidnplayr 299
        sub     esp, 8                  ; create some space on stack
300
        push    eax                     ; save socket pointer
1733 hidnplayr 301
 
302
;------------------------------------
303
; Send options with first SYN segment
304
 
2402 hidnplayr 305
        test    dl, TH_SYN
306
        jz      .options_done
1733 hidnplayr 307
 
2402 hidnplayr 308
        push    [eax + TCP_SOCKET.ISS]
309
        pop     [eax + TCP_SOCKET.SND_NXT]
1733 hidnplayr 310
 
2402 hidnplayr 311
        test    [eax + TCP_SOCKET.t_flags], TF_NOOPT
312
        jnz     .options_done
1733 hidnplayr 313
 
2402 hidnplayr 314
        mov     ecx, 1460                              ;;;; FIXME
315
        or      ecx, TCP_OPT_MAXSEG shl 24 + 4 shl 16
316
        bswap   ecx
317
        push    ecx
318
        add     di, 4
1733 hidnplayr 319
 
2402 hidnplayr 320
        test    [eax + TCP_SOCKET.t_flags], TF_REQ_SCALE
321
        jz      .no_syn
1733 hidnplayr 322
 
2402 hidnplayr 323
        test    dl, TH_ACK
324
        jnz     .scale_opt
1733 hidnplayr 325
 
2402 hidnplayr 326
        test    [eax + TCP_SOCKET.t_flags], TF_RCVD_SCALE
327
        jz      .no_syn
1733 hidnplayr 328
 
329
  .scale_opt:
2402 hidnplayr 330
        movzx   ecx, byte [eax + TCP_SOCKET.request_r_scale]
331
        or      ecx, TCP_OPT_WINDOW shl 24 + 4 shl 16 + TCP_OPT_NOP shl 8
332
        bswap   ecx
333
        pushd   ecx
334
        add     di, 4
1733 hidnplayr 335
 
336
  .no_syn:
337
 
338
;------------------------------------
339
; Make the timestamp option if needed
340
 
2402 hidnplayr 341
        test    [eax + TCP_SOCKET.t_flags], TF_REQ_TSTMP
342
        jz      .no_timestamp
1733 hidnplayr 343
 
2402 hidnplayr 344
        test    dl, TH_RST
345
        jnz     .no_timestamp
1733 hidnplayr 346
 
2402 hidnplayr 347
        test    dl, TH_ACK
348
        jz      .timestamp
1733 hidnplayr 349
 
2402 hidnplayr 350
        test    [eax + TCP_SOCKET.t_flags], TF_RCVD_TSTMP
351
        jz      .no_timestamp
1733 hidnplayr 352
 
353
  .timestamp:
2402 hidnplayr 354
        mov     ebx, [timer_ticks]
355
        bswap   ebx
356
        push    ebx
357
        pushw   0
358
        pushd   TCP_OPT_TIMESTAMP + 10 shl 8 + TCP_OPT_NOP shl 16 + TCP_OPT_NOP shl 24
359
        add     di, 10
1733 hidnplayr 360
 
361
  .no_timestamp:
362
 
2402 hidnplayr 363
        ; 
1733 hidnplayr 364
 
365
 
1761 hidnplayr 366
 
367
 
368
 
369
 
370
 
371
 
372
  .options_done:
373
 
374
; eax = socket ptr
375
; edx = flags
376
; edi = header size
377
; esi = data len
378
 
379
;---------------------------------------------
380
; check if we dont exceed the max segment size (270)
381
 
2402 hidnplayr 382
        add     esi, edi                        ; total TCP segment size
383
        cmp     esi, [eax + TCP_SOCKET.t_maxseg]
384
        jbe     .no_overflow
1761 hidnplayr 385
 
2402 hidnplayr 386
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
1761 hidnplayr 387
 
388
;;; sendalot = 1
389
 
390
  .no_overflow:
391
 
392
;-----------------------------------------------------------------
1733 hidnplayr 393
; Start by pushing all TCP header values in reverse order on stack
1761 hidnplayr 394
; (essentially, creating the tcp header on the stack!)
1733 hidnplayr 395
 
2402 hidnplayr 396
        pushw   0       ;        .UrgentPointer          dw ?
397
        pushw   0       ;        .Checksum               dw ?
398
        pushw   0x00a0  ;        .Window                 dw ?    ;;;;;;; FIXME
399
        shl     edi, 2  ;        .DataOffset             db ?  only 4 left-most bits
400
        shl     dx, 8
401
        or      dx, di  ;        .Flags                  db ?
402
        pushw   dx
403
        shr     edi, 2  ;        .DataOffset             db ? ;;;;
1733 hidnplayr 404
 
2402 hidnplayr 405
        push    [eax + TCP_SOCKET.RCV_NXT]      ;        .AckNumber              dd ?
406
        ntohd   [esp]
1733 hidnplayr 407
 
2402 hidnplayr 408
        push    [eax + TCP_SOCKET.SND_NXT]      ;        .SequenceNumber         dd ?
409
        ntohd   [esp]
1733 hidnplayr 410
 
2402 hidnplayr 411
        push    [eax + TCP_SOCKET.RemotePort]   ;        .DestinationPort        dw ?
412
        ntohw   [esp]
1733 hidnplayr 413
 
2402 hidnplayr 414
        push    [eax + TCP_SOCKET.LocalPort]    ;        .SourcePort             dw ?
415
        ntohw   [esp]
1733 hidnplayr 416
 
2402 hidnplayr 417
        push    edi             ; header size
1733 hidnplayr 418
 
1761 hidnplayr 419
;---------------------
1733 hidnplayr 420
; Create the IP packet
1761 hidnplayr 421
 
2402 hidnplayr 422
        mov     ecx, esi
1761 hidnplayr 423
 
2402 hidnplayr 424
        mov     ebx, [eax + IP_SOCKET.LocalIP]  ; source ip
425
        mov     eax, [eax + IP_SOCKET.RemoteIP] ; dest ip
426
        mov     di, IP_PROTO_TCP shl 8 + 128
427
        call    IPv4_output
2555 hidnplayr 428
        jz      .ip_error
1733 hidnplayr 429
 
430
;-----------------------------------------
431
; Move TCP header from stack to TCP packet
432
 
2402 hidnplayr 433
        push    ecx
434
        mov     ecx, [esp+4]
435
        lea     esi, [esp+4+4]
436
        shr     ecx, 2
437
        rep     movsd
438
        pop     ecx             ; full TCP packet size
1733 hidnplayr 439
 
2402 hidnplayr 440
        pop     esi             ; headersize
441
        add     esp, esi
1733 hidnplayr 442
 
2402 hidnplayr 443
        mov     [esp + 4], eax          ; packet ptr
444
        mov     [esp + 4+4], edx        ; packet size
1733 hidnplayr 445
 
2402 hidnplayr 446
        mov     edx, edi                ; begin of data
447
        sub     edx, esi                ; begin of packet (edi = begin of data)
448
        push    ecx
449
        sub     ecx, esi                ; data size
1733 hidnplayr 450
 
451
;--------------
452
; Copy the data
453
 
454
; eax = ptr to ring struct
455
; ecx = buffer size
456
; edi = ptr to buffer
457
 
2402 hidnplayr 458
        mov     eax, [esp+4]                    ; get socket ptr
1761 hidnplayr 459
 
2402 hidnplayr 460
        add     [eax + TCP_SOCKET.SND_NXT], ecx ; update sequence number
1761 hidnplayr 461
 
2402 hidnplayr 462
        add     eax, STREAM_SOCKET.snd
463
        push    edx
464
        call    SOCKET_ring_read
465
        pop     esi                             ; begin of data
466
        pop     ecx                             ; full packet size
467
        pop     eax                             ; socket ptr
1733 hidnplayr 468
 
1761 hidnplayr 469
;----------------------------------
470
; update sequence number and timers  (400)
471
 
2402 hidnplayr 472
        test    [esi + TCP_header.Flags], TH_SYN + TH_FIN
473
        jz      @f
474
        inc     [eax + TCP_SOCKET.SND_NXT]      ; syn and fin take a sequence number
475
        test    [esi + TCP_header.Flags], TH_FIN
476
        jz      @f
477
        or      [eax + TCP_SOCKET.t_flags], TF_SENTFIN  ; if we sent a fin, set the sentfin flag
1733 hidnplayr 478
       @@:
479
 
2402 hidnplayr 480
        mov     edx, [eax + TCP_SOCKET.SND_NXT]
481
        cmp     edx, [eax + TCP_SOCKET.SND_MAX]
482
        jbe     @f
483
        mov     [eax + TCP_SOCKET.SND_MAX], edx
1733 hidnplayr 484
 
2402 hidnplayr 485
        ;;;; TODO: time transmission (420)
1761 hidnplayr 486
 
1733 hidnplayr 487
       @@:
488
 
1761 hidnplayr 489
; set retransmission timer if not already set, and not doing an ACK or keepalive probe
1733 hidnplayr 490
 
2402 hidnplayr 491
        cmp     [eax + TCP_SOCKET.timer_retransmission], 1000 ;;;; FIXME
492
        jb      .retransmit_set
1761 hidnplayr 493
 
2402 hidnplayr 494
        cmp     edx, [eax + TCP_SOCKET.SND_UNA]         ; edx = [eax + TCP_SOCKET.SND_NXT]
495
        je      .retransmit_set
1761 hidnplayr 496
 
2402 hidnplayr 497
        mov     edx, [eax + TCP_SOCKET.t_rxtcur]
498
        mov     [eax + TCP_SOCKET.timer_retransmission], dx
1761 hidnplayr 499
 
2402 hidnplayr 500
        cmp     [eax + TCP_SOCKET.timer_persist], 0
501
        jne     @f
502
        mov     [eax + TCP_SOCKET.timer_persist], 0
503
        mov     [eax + TCP_SOCKET.t_rxtshift], 0
2362 hidnplayr 504
       @@:
1761 hidnplayr 505
 
506
  .retransmit_set:
507
 
1733 hidnplayr 508
;--------------------
509
; Create the checksum
510
 
2402 hidnplayr 511
        DEBUGF  1,"checksum: ptr=%x size=%u\n", esi, ecx
1733 hidnplayr 512
 
2402 hidnplayr 513
        TCP_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP)
514
        mov     [esi + TCP_header.Checksum], dx
1733 hidnplayr 515
 
1761 hidnplayr 516
; unlock socket
517
 
2402 hidnplayr 518
        pusha
519
        lea     ecx, [eax + SOCKET.mutex]
520
        call    mutex_unlock
521
        popa
1761 hidnplayr 522
 
1733 hidnplayr 523
;----------------
524
; Send the packet
525
 
2402 hidnplayr 526
        DEBUGF  1,"Sending TCP Packet to device %x\n", ebx
527
        call    [ebx + NET_DEVICE.transmit]
528
        ret
1733 hidnplayr 529
 
530
 
2555 hidnplayr 531
  .ip_error:
2402 hidnplayr 532
        pop     ecx
533
        add     esp, ecx
534
        pop     eax
535
        add     esp, 8
1733 hidnplayr 536
 
2629 hidnplayr 537
        mov     [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min
538
 
2402 hidnplayr 539
        pusha
540
        lea     ecx, [eax + SOCKET.mutex]
541
        call    mutex_unlock
542
        popa
1733 hidnplayr 543
 
2555 hidnplayr 544
        DEBUGF 1,"TCP_output: IP error\n"
2402 hidnplayr 545
        ret
546