Rev 2607 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2607 | Rev 2614 | ||
---|---|---|---|
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: 2607 $ |
19 | $Revision: 2614 $ |
20 | 20 | ||
21 | MAX_FRAGMENTS equ 64 |
21 | MAX_FRAGMENTS = 64 |
Line 22... | Line 22... | ||
22 | MAX_IP equ MAX_NET_DEVICES |
22 | MAX_IP = MAX_NET_DEVICES |
Line 23... | Line 23... | ||
23 | IP_MAX_INTERFACES equ MAX_IP |
23 | IP_MAX_INTERFACES = MAX_IP |
24 | 24 | ||
Line 192... | Line 192... | ||
192 | ; It will also re-construct fragmented packets |
192 | ; It will also re-construct fragmented packets |
193 | ; |
193 | ; |
194 | ; IN: Pointer to buffer in [esp] |
194 | ; IN: Pointer to buffer in [esp] |
195 | ; size of buffer in [esp+4] |
195 | ; size of buffer in [esp+4] |
196 | ; pointer to device struct in ebx |
196 | ; pointer to device struct in ebx |
197 | ; pointer to IP Packet data in edx |
197 | ; pointer to IP header in edx |
- | 198 | ; size of IP packet in ecx |
|
198 | ; OUT: / |
199 | ; OUT: / |
199 | ; |
200 | ; |
200 | ;----------------------------------------------------------------- |
201 | ;----------------------------------------------------------------- |
201 | align 4 |
202 | align 4 |
202 | IPv4_input: ; TODO: implement handler for IP options |
203 | IPv4_input: ; TODO: implement handler for IP options |
Line 941... | Line 942... | ||
941 | ; |
942 | ; |
942 | ; OUT: |
943 | ; OUT: |
943 | ; |
944 | ; |
944 | ;--------------------------------------------------------------------------- |
945 | ;--------------------------------------------------------------------------- |
945 | align 4 |
946 | align 4 |
946 | IPv4_API: |
947 | IPv4_api: |
Line 947... | Line 948... | ||
947 | 948 | ||
948 | movzx eax, bh |
949 | movzx eax, bh |
Line 949... | Line 950... | ||
949 | shl eax, 2 |
950 | shl eax, 2 |
950 | 951 | ||
951 | test bl, bl |
952 | and ebx, 0xff |
952 | jz .packets_tx ; 0 |
953 | cmp ebx, .number |
- | 954 | ja .error |
|
953 | dec bl |
955 | jmp dword [.table + 4*ebx] |
954 | jz .packets_rx ; 1 |
956 | |
955 | dec bl |
957 | .table: |
956 | jz .read_ip ; 2 |
958 | dd .packets_tx ; 0 |
957 | dec bl |
- | |
958 | jz .write_ip ; 3 |
959 | dd .packets_rx ; 1 |
959 | dec bl |
- | |
960 | jz .read_dns ; 4 |
960 | dd .write_ip ; 3 |
961 | dec bl |
- | |
962 | jz .write_dns ; 5 |
961 | dd .read_dns ; 4 |
963 | dec bl |
- | |
964 | jz .read_subnet ; 6 |
962 | dd .write_dns ; 5 |
965 | dec bl |
- | |
966 | jz .write_subnet ; 7 |
963 | dd .read_subnet ; 6 |
967 | dec bl |
964 | dd .write_subnet ; 7 |
968 | jz .read_gateway ; 8 |
965 | dd .read_gateway ; 8 |
Line 969... | Line 966... | ||
969 | dec bl |
966 | dd .write_gateway ; 9 |
970 | jz .write_gateway ; 9 |
967 | .number = ($ - .table) / 4 - 1 |
971 | 968 | ||
Line 972... | Line 969... | ||
972 | .error: |
969 | .error: |
973 | mov eax, -1 |
970 | mov eax, -1 |
974 | ret |
- | |
975 | 971 | ret |
|
Line 976... | Line 972... | ||
976 | .packets_tx: |
972 | |
977 | add eax, IP_PACKETS_TX |
973 | .packets_tx: |
978 | mov eax, [eax] |
- | |
979 | ret |
974 | mov eax, [IP_PACKETS_TX + eax] |
Line 980... | Line 975... | ||
980 | 975 | ret |
|
981 | .packets_rx: |
- | |
982 | add eax, IP_PACKETS_RX |
976 | |
983 | mov eax, [eax] |
977 | .packets_rx: |
Line 984... | Line 978... | ||
984 | ret |
978 | mov eax, [IP_PACKETS_RX + eax] |
985 | - | ||
986 | .read_ip: |
979 | ret |
987 | add eax, IP_LIST |
980 | |
988 | mov eax, [eax] |
981 | .read_ip: |
Line 989... | Line 982... | ||
989 | ret |
982 | mov eax, [IP_LIST + eax] |
990 | 983 | ret |
|
991 | .write_ip: |
- | |
992 | add eax, IP_LIST |
984 | |
Line 993... | Line 985... | ||
993 | mov [eax], ecx |
985 | .write_ip: |
994 | xor eax, eax |
- | |
995 | ret |
986 | mov [IP_LIST + eax], ecx |
996 | 987 | xor eax, eax |
|
997 | .read_dns: |
988 | ret |
Line 998... | Line 989... | ||
998 | add eax, DNS_LIST |
989 | |
999 | mov eax, [eax] |
990 | .read_dns: |
1000 | ret |
- | |
1001 | 991 | mov eax, [DNS_LIST + eax] |
|
Line 1002... | Line 992... | ||
1002 | .write_dns: |
992 | ret |
1003 | add eax, DNS_LIST |
- | |
1004 | mov [eax], ecx |
993 | |
1005 | xor eax, eax |
994 | .write_dns: |
1006 | ret |
995 | mov [DNS_LIST + eax], ecx |
Line 1007... | Line 996... | ||
1007 | 996 | xor eax, eax |
|
1008 | .read_subnet: |
997 | ret |
1009 | add eax, SUBNET_LIST |
- | |
1010 | mov eax, [eax] |
998 | |
Line 1011... | Line 999... | ||
1011 | ret |
999 | .read_subnet: |
1012 | - | ||
1013 | .write_subnet: |
1000 | mov eax, [SUBNET_LIST + eax] |
1014 | add eax, SUBNET_LIST |
1001 | ret |
1015 | mov [eax], ecx |
1002 | |
1016 | xor eax, eax |
1003 | .write_subnet: |