Subversion Repositories Kolibri OS

Rev

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

Rev 1542 Rev 2305
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: 1542 $
17
$Revision: 2305 $
-
 
18
 
18
 
19
 
19
 
20
struct	UDP_Packet
20
struct	UDP_Packet
21
 
21
	.SourcePort		dw  ?
22
	SourcePort	       dw  ?
22
	.DestinationPort	dw  ?
-
 
Line 23... Line 23...
23
	.Length 		dw  ?  ; Length of (UDP Header + Data)
23
	DestinationPort        dw  ?
Line 24... Line 24...
24
	.Checksum		dw  ?
24
	Length		       dw  ?  ; Length of (UDP Header + Data)
Line 82... Line 82...
82
 
82
 
83
; Done with header, now do data
83
; Done with header, now do data
84
	push	esi
84
	push	esi
85
	movzx	ecx, [esi+UDP_Packet.Length]
85
	movzx	ecx, [esi+UDP_Packet.Length]
86
	rol	cx , 8
86
	rol	cx , 8
87
	sub	cx , UDP_Packet.Data
87
	sub	cx , sizeof.UDP_Packet
Line 88... Line 88...
88
	add	esi, UDP_Packet.Data
88
	add	esi, sizeof.UDP_Packet
89
 
89
 
90
	call	checksum_1
90
	call	checksum_1
Line 181... Line 181...
181
	pop	ebx
181
	pop	ebx
Line 182... Line 182...
182
 
182
 
183
  .updatesock:
183
  .updatesock:
184
	inc	[UDP_PACKETS_RX]
184
	inc	[UDP_PACKETS_RX]
185
	DEBUGF	1,"Found valid UDP packet for socket %x\n", eax
185
	DEBUGF	1,"Found valid UDP packet for socket %x\n", eax
186
	lea	esi, [edx + UDP_Packet.Data]
186
	lea	esi, [edx + sizeof.UDP_Packet]
187
	movzx	ecx, [edx + UDP_Packet.Length]
187
	movzx	ecx, [edx + UDP_Packet.Length]
188
	rol	cx , 8
188
	rol	cx , 8
Line 189... Line 189...
189
	sub	cx , UDP_Packet.Data
189
	sub	cx , sizeof.UDP_Packet
Line 190... Line 190...
190
 
190
 
191
	jmp	SOCKET_input
191
	jmp	SOCKET_input
Line 245... Line 245...
245
	mov	ebx, [eax + IP_SOCKET.LocalIP]
245
	mov	ebx, [eax + IP_SOCKET.LocalIP]
246
	mov	eax, [eax + IP_SOCKET.RemoteIP]
246
	mov	eax, [eax + IP_SOCKET.RemoteIP]
Line 247... Line 247...
247
 
247
 
248
	mov	di, IP_PROTO_UDP shl 8 + 128
248
	mov	di, IP_PROTO_UDP shl 8 + 128
249
	sub	esp, 8						; Data ptr and data size will be placed here
249
	sub	esp, 8						; Data ptr and data size will be placed here
Line 250... Line 250...
250
	add	ecx, UDP_Packet.Data
250
	add	ecx, sizeof.UDP_Packet
251
 
251
 
252
;;; TODO: fragment id
252
;;; TODO: fragment id
253
	push	edx esi
253
	push	edx esi
Line 260... Line 260...
260
	mov	[edi + UDP_Packet.Length], cx
260
	mov	[edi + UDP_Packet.Length], cx
261
	rol	[edi + UDP_Packet.Length], 8
261
	rol	[edi + UDP_Packet.Length], 8
Line 262... Line 262...
262
 
262
 
263
	pop	esi
263
	pop	esi
264
	push	edi ecx
264
	push	edi ecx
265
	sub	ecx, UDP_Packet.Data
265
	sub	ecx, sizeof.UDP_Packet
266
	add	edi, UDP_Packet.Data
266
	add	edi, sizeof.UDP_Packet
267
	shr	ecx, 2
267
	shr	ecx, 2
268
	rep	movsd
268
	rep	movsd
269
	mov	ecx, [esp]
269
	mov	ecx, [esp]
270
	and	ecx, 3
270
	and	ecx, 3