Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | ; |
2 | ; ARPmanager for KolibriOS |
||
3 | ; |
||
4 | ; hidnplayr@gmail.com |
||
5 | ; |
||
6 | |||
7 | format binary as "" |
||
8 | |||
9 | use32 |
||
10 | |||
11 | org 0x0 |
||
12 | |||
13 | db 'MENUET01' ; 8 byte id |
||
14 | dd 0x01 ; header version |
||
15 | dd START ; start of code |
||
16 | dd IM_END ; size of image |
||
17 | dd (I_END+0x100) ; memory for app |
||
18 | dd (I_END+0x100) ; esp |
||
19 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
20 | |||
21 | include '../macros.inc' |
||
22 | purge mov, add, sub |
||
23 | include '../struct.inc' |
||
24 | include '../network.inc' |
||
25 | |||
26 | START: |
||
27 | |||
28 | redraw: |
||
29 | |||
30 | mcall 12, 1 |
||
31 | mcall 0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc, , str_name |
||
32 | mcall 4, 25 shl 16 + 31, 0x80000000, str_legend |
||
33 | mcall 12, 2 |
||
34 | |||
35 | draw_stats: |
||
36 | |||
37 | mov edx, 50 shl 16 + 50 |
||
38 | mov [last], 0 |
||
39 | |||
40 | .loop: |
||
41 | mcall 76, API_ARP + 3, [last],,, arp_buf |
||
42 | cmp eax, -1 |
||
43 | je mainloop |
||
44 | |||
45 | mcall 4, edx, 0x80000000, str_entry |
||
46 | mov edx, ebx |
||
47 | |||
48 | mov eax, 47 |
||
49 | mov ebx, 0x00030000 |
||
50 | mov esi, 0x40000000 |
||
51 | mov edi, 0x00bcbcbc |
||
52 | xor ecx, ecx |
||
53 | |||
54 | mov cl, byte[arp_buf.IP+0] |
||
55 | mcall |
||
56 | |||
57 | mov cl, byte[arp_buf.IP+1] |
||
58 | add edx, 24 shl 16 |
||
59 | mcall |
||
60 | |||
61 | mov cl, byte[arp_buf.IP+2] |
||
62 | add edx, 24 shl 16 |
||
63 | mcall |
||
64 | |||
65 | mov cl, byte[arp_buf.IP+3] |
||
66 | add edx, 24 shl 16 |
||
67 | mcall |
||
68 | |||
69 | |||
70 | mov ebx, 0x00020100 |
||
71 | mov cl, byte[arp_buf.MAC+0] |
||
72 | add edx, 36 shl 16 |
||
73 | mcall |
||
74 | |||
75 | mov cl, byte[arp_buf.MAC+1] |
||
76 | add edx, 18 shl 16 |
||
77 | mcall |
||
78 | |||
79 | mov cl, byte[arp_buf.MAC+2] |
||
80 | add edx, 18 shl 16 |
||
81 | mcall |
||
82 | |||
83 | mov cl, byte[arp_buf.MAC+3] |
||
84 | add edx, 18 shl 16 |
||
85 | mcall |
||
86 | |||
87 | mov cl, byte[arp_buf.MAC+4] |
||
88 | add edx, 18 shl 16 |
||
89 | mcall |
||
90 | |||
91 | mov cl, byte[arp_buf.MAC+5] |
||
92 | add edx, 18 shl 16 |
||
93 | mcall |
||
94 | |||
95 | mov ebx, 0x00040000 |
||
96 | mov cx, [arp_buf.status] |
||
97 | add edx, 30 shl 16 |
||
98 | mcall |
||
99 | |||
100 | mov cx, [arp_buf.TTL] |
||
101 | add edx, 60 shl 16 |
||
102 | mcall |
||
103 | |||
104 | add dx, 20 |
||
105 | rol edx, 16 |
||
106 | mov dx, 50 |
||
107 | rol edx, 16 |
||
108 | inc [last] |
||
109 | |||
110 | jmp .loop |
||
111 | |||
112 | |||
113 | mainloop: |
||
114 | |||
115 | mcall 23,50 ; wait for event with timeout (0,5 s) |
||
116 | |||
117 | cmp eax, 1 |
||
118 | je redraw |
||
119 | cmp eax, 2 |
||
120 | je key |
||
121 | cmp eax, 3 |
||
122 | je button |
||
123 | |||
124 | jmp draw_stats |
||
125 | |||
126 | |||
127 | key: |
||
128 | mcall 2 |
||
129 | jmp mainloop |
||
130 | |||
131 | |||
132 | button: ; button |
||
133 | mcall 17 ; get id |
||
134 | cmp ah, 1 |
||
135 | je exit |
||
136 | jmp redraw |
||
137 | |||
138 | exit: |
||
139 | mcall -1 |
||
140 | |||
141 | |||
142 | |||
143 | ; DATA AREA |
||
144 | |||
145 | str_name db 'ARP manager', 0 |
||
146 | str_legend db '# IP-address MAC-address Status TTL', 0 |
||
147 | str_entry db ' . . . - - - - - s', 0 |
||
148 | |||
149 | IM_END: |
||
150 | |||
151 | last dd ? |
||
152 | arp_buf ARP_entry |
||
153 | |||
154 | I_END: |
||
155 |