Subversion Repositories Kolibri OS

Rev

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

Rev 1200 Rev 1206
Line 14... Line 14...
14
;;          GNU GENERAL PUBLIC LICENSE                             ;;
14
;;          GNU GENERAL PUBLIC LICENSE                             ;;
15
;;             Version 2, June 1991                                ;;
15
;;             Version 2, June 1991                                ;;
16
;;                                                                 ;;
16
;;                                                                 ;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 18... Line 18...
18
 
18
 
Line 19... Line 19...
19
$Revision: 922 $
19
$Revision: 1206 $
Line 20... Line 20...
20
 
20
 
Line 505... Line 505...
505
;;; TODO: create fragmented packets
505
;;; TODO: create fragmented packets
Line 506... Line 506...
506
 
506
 
507
align 4
507
align 4
Line 508... Line 508...
508
IPv4_create_packet:
508
IPv4_create_packet:
Line 509... Line 509...
509
 
509
 
510
	DEBUGF 1,"Create IPv4 Packet\n"
510
	DEBUGF 1,"Create IPv4 Packet (size=%u)\n", ecx
Line -... Line 511...
-
 
511
 
-
 
512
	cmp	ecx, 1480
511
 
513
	jg	.exit_
512
	cmp	ecx, 1514
514
 
Line 513... Line 515...
513
	jg	.exit_
515
	push	ecx eax ebx dx di
Line 514... Line 516...
514
 
516
 
515
	cmp	eax, -1
517
	cmp	eax, -1
516
	je	.broadcast		  ; If it is broadcast, just send
-
 
517
 
-
 
518
	call	ARP_IP_to_MAC
-
 
519
 
-
 
520
	cmp	eax, -1
-
 
Line 521... Line -...
521
	jne	.found
-
 
522
 
-
 
523
	DEBUGF 1,"Create IPv4 Packet - ARP entry not found!\n"
-
 
524
 
-
 
525
	; TODO: QUEUE!
518
	je	.broadcast		  ; If it is broadcast, just send
-
 
519
 
Line 526... Line 520...
526
	or	edi, -1
520
	call	ARP_IP_to_MAC
Line 527... Line 521...
527
 
521
 
528
	ret
522
	cmp	eax, -1
529
 
523
	je	.not_found
Line 530... Line -...
530
  .found:
-
 
531
	push	ax
524
 
532
	push	ebx
-
 
533
 
525
	push	ebx
534
	jmp	.send
526
	push	ax
535
 
527
 
536
  .broadcast:
528
	jmp	.send
537
	push	word -1
529
 
538
	push	dword -1
530
  .broadcast:
539
 
531
	push	word -1
540
 
-
 
541
  .send:
532
	push	dword -1
542
	push	ecx eax ebx dx di
533
 
-
 
534
  .send:
543
	call	IPv4_dest_to_dev
535
	call	IPv4_dest_to_dev
544
	inc	[IP_PACKETS_TX+4*edi]
536
	inc	[IP_PACKETS_TX+4*edi]
Line 545... Line 537...
545
	mov	edi, [ETH_DRV_LIST + 4*edi]
537
	mov	edx, [ETH_DRV_LIST + 4*edi]
546
	lea	eax, [edi + ETH_DEVICE.mac]
538
	lea	eax, [edx + ETH_DEVICE.mac]
Line 576... Line 568...
576
	pop	eax ecx
568
	pop	eax ecx
577
	add	edi, IPv4_Packet.DataOrOptional
569
	add	edi, IPv4_Packet.DataOrOptional
Line 578... Line 570...
578
 
570
 
Line 579... Line -...
579
	DEBUGF 1,"IPv4 Packet for device %x created successfully\n", edx
-
 
580
 
-
 
581
	add	esp, 6
571
	DEBUGF 1,"IPv4 Packet for device %x created successfully\n", edx
Line -... Line 572...
-
 
572
 
-
 
573
	ret
-
 
574
 
-
 
575
 
582
 
576
  .not_found:
583
	ret
577
	DEBUGF 1,"Create IPv4 Packet - ARP entry not found!\n"
584
 
578
	; TODO: QUEUE!
585
  .exit:
579
  .exit:
586
	add	esp, 16+6
580
	add	esp, 16
587
  .exit_:
581
  .exit_:
Line -... Line 582...
-
 
582
	DEBUGF 1,"Create IPv4 Packet - failed\n"
588
	DEBUGF 1,"Create IPv4 Packet - failed\n"
583
	or	edi, -1
589
	or	edi, -1
584
	ret
590
	ret
585
 
591
 
586
 
592
 
587