Subversion Repositories Kolibri OS

Rev

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

Rev 5522 Rev 5584
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: 5522 $
19
$Revision: 5584 $
20
 
20
 
Line 21... Line 21...
21
IPv4_MAX_FRAGMENTS              = 64
21
IPv4_MAX_FRAGMENTS              = 64
Line 567... Line 567...
567
;------------------------------------------------------------------
567
;------------------------------------------------------------------
568
;
568
;
569
; IPv4_output
569
; IPv4_output
570
;
570
;
571
; IN:   eax = Destination IP
571
; IN:   eax = Destination IP
-
 
572
;       ebx = device ptr (or 0 to let IP layer decide)
572
;       ecx = data length
573
;       ecx = data length
573
;       edx = Source IP
574
;       edx = Source IP
574
;        di = TTL shl 8 + protocol
575
;        di = TTL shl 8 + protocol
575
;
576
;
576
; OUT:  eax = pointer to buffer start / 0 on error
577
; OUT:  eax = pointer to buffer start / 0 on error
Line 861... Line 862...
861
;---------------------------------------------------------------------------
862
;---------------------------------------------------------------------------
862
;
863
;
863
; IPv4_route
864
; IPv4_route
864
;
865
;
865
; IN:   eax = Destination IP
866
; IN:   eax = Destination IP
-
 
867
;       ebx = outgoing device / 0
866
;       edx = Source IP
868
;       edx = Source IP
867
; OUT:  eax = Destination IP (or gateway IP)
869
; OUT:  eax = Destination IP (or gateway IP)
868
;       edx = Source IP
870
;       edx = Source IP
869
;       edi = device number*4
871
;       edi = device number*4
870
; DESTROYED:
872
; DESTROYED:
Line 872... Line 874...
872
;
874
;
873
;---------------------------------------------------------------------------
875
;---------------------------------------------------------------------------
874
align 4
876
align 4
875
IPv4_route:     ; TODO: return error if no valid route found
877
IPv4_route:     ; TODO: return error if no valid route found
Line -... Line 878...
-
 
878
 
-
 
879
        test    ebx, ebx
-
 
880
        jnz     .got_device
876
 
881
 
877
        cmp     eax, 0xffffffff
882
        cmp     eax, 0xffffffff
Line 878... Line 883...
878
        je      .broadcast
883
        je      .broadcast
879
 
884
 
Line 901... Line 906...
901
        mov     edx, [IP_LIST + edi]
906
        mov     edx, [IP_LIST + edi]
902
  @@:
907
  @@:
Line 903... Line 908...
903
 
908
 
Line -... Line 909...
-
 
909
        ret
-
 
910
 
-
 
911
  .got_device:
-
 
912
; Validate device ptr and convert to device number
-
 
913
        call    NET_ptr_to_num4
-
 
914
        cmp     edi, -1
-
 
915
        je      .fail
-
 
916
 
-
 
917
        mov     edx, [IP_LIST + edi]            ; Source IP
-
 
918
 
-
 
919
; Check if we should route to gateway or not
-
 
920
        mov     ebx, [IP_LIST + edi]
-
 
921
        and     ebx, [SUBNET_LIST + edi]
-
 
922
        mov     ecx, eax
-
 
923
        and     ecx, [SUBNET_LIST + edi]
-
 
924
        je      @f
-
 
925
        mov     eax, [GATEWAY_LIST + edi]
-
 
926
  @@:
-
 
927
        ret
-
 
928
 
-
 
929
  .fail:
Line 904... Line 930...
904
        ret
930
        ret
905
 
931
 
906
 
932