Rev 4736 | Rev 4740 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; |
||
4 | ;; Distributed under terms of the GNU General Public License ;; |
||
5 | ;; ;; |
||
6 | ;; netstat.asm - Network Status Tool for KolibriOS ;; |
||
7 | ;; ;; |
||
8 | ;; Written by hidnplayr@kolibrios.org ;; |
||
9 | ;; ;; |
||
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
11 | ;; Version 2, June 1991 ;; |
||
12 | ;; ;; |
||
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
14 | |||
15 | format binary as "" |
||
16 | |||
17 | use32 |
||
18 | |||
19 | org 0x0 |
||
20 | |||
3601 | hidnplayr | 21 | db 'MENUET01' ; 8 byte id |
22 | dd 0x01 ; header version |
||
23 | dd START ; start of code |
||
24 | dd I_END ; size of image |
||
25 | dd (I_END+0x1000) ; memory for app |
||
26 | dd (I_END+0x1000) ; esp |
||
27 | dd 0, 0 ; I_Param , I_Path |
||
3545 | hidnplayr | 28 | |
3618 | hidnplayr | 29 | include '../../macros.inc' |
30 | include '../../network.inc' |
||
3545 | hidnplayr | 31 | |
4737 | leency | 32 | |
33 | macro DrawRectangle x, y, w, h, color |
||
4736 | leency | 34 | { |
4737 | leency | 35 | mcall 13, x shl 16 + w, y shl 16 + 1, color ; top |
36 | mcall , x shl 16 + 1, y shl 16 + h, color ; left |
||
37 | mcall , (x+w) shl 16 +1, y shl 16 + (h+1), color ; right |
||
38 | mcall , x shl 16 + w, (y+h) shl 16 + 1, color ; bottom |
||
4736 | leency | 39 | } |
40 | |||
41 | |||
3545 | hidnplayr | 42 | START: |
43 | mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK2 |
||
44 | |||
4736 | leency | 45 | window_redraw: |
3545 | hidnplayr | 46 | mcall 12, 1 |
4736 | leency | 47 | mcall 0, 100 shl 16 + 600, 100 shl 16 + 240, 0x34E1E1E1, , name ; draw window |
48 | mcall 12, 2 |
||
4737 | leency | 49 | DrawRectangle 0, 25, 400, 180, 0x777777 |
3545 | hidnplayr | 50 | |
4736 | leency | 51 | redraw: |
52 | mcall 13, 1 shl 16 + 399, 26 shl 16 + 179, 0x00F3F3F3 |
||
3545 | hidnplayr | 53 | call draw_interfaces |
54 | |||
3601 | hidnplayr | 55 | xor ebx, ebx |
56 | mov bh, [device] |
||
57 | mcall 74 |
||
58 | mov [device_type], eax |
||
59 | |||
3545 | hidnplayr | 60 | mov edx, 101 |
4736 | leency | 61 | mov esi, 0x00BBBbbb |
62 | mov edi, 0x0081BBFF |
||
3545 | hidnplayr | 63 | |
64 | cmp dl, [mode] |
||
65 | cmove esi, edi |
||
3601 | hidnplayr | 66 | mcall 8, 5 shl 16 + 55, 5 shl 16 + 20 |
3545 | hidnplayr | 67 | .morebuttons: |
68 | inc edx |
||
3601 | hidnplayr | 69 | add ebx, 60 shl 16 |
4736 | leency | 70 | mov esi, 0x00BBBbbb |
3545 | hidnplayr | 71 | |
72 | cmp dl, [mode] |
||
73 | cmove esi, edi |
||
74 | mcall |
||
75 | |||
76 | cmp edx, 105 |
||
77 | jle .morebuttons |
||
78 | |||
4736 | leency | 79 | mcall 4, 9 shl 16 + 12, 0x80000000, modes |
3545 | hidnplayr | 80 | |
81 | cmp [mode], 101 |
||
82 | jne .no_eth |
||
83 | |||
3601 | hidnplayr | 84 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 85 | add ebx, 18 |
86 | mov edx, str_packets_rx |
||
87 | mcall |
||
88 | add ebx, 18 |
||
89 | mov edx, str_bytes_tx |
||
90 | mcall |
||
91 | add ebx, 18 |
||
92 | mov edx, str_bytes_rx |
||
93 | mcall |
||
94 | add ebx, 18 |
||
3601 | hidnplayr | 95 | mov edx, str_link |
3545 | hidnplayr | 96 | mcall |
3601 | hidnplayr | 97 | |
98 | cmp [device_type], 1 |
||
99 | jne end_of_draw |
||
100 | |||
3545 | hidnplayr | 101 | add ebx, 18 |
3601 | hidnplayr | 102 | mov edx, str_MAC |
3545 | hidnplayr | 103 | mcall |
104 | |||
3601 | hidnplayr | 105 | mov ebx, API_ETH |
3545 | hidnplayr | 106 | mov bh, [device] |
107 | mcall 76 |
||
108 | push eax |
||
109 | push bx |
||
110 | |||
3601 | hidnplayr | 111 | mov edx, 135 shl 16 + 35 + 5*18 |
3545 | hidnplayr | 112 | call draw_mac |
113 | jmp end_of_draw |
||
114 | |||
115 | .no_eth: |
||
116 | |||
117 | cmp [mode], 102 |
||
118 | jne .no_ip |
||
119 | |||
3601 | hidnplayr | 120 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 121 | add ebx, 18 |
122 | mov edx, str_packets_rx |
||
123 | mcall |
||
124 | add ebx, 18 |
||
125 | mov edx, str_ip |
||
126 | mcall |
||
127 | add ebx, 18 |
||
128 | mov edx, str_dns |
||
129 | mcall |
||
130 | add ebx, 18 |
||
131 | mov edx, str_subnet |
||
132 | mcall |
||
133 | add ebx, 18 |
||
134 | mov edx, str_gateway |
||
135 | mcall |
||
136 | |||
137 | |||
138 | mov ebx, API_IPv4 + 8 |
||
139 | mov bh, [device] |
||
140 | mcall 76 |
||
141 | push eax |
||
142 | |||
143 | dec bl |
||
144 | dec bl |
||
145 | mcall 76 |
||
146 | push eax |
||
147 | |||
148 | dec bl |
||
149 | dec bl |
||
150 | mcall 76 |
||
151 | push eax |
||
152 | |||
153 | dec bl |
||
154 | dec bl |
||
155 | mcall 76 |
||
156 | push eax |
||
157 | |||
3601 | hidnplayr | 158 | mov edx, 135 shl 16 + 35 + 2*18 |
3545 | hidnplayr | 159 | call draw_ip |
160 | |||
161 | add edx, 18 |
||
162 | call draw_ip |
||
163 | |||
164 | add edx, 18 |
||
165 | call draw_ip |
||
166 | |||
167 | add edx, 18 |
||
168 | call draw_ip |
||
169 | |||
170 | jmp end_of_draw |
||
171 | |||
172 | .no_ip: |
||
173 | |||
174 | cmp [mode], 103 |
||
175 | jne .no_arp |
||
176 | |||
3601 | hidnplayr | 177 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 178 | add ebx, 18 |
179 | mov edx, str_packets_rx |
||
180 | mcall |
||
181 | add ebx, 18 |
||
182 | mov edx, str_arp |
||
183 | mcall |
||
184 | add ebx, 18 |
||
185 | mov edx, str_conflicts |
||
186 | mcall |
||
187 | |||
3601 | hidnplayr | 188 | mcall 4, 8 shl 16 + 130, 0x80000000, str_ARP_legend |
189 | |||
3545 | hidnplayr | 190 | jmp end_of_draw |
191 | |||
192 | .no_arp: |
||
193 | |||
3601 | hidnplayr | 194 | mcall 4, 8 shl 16 + 35, 0x80000000, str_packets_tx |
3545 | hidnplayr | 195 | |
196 | add ebx, 18 |
||
197 | mov edx, str_packets_rx |
||
198 | mcall |
||
199 | |||
200 | cmp [mode], 106 |
||
201 | jne end_of_draw |
||
202 | |||
203 | add ebx, 18 |
||
204 | mov edx, str_missed |
||
205 | mcall |
||
206 | |||
207 | add ebx, 18 |
||
208 | mov edx, str_dumped |
||
209 | mcall |
||
210 | |||
211 | |||
212 | |||
213 | end_of_draw: |
||
214 | |||
215 | draw_stats: |
||
216 | |||
217 | cmp [mode], 101 |
||
218 | jne not_101 |
||
219 | |||
220 | mov ebx, API_ETH |
||
221 | mov bh, [device] |
||
3601 | hidnplayr | 222 | mov bl, 6 |
3545 | hidnplayr | 223 | @@: |
224 | push ebx |
||
3601 | hidnplayr | 225 | mcall 74 |
3545 | hidnplayr | 226 | pop ebx |
227 | push eax |
||
228 | inc bl |
||