Rev 3545 | Rev 3704 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3545 | Rev 3618 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2010-2013. 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 | ;; Synergyc.asm - Synergy client for KolibriOS ;; |
6 | ;; Synergyc.asm - Synergy client for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
8 | ;; Written by hidnplayr@kolibrios.org ;; |
Line 12... | Line 12... | ||
12 | ;; ;; |
12 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 14... | Line 14... | ||
14 | 14 | ||
Line -... | Line 15... | ||
- | 15 | format binary as "" |
|
- | 16 | ||
- | 17 | BUFFERSIZE = 1024 |
|
15 | format binary as "" |
18 | DEFAULTPORT = 24800 |
16 | 19 | ||
Line 17... | Line 20... | ||
17 | use32 |
20 | use32 |
18 | org 0x0 |
21 | org 0x0 |
Line 24... | Line 27... | ||
24 | dd mem+0x1000 ; required memory |
27 | dd mem+0x1000 ; required memory |
25 | dd mem+0x1000 ; stack pointer |
28 | dd mem+0x1000 ; stack pointer |
26 | dd 0 ; parameters |
29 | dd 0 ; parameters |
27 | dd path ; path |
30 | dd path ; path |
Line 28... | Line -... | ||
28 | - | ||
29 | __DEBUG__ equ 1 ; enable/disable |
- | |
30 | __DEBUG_LEVEL__ equ 1 ; 1 = all, 2 = errors |
- | |
31 | - | ||
32 | - | ||
33 | BUFFERSIZE equ 1024 |
- | |
34 | DEFAULTPORT equ 24800 |
- | |
35 | 31 | ||
36 | include '../macros.inc' |
32 | include '../../macros.inc' |
37 | purge mov,add,sub |
33 | purge mov,add,sub |
38 | include '../proc32.inc' |
34 | include '../../proc32.inc' |
Line 39... | Line 35... | ||
39 | include '../dll.inc' |
35 | include '../../dll.inc' |
Line 40... | Line 36... | ||
40 | 36 | ||
Line 41... | Line 37... | ||
41 | include '../network.inc' |
37 | include '../../network.inc' |
42 | 38 | ||
Line 66... | Line 62... | ||
66 | push 80 |
62 | push 80 |
67 | push 25 |
63 | push 25 |
68 | push 80 |
64 | push 80 |
69 | call [con_init] |
65 | call [con_init] |
Line 70... | Line 66... | ||
70 | 66 | ||
71 | push path |
- | |
72 | call [con_write_asciiz] |
- | |
73 | - | ||
74 | push newline |
- | |
75 | call [con_write_asciiz] |
- | |
76 | - | ||
77 | push newline |
67 | push str0 |
Line 78... | Line 68... | ||
78 | call [con_write_asciiz] |
68 | call [con_write_asciiz] |
79 | 69 | ||
80 | invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 |
70 | invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 |
Line 95... | Line 85... | ||
95 | call [con_write_asciiz] |
85 | call [con_write_asciiz] |
Line 96... | Line 86... | ||
96 | 86 | ||
97 | mcall socket, AF_INET4, SOCK_STREAM, 0 |
87 | mcall socket, AF_INET4, SOCK_STREAM, 0 |
98 | cmp eax, -1 |
88 | cmp eax, -1 |
99 | je error |
- | |
100 | 89 | je error |
|
Line -... | Line 90... | ||
- | 90 | mov [socketnum], eax |
|
- | 91 | ||
- | 92 | ; resolve name |
|
- | 93 | push esp ; reserve stack place |
|
- | 94 | push esp ; ptr to result |
|
101 | mov [socketnum], eax |
95 | push 0 ; addrinfo hints |
102 | 96 | push 0 ; servname |
|
- | 97 | push buffer_ptr ; hostname |
|
- | 98 | call [getaddrinfo] |
|
103 | push buffer_ptr ; hostname |
99 | pop esi |
104 | call [inet_addr] |
100 | ; test for error |
- | 101 | test eax, eax |
|
- | 102 | jnz error |
|
- | 103 | ||
105 | cmp eax, -1 |
104 | mov eax, [esi+addrinfo.ai_addr] |
Line 106... | Line 105... | ||
106 | je error |
105 | mov eax, [eax+sockaddr_in.sin_addr] |
Line 107... | Line 106... | ||
107 | mov [sockaddr1.ip], eax |
106 | mov [sockaddr1.ip], eax |
108 | 107 | ||
Line 109... | Line 108... | ||
109 | mcall connect, [socketnum], sockaddr1, 18 |
108 | mcall connect, [socketnum], sockaddr1, 18 |
Line 110... | Line 109... | ||
110 | 109 | ||
111 | push str7 |
110 | push str7 |
Line 112... | Line 111... | ||
112 | call [con_write_asciiz] |
111 | call [con_write_asciiz] |
Line 271... | Line 270... | ||
271 | 270 | ||
272 | error: |
271 | error: |
273 | push str_err |
272 | push str_err |
Line 274... | Line 273... | ||
274 | call [con_write_asciiz] |
273 | call [con_write_asciiz] |
Line 275... | Line -... | ||
275 | - | ||
276 | call [con_gets] |
274 | |
Line 277... | Line 275... | ||
277 | 275 | ; call [con_gets] |
|
- | 276 | ||
- | 277 | call [con_getch2] |
|
- | 278 | ||
278 | push 1 |
279 | mcall close, [socketnum] |
Line 279... | Line 280... | ||
279 | call [con_exit] |
280 | |
Line 290... | Line 291... | ||
290 | mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
291 | mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
291 | cmp eax, -1 |
292 | cmp eax, -1 |
292 | je wait_for_data |
293 | je wait_for_data |
Line 293... | Line 294... | ||
293 | 294 | ||
294 | cmp eax, 8 |
295 | cmp eax, 8 |
Line 295... | Line 296... | ||
295 | jl wait_for_data |
296 | jb wait_for_data ; FIXME |
Line 296... | Line 297... | ||
296 | 297 | ||
297 | ret |
298 | ret |
- | 299 | ||
298 | 300 | ||
299 | 301 | ||
300 | 302 | ; data |
|
301 | ; data |
303 | title db 'Synergy client',0 |
302 | title db 'Synergy client',0 |
304 | str0 db 'Welcome to the software KM switch for KolibriOS.',10,10,0 |
303 | str1 db 'Connecting to: ',0 |
305 | str1 db 'Connecting to: ',0 |
304 | str7 db 'Connected!',13,10,0 |
306 | str7 db 'Connected!',10,0 |
305 | str2 db 13,10,'Handshake received',13,10,0 |
307 | str2 db 10,'Handshake received',10,0 |
306 | str3 db 'Unsupported command: ',0 |
308 | str3 db 'Unsupported command: ',0 |
Line 307... | Line 309... | ||
307 | newline db 13,10,0 |
309 | newline db 10,0 |
308 | str4 db 'mouse moved',13,10,0 |
310 | str4 db 'mouse moved',10,0 |
309 | str5 db 'mouse buttons changed',13,10,0 |
311 | str5 db 'mouse buttons changed',10,0 |
310 | str6 db 'Enter screen',13,10,0 |
312 | str6 db 'Enter screen',10,0 |
Line 358... | Line 360... | ||
358 | library console, 'console.obj',\ |
360 | library console, 'console.obj',\ |
359 | network, 'network.obj',\ |
361 | network, 'network.obj',\ |
360 | libini, 'libini.obj' |
362 | libini, 'libini.obj' |
Line 361... | Line 363... | ||
361 | 363 | ||
362 | import network,\ |
364 | import network,\ |
Line 363... | Line 365... | ||
363 | inet_addr, 'inet_addr' |
365 | getaddrinfo, 'getaddrinfo' |
364 | 366 | ||
365 | import console, \ |
367 | import console, \ |
366 | con_start, 'START',\ |
368 | con_start, 'START',\ |