Subversion Repositories Kolibri OS

Rev

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

Rev 2614 Rev 2621
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: 2614 $
19
$Revision: 2621 $
20
 
20
 
21
MAX_FRAGMENTS           = 64
21
MAX_FRAGMENTS           = 64
Line 198... Line 198...
198
;       size of IP packet in ecx
198
;       size of IP packet in ecx
199
;  OUT: /
199
;  OUT: /
200
;
200
;
201
;-----------------------------------------------------------------
201
;-----------------------------------------------------------------
202
align 4
202
align 4
203
IPv4_input:      ; TODO: implement handler for IP options
-
 
204
                 ; TODO2: add code for raw sockets
203
IPv4_input:      ; TODO: add code for raw sockets
Line 205... Line 204...
205
 
204
 
206
        DEBUGF  1,"IPv4_input, packet from: %u.%u.%u.%u ",\
205
        DEBUGF  1,"IPv4_input, packet from: %u.%u.%u.%u ",\
207
        [edx + IPv4_header.SourceAddress]:1,[edx + IPv4_header.SourceAddress + 1]:1,[edx + IPv4_header.SourceAddress + 2]:1,[edx + IPv4_header.SourceAddress + 3]:1
206
        [edx + IPv4_header.SourceAddress]:1,[edx + IPv4_header.SourceAddress + 1]:1,[edx + IPv4_header.SourceAddress + 2]:1,[edx + IPv4_header.SourceAddress + 3]:1
208
        DEBUGF  1,"to: %u.%u.%u.%u\n",\
207
        DEBUGF  1,"to: %u.%u.%u.%u\n",\
Line 212... Line 211...
212
; Check if the packet still has time to live
211
; Check if the packet still has time to live
Line 213... Line 212...
213
 
212
 
214
        cmp     byte [edx + IPv4_header.TimeToLive], 0
213
        cmp     byte [edx + IPv4_header.TimeToLive], 0
Line 215... Line -...
215
        je      .dump
-
 
216
 
-
 
217
;--------------------------------------
-
 
218
; First, check if IP packet has options
-
 
219
 
-
 
220
        movzx   eax, [edx + IPv4_header.VersionAndIHL]
-
 
221
        and     al , 0x0f                                       ; get IHL(header length)
-
 
222
        cmp     al , 0x05                                       ; IHL!= 5*4(20 bytes)
-
 
223
        jnz     .has_options
214
        je      .dump
224
 
215
 
Line 225... Line 216...
225
;-------------------------------
216
;-------------------------------
226
; Now, re-calculate the checksum
217
; Now, re-calculate the checksum
Line 528... Line 519...
528
        jmp     .dump
519
        jmp     .dump
Line 529... Line -...
529
 
-
 
530
 
-
 
531
 
-
 
532
 
-
 
533
;-----------------------------------
-
 
534
; The IP packet has some options
-
 
535
 
-
 
Line 536... Line 520...
536
  .has_options:
520
 
537
        jmp     .dump
521
 
538
 
522
 
539
 
523
 
Line 947... Line 931...
947
IPv4_api:
931
IPv4_api:
Line 948... Line 932...
948
 
932
 
949
        movzx   eax, bh
933
        movzx   eax, bh
Line 950... Line 934...
950
        shl     eax, 2
934
        shl     eax, 2
951
 
935
 
952
        and     ebx, 0xff
936
        and     ebx, 0x000000ff
953
        cmp     ebx, .number
937
        cmp     ebx, .number
Line 954... Line 938...
954
        ja      .error
938
        ja      .error
955
        jmp     dword [.table + 4*ebx]
939
        jmp     dword [.table + 4*ebx]
956
 
940
 
-
 
941
  .table:
957
  .table:
942
        dd      .packets_tx     ; 0
958
        dd      .packets_tx     ; 0
943
        dd      .packets_rx     ; 1
959
        dd      .packets_rx     ; 1
944
        dd      .read_ip        ; 2
960
        dd      .write_ip       ; 3
945
        dd      .write_ip       ; 3
961
        dd      .read_dns       ; 4
946
        dd      .read_dns       ; 4