Subversion Repositories Kolibri OS

Rev

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

Rev 1263 Rev 1274
Line 11... Line 11...
11
;;          GNU GENERAL PUBLIC LICENSE                             ;;
11
;;          GNU GENERAL PUBLIC LICENSE                             ;;
12
;;             Version 2, June 1991                                ;;
12
;;             Version 2, June 1991                                ;;
13
;;                                                                 ;;
13
;;                                                                 ;;
14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 15... Line 15...
15
 
15
 
Line 16... Line 16...
16
$Revision: 1263 $
16
$Revision: 1274 $
17
 
17
 
18
struct	SOCKET_head
18
struct	SOCKET_head
19
	 .PrevPtr		dd ? ; pointer to previous socket in list
19
	 .PrevPtr		dd ? ; pointer to previous socket in list
Line 46... Line 46...
46
	 .backlog_cur		dw ? ; current size of queue for un-accept-ed connections
46
	 .backlog_cur		dw ? ; current size of queue for un-accept-ed connections
47
	 .last_ack_number	dd ? ; used only to let application know that ACK has been received
47
	 .last_ack_number	dd ? ; used only to let application know that ACK has been received
48
					; todo: may be use SND_UNA instead
48
					; todo: may be use SND_UNA instead
49
					; todo: may be use events which allow additional information instead
49
					; todo: may be use events which allow additional information instead
50
					; todo: may be count acknowledged bytes (at least it has obvious sense)
50
					; todo: may be count acknowledged bytes (at least it has obvious sense)
51
;         .OrigRemoteIP          dd ? ; original remote IP address (used to reset to LISTEN state)
51
	 .OrigRemoteIP		dd ? ; original remote IP address (used to reset to LISTEN state)
52
;         .OrigRemotePort        dw ? ; original remote port (used to reset to LISTEN state)
52
	 .OrigRemotePort	dw ? ; original remote port (used to reset to LISTEN state)
53
	 .wndsizeTimer		dd ? ; window size timer
53
	 .wndsizeTimer		dd ? ; window size timer
Line 54... Line 54...
54
 
54
 
55
	; Transmission control block
55
	; Transmission control block
56
	 .state 		dd ? ; TCB state
56
	 .state 		dd ? ; TCB state
Line 92... Line 92...
92
 
92
 
Line 93... Line 93...
93
	.end:
93
	.end:
Line -... Line 94...
-
 
94
 
-
 
95
ends
-
 
96
 
-
 
97
struct	socket_queue_entry
-
 
98
	.data_ptr	dd ?
-
 
99
	.data_size	dd ?
-
 
100
	.offset 	dd ?
94
 
101
	.size:
95
ends
102
ends
96
 
103
 
97
MAX_backlog		equ 20	     ; backlog for stream sockets
104
MAX_backlog		equ 20	     ; backlog for stream sockets
Line 361... Line 368...
361
 
368
 
362
	mov	[eax + SOCKET_head.end + IPv4_SOCKET.end + TCP_SOCKET.state], TCB_SYN_SENT
369
	mov	[eax + SOCKET_head.end + IPv4_SOCKET.end + TCP_SOCKET.state], TCB_SYN_SENT
Line 363... Line 370...
363
	; now say hello to the remote tcp socket
370
	; now say hello to the remote tcp socket
-
 
371
 
364
 
372
	mov	bl, TH_SYN
Line 365... Line 373...
365
	mov	bl, TH_SYN
373
	xor	ecx, ecx
366
	call	TCP_send_ack
374
	call	TCP_send
Line 511... Line 519...
511
	je	.destroy_tcb
519
	je	.destroy_tcb
Line 512... Line 520...
512
 
520
 
Line 513... Line 521...
513
	; Now construct the response, and queue for sending by IP
521
	; Now construct the response, and queue for sending by IP
-
 
522
 
514
 
523
	mov	bl, TH_FIN
Line 515... Line 524...
515
	mov	bl, TH_FIN
524
	xor	ecx, ecx
516
	call	TCP_send_ack
525
	call	TCP_send
517
 
526
 
Line 561... Line 570...
561
;-----------------------------------------------------------------
570
;-----------------------------------------------------------------
562
align 4
571
align 4
563
socket_recv:
572
socket_recv:
Line 564... Line 573...
564
 
573
 
565
	DEBUGF	1,"Socket_receive: socknum: %u bufferaddress: %x, length: %u, flags: %x\n",ecx,edx,esi,edi
-
 
566
 
574
	DEBUGF	1,"Socket_receive: socknum: %u bufferaddress: %x, length: %u, flags: %x\n",ecx,edx,esi,edi
567
	stdcall net_socket_num_to_addr, ecx		   ; get real socket address
575
	stdcall net_socket_num_to_addr, ecx		   ; get real socket address
568
	or	eax, eax
576
	or	eax, eax
Line 569... Line 577...
569
	jz	s_error
577
	jz	s_error
Line 594... Line 602...
594
	jnc	.nb
602
	jnc	.nb
595
	movsb
603
	movsb
596
.nb:	shr	ecx, 1
604
.nb:	shr	ecx, 1
597
	jnc	.nw
605
	jnc	.nw
598
	movsw
606
	movsw
-
 
607
.nw:	test	ecx, ecx
-
 
608
	jz	.nd
599
.nw:	rep	movsd
609
	rep	movsd
-
 
610
.nd:
Line 600... Line 611...
600
 
611
 
Line 601... Line 612...
601
	call	kernel_free
612
	call	kernel_free
Line 683... Line 694...
683
 
694
 
Line 684... Line 695...
684
     @@:
695
     @@:
685
 
696
 
-
 
697
	mov	ecx, esi
Line 686... Line 698...
686
	mov	ecx, esi
698
	mov	esi, edx
Line 687... Line 699...
687
	mov	esi, edx
699
	xor	bl , bl
688
 
700
 
Line 689... Line 701...
689
	call	TCP_socket_send
701
	call	TCP_send