-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenspk.m
executable file
·40 lines (36 loc) · 1.02 KB
/
openspk.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function remotespk = openspk(host, type)
%
% Apre una sessione verso SPK
% RICORDARSI di chiudere la sessione con closespk
%
% type = 0 - telnet
% 1 - ssh
%
if nargin < 2
error('not enough arguments');
else
login =it.bancaditalia.speckeasy.ui.LoginForm([], 'RISC', 1);
if length(login.getPassword()) == 0 || length(login.getUsername()) == 0
error('no username or password provided, quitting');
remotespk = []
return
else
user = login.getUsername();
pass = login.getPassword();
end
end
if(type < 0 || type > 1)
error('please specify the correct transport type: 0 for ''telnet'', 1 for ''ssh''');
remotespk=[]
return
end
factory = it.bancaditalia.speckeasy.adapter.SpeakeasyAdapterFactory.getInstance();
remotespk = factory.createAdapter(type,user, pass, host);
disp('opening speakeasy...');
remotespk.openSession();
remotespk.openSpeakeasy();
if(remotespk.isSpeakeasyActive())
disp('speakeasy ready.');
else
error('speakeasy not active');
end