Subversion Repositories Kolibri OS

Rev

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

Rev 2621 Rev 2731
Line 19... Line 19...
19
;;          GNU GENERAL PUBLIC LICENSE                             ;;
19
;;          GNU GENERAL PUBLIC LICENSE                             ;;
20
;;             Version 2, June 1991                                ;;
20
;;             Version 2, June 1991                                ;;
21
;;                                                                 ;;
21
;;                                                                 ;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 23... Line 23...
23
 
23
 
Line 24... Line 24...
24
$Revision: 2621 $
24
$Revision: 2731 $
25
 
25
 
Line 26... Line 26...
26
__DEBUG_LEVEL_OLD__     equ __DEBUG_LEVEL__     ; use seperate debug level for network part of kernel
26
__DEBUG_LEVEL_OLD__     equ __DEBUG_LEVEL__     ; use seperate debug level for network part of kernel
Line 37... Line 37...
37
MAX_EPHEMERAL_PORT     = 61000
37
MAX_EPHEMERAL_PORT      = 61000
Line 38... Line 38...
38
 
38
 
39
; Ethernet protocol numbers
39
; Ethernet protocol numbers
40
ETHER_ARP              = 0x0608
40
ETHER_ARP               = 0x0608
-
 
41
ETHER_IPv4              = 0x0008
41
ETHER_IPv4             = 0x0008
42
ETHER_IPv6              = 0xDD86
42
ETHER_PPP_DISCOVERY    = 0x6388
43
ETHER_PPP_DISCOVERY     = 0x6388
Line 43... Line 44...
43
ETHER_PPP_SESSION      = 0x6488
44
ETHER_PPP_SESSION       = 0x6488
44
 
45
 
Line 101... Line 102...
101
ECONNREFUSED           = 61
102
ECONNREFUSED            = 61
102
ECONNRESET             = 52
103
ECONNRESET              = 52
103
ETIMEDOUT              = 60
104
ETIMEDOUT               = 60
104
ECONNABORTED           = 53
105
ECONNABORTED            = 53
Line -... Line 106...
-
 
106
 
-
 
107
; Api protocol numbers
-
 
108
API_ETH                 = 0
-
 
109
API_IPv4                = 1
-
 
110
API_ICMP                = 2
-
 
111
API_UDP                 = 3
105
 
-
 
-
 
112
API_TCP                 = 4
-
 
113
API_ARP                 = 5
Line 106... Line 114...
106
 
114
API_PPPOE               = 6
Line 107... Line 115...
107
 
115
 
108
struct  NET_DEVICE
116
struct  NET_DEVICE
Line 157... Line 165...
157
 
165
 
Line 158... Line 166...
158
;include "PPPoE.inc"
166
;include "PPPoE.inc"
159
 
167
 
-
 
168
include "ARP.inc"
Line 160... Line 169...
160
include "ARP.inc"
169
include "IPv4.inc"
161
include "IPv4.inc"
170
;include "IPv6.inc"
162
 
171
 
Line 195... Line 204...
195
        xor     eax, eax
204
        xor     eax, eax
196
        mov     edi, NET_RUNNING
205
        mov     edi, NET_RUNNING
197
        mov     ecx, (MAX_NET_DEVICES + 2)
206
        mov     ecx, (MAX_NET_DEVICES + 2)
198
        rep     stosd
207
        rep     stosd
Line 199... Line -...
199
 
-
 
200
;        SLIP_init
208
 
Line 201... Line 209...
201
;        PPPOE_init
209
;        PPPOE_init
-
 
210
 
202
 
211
        IPv4_init
Line 203... Line 212...
203
        IPv4_init
212
;        IPv6_init
204
        ICMP_init
213
        ICMP_init
205
 
214
 
Line 659... Line 668...
659
        ret
668
        ret
Line 660... Line 669...
660
 
669
 
661
 
670
 
662
;----------------------------------------------------------------
671
;----------------------------------------------------------------
663
;
672
;
664
;  System function to work with protocols  (75)
673
;  System function to work with protocols  (76)
665
;
674
;
666
;----------------------------------------------------------------
675
;----------------------------------------------------------------
667
align 4
676
align 4
Line 678... Line 687...
678
        push    .return                         ; return address (we will be using jumps instead of calls)
687
        push    .return                         ; return address (we will be using jumps instead of calls)
Line 679... Line 688...
679
 
688
 
680
        mov     eax, ebx                        ; set ax to protocol number
689
        mov     eax, ebx                        ; set ax to protocol number
Line -... Line 690...
-
 
690
        shr     eax, 16                         ;
-
 
691
 
-
 
692
        cmp     ax, API_ETH
681
        shr     eax, 16                         ;
693
        je      ETH_api
682
 
694
 
Line 683... Line 695...
683
        cmp     ax, IP_PROTO_IP
695
        cmp     ax, API_IPv4
684
        je      IPv4_api
696
        je      IPv4_api
Line 685... Line 697...
685
 
697
 
686
        cmp     ax, IP_PROTO_ICMP
698
        cmp     ax, API_ICMP
Line 687... Line 699...
687
        je      ICMP_api
699
        je      ICMP_api
688
 
700
 
Line 689... Line 701...
689
        cmp     ax, IP_PROTO_UDP
701
        cmp     ax, API_UDP
690
        je      UDP_api
702
        je      UDP_api
Line 691... Line -...
691
 
-
 
692
        cmp     ax, IP_PROTO_TCP
-
 
693
        je      TCP_api
-
 
694
 
703
 
695
        cmp     ax, ETHER_ARP
704
        cmp     ax, API_TCP
Line 696... Line 705...
696
        je      ARP_api
705
        je      TCP_api
Line 697... Line 706...
697
 
706