Rev 4052 | Rev 4366 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4052 | Rev 4347 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | ; |
24 | ; |
25 | ; OUT: / |
25 | ; OUT: / |
26 | ; |
26 | ; |
27 | ;----------------------------------------------------------------- |
27 | ;----------------------------------------------------------------- |
28 | align 4 |
28 | align 4 |
29 | TCP_output: |
29 | proc TCP_output |
- | 30 | ||
- | 31 | locals |
|
- | 32 | temp_bits db ? |
|
- | 33 | endl |
|
Line 30... | Line 34... | ||
30 | 34 | ||
Line 31... | Line 35... | ||
31 | DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: socket=%x\n", eax |
35 | DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: socket=%x\n", eax |
32 | 36 | ||
Line 55... | Line 59... | ||
55 | mov ebx, [eax + TCP_SOCKET.t_maxseg] |
59 | mov ebx, [eax + TCP_SOCKET.t_maxseg] |
56 | mov [eax + TCP_SOCKET.SND_CWND], ebx |
60 | mov [eax + TCP_SOCKET.SND_CWND], ebx |
Line 57... | Line 61... | ||
57 | 61 | ||
58 | .not_idle: |
62 | .not_idle: |
59 | .again: |
63 | .again: |
Line 60... | Line 64... | ||
60 | mov [eax + TCP_SOCKET.temp_bits], 0 |
64 | mov [temp_bits], 0 |
61 | 65 | ||
Line 62... | Line 66... | ||
62 | mov ebx, [eax + TCP_SOCKET.SND_NXT] ; calculate offset (71) |
66 | mov ebx, [eax + TCP_SOCKET.SND_NXT] ; calculate offset (71) |
Line 143... | Line 147... | ||
143 | 147 | ||
144 | cmp esi, [eax + TCP_SOCKET.t_maxseg] |
148 | cmp esi, [eax + TCP_SOCKET.t_maxseg] |
Line 145... | Line 149... | ||
145 | jbe @f |
149 | jbe @f |
146 | 150 | ||
147 | mov esi, [eax + TCP_SOCKET.t_maxseg] |
151 | mov esi, [eax + TCP_SOCKET.t_maxseg] |
Line 148... | Line 152... | ||
148 | or [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT |
152 | or [temp_bits], TCP_BIT_SENDALOT |
149 | @@: |
153 | @@: |
Line 404... | Line 408... | ||
404 | add esi, edi ; total TCP segment size |
408 | add esi, edi ; total TCP segment size |
405 | cmp esi, [eax + TCP_SOCKET.t_maxseg] |
409 | cmp esi, [eax + TCP_SOCKET.t_maxseg] |
406 | jbe .no_overflow |
410 | jbe .no_overflow |
Line 407... | Line 411... | ||
407 | 411 | ||
408 | mov esi, [eax + TCP_SOCKET.t_maxseg] |
412 | mov esi, [eax + TCP_SOCKET.t_maxseg] |
409 | or [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT |
413 | or [temp_bits], TCP_BIT_SENDALOT |
Line -... | Line 414... | ||
- | 414 | .no_overflow: |
|
- | 415 | ||
- | 416 | ;---------------------------------------------------- |
|
- | 417 | ; Calculate the receive window. |
|
- | 418 | ; Dont shrink window, but avoid silly window syndrome |
|
- | 419 | ||
- | 420 | mov ebx, SOCKET_MAXDATA |
|
- | 421 | sub ebx, [eax + STREAM_SOCKET.rcv.size] |
|
- | 422 | ||
- | 423 | cmp ebx, SOCKET_MAXDATA/4 |
|
- | 424 | jae @f |
|
- | 425 | cmp ebx, [eax + TCP_SOCKET.t_maxseg] |
|
- | 426 | jae @f |
|
- | 427 | xor ebx, ebx |
|
- | 428 | @@: |
|
- | 429 | ||
- | 430 | cmp ebx, TCP_max_win |
|
- | 431 | jbe @f |
|
- | 432 | mov ebx, TCP_max_win |
|
- | 433 | @@: |
|
- | 434 | ||
- | 435 | mov ecx, [eax + TCP_SOCKET.RCV_ADV] |
|
- | 436 | sub ecx, [eax + TCP_SOCKET.RCV_NXT] |
|
- | 437 | cmp ebx, ecx |
|
- | 438 | ja @f |
|
- | 439 | mov ebx, ecx |
|
- | 440 | @@: |
|
- | 441 | ||
- | 442 | DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: window = %u\n", ebx |
|
- | 443 | ||
- | 444 | mov cl, [eax + TCP_SOCKET.RCV_SCALE] |
|
- | 445 | shr ebx, cl |
|
410 | .no_overflow: |
446 | xchg bl, bh |
411 | 447 | ||
412 | ;----------------------------------------------------------------- |
448 | ;----------------------------------------------------------------- |
Line 413... | Line 449... | ||
413 | ; Start by pushing all TCP header values in reverse order on stack |
449 | ; Start by pushing all TCP header values in reverse order on stack |
414 | ; (essentially, creating the tcp header on the stack!) |
450 | ; (essentially, creating the tcp header on the stack!) |
415 | 451 | ||
416 | pushw 0 ; .UrgentPointer dw ? |
452 | pushw 0 ; .UrgentPointer dw ? |
417 | pushw 0 ; .Checksum dw ? |
453 | pushw 0 ; .Checksum dw ? |
418 | pushw 0x00a0 ; .Window dw ? ;;;;;;; FIXME (370) |
454 | pushw bx ; .Window dw ? |
419 | shl edi, 2 ; .DataOffset db ? only 4 left-most bits |
455 | shl edi, 2 ; .DataOffset db ? only 4 left-most bits |
420 | shl dx, 8 |
456 | shl dx, 8 |
Line 564... | Line 600... | ||
564 | 600 | ||
565 | ; update last ack sent |
601 | ; update last ack sent |
566 | push [eax + TCP_SOCKET.RCV_NXT] |
602 | push [eax + TCP_SOCKET.RCV_NXT] |
Line 567... | Line 603... | ||
567 | pop [eax + TCP_SOCKET.last_ack_sent] |
603 | pop [eax + TCP_SOCKET.last_ack_sent] |
568 | 604 | ||
Line 569... | Line 605... | ||
569 | ; and flags |
605 | ; clear the ACK flags |
570 | and [eax + TCP_SOCKET.t_flags], not (TF_ACKNOW + TF_DELACK) |
606 | and [eax + TCP_SOCKET.t_flags], not (TF_ACKNOW + TF_DELACK) |
Line 580... | Line 616... | ||
580 | pop eax |
616 | pop eax |
Line 581... | Line 617... | ||
581 | 617 | ||
582 | ;----------------------------- |
618 | ;----------------------------- |
Line 583... | Line 619... | ||
583 | ; Check if we need more output |
619 | ; Check if we need more output |
584 | 620 | ||
Line 585... | Line 621... | ||
585 | test [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT |
621 | test [temp_bits], TCP_BIT_SENDALOT |
Line 586... | Line 622... | ||
586 | jnz TCP_output.again |
622 | jnz TCP_output.again |
Line 620... | Line 656... | ||
620 | 656 | ||
621 | or eax, -2 |
657 | or eax, -2 |
Line 622... | Line -... | ||
622 | ret><><<> |
- | |
623 | - | ||
624 | - | ||
625 | 658 | ret |
|
626 | 659 |