Rev 6011 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6011 | Rev 7678 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2019. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; loopback.inc ;; |
6 | ;; loopback.inc ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; LoopBack device for KolibriOS ;; |
8 | ;; LoopBack device for KolibriOS ;; |
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 6011 $ |
17 | $Revision: 7678 $ |
18 | 18 | ||
Line 19... | Line 19... | ||
19 | iglobal |
19 | iglobal |
Line 52... | Line 52... | ||
52 | call net_add_device |
52 | call net_add_device |
Line 53... | Line 53... | ||
53 | 53 | ||
54 | cmp eax, -1 |
54 | cmp eax, -1 |
Line 55... | Line 55... | ||
55 | je .fail |
55 | je .fail |
56 | 56 | ||
57 | mov [IP_LIST], 127 + 1 shl 24 |
57 | mov [IPv4_address], 127 + 1 shl 24 |
Line 58... | Line 58... | ||
58 | mov [SUBNET_LIST], 255 |
58 | mov [IPv4_subnet], 255 |
59 | mov [BROADCAST_LIST], 0xffffff00 + 127 |
59 | mov [IPv4_broadcast], 0xffffff00 + 127 |
Line 60... | Line 60... | ||
60 | 60 | ||
61 | .fail: |
61 | .fail: |
62 | } |
62 | } |
63 | 63 | ||
64 | ;-----------------------------------------------------------------; |
64 | ;-----------------------------------------------------------------; |
65 | ; ; |
65 | ; ; |
66 | ; loop_input ; |
66 | ; loop_input ; |
67 | ; ; |
67 | ; ; |
68 | ; IN: [esp+4] = Pointer to buffer ; |
68 | ; IN: [esp+4] = Pointer to buffer ; |
69 | ; ; |
69 | ; ; |
70 | ; OUT: / ; |
70 | ; OUT: eax = 0 on success, errorcode otherwise ; |
Line 71... | Line 71... | ||
71 | ; ; |
71 | ; ; |
Line 72... | Line 72... | ||
72 | ;-----------------------------------------------------------------; |
72 | ;-----------------------------------------------------------------; |
- | 73 | align 4 |
|
73 | align 4 |
74 | loop_input: |
Line 74... | Line 75... | ||
74 | loop_input: |
75 | |
75 | 76 | mov eax, [esp+4] |
|
76 | mov eax, [esp+4] |
77 | |
- | 78 | ; Update stats |
|
- | 79 | inc [LOOPBACK_DEVICE.packets_tx] |
|
Line 77... | Line 80... | ||
77 | 80 | inc [LOOPBACK_DEVICE.packets_rx] |
|
Line 78... | Line 81... | ||
78 | ; Update stats |
81 | |
79 | inc [LOOPBACK_DEVICE.packets_rx] |
82 | mov ecx, [eax + NET_BUFF.length] |
80 | 83 | add dword[LOOPBACK_DEVICE.bytes_rx], ecx |
|
Line 81... | Line 84... | ||
81 | mov ecx, [eax + NET_BUFF.length] |
84 | adc dword[LOOPBACK_DEVICE.bytes_rx + 4], 0 |
82 | add dword[LOOPBACK_DEVICE.bytes_rx], ecx |
85 | add dword[LOOPBACK_DEVICE.bytes_tx], ecx |
83 | adc dword[LOOPBACK_DEVICE.bytes_rx + 4], 0 |
86 | adc dword[LOOPBACK_DEVICE.bytes_tx + 4], 0 |
84 | 87 | ||
Line 100... | Line 103... | ||
100 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax |
103 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", eax |
Line 101... | Line 104... | ||
101 | 104 | ||
102 | .dump: |
105 | .dump: |
103 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" |
106 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" |
- | 107 | call net_buff_free |
|
- | 108 | ||
- | 109 | or eax, -1 |
|
- | 110 | ret |
|
- | 111 | ||
- | 112 | .done: |
|
104 | call net_buff_free |
113 | xor eax, eax |
Line 105... | Line 114... | ||
105 | ret |
114 | ret |
106 | 115 | ||
Line 138... | Line 147... | ||
138 | mov [eax + NET_BUFF.device], ebx |
147 | mov [eax + NET_BUFF.device], ebx |
139 | pop ecx |
148 | pop ecx |
140 | mov [eax + NET_BUFF.length], ecx |
149 | mov [eax + NET_BUFF.length], ecx |
141 | lea edi, [eax + NET_BUFF.data] |
150 | lea edi, [eax + NET_BUFF.data] |
Line 142... | Line -... | ||
142 | - | ||
143 | inc [LOOPBACK_DEVICE.packets_tx] |
- | |
144 | add dword[LOOPBACK_DEVICE.bytes_tx], ecx |
- | |
145 | adc dword[LOOPBACK_DEVICE.bytes_tx + 4], 0 |
- | |
146 | 151 | ||
147 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output: ptr=%x size=%u\n", eax, ecx |
152 | DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output: ptr=%x size=%u\n", eax, ecx |
Line 148... | Line 153... | ||
148 | ret |
153 | ret |
149 | 154 |