rubyslippers 0.97 → 0.98
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +206 -299
- data/code/01rwdcore/03helptexthash.rb +4 -1
- data/code/01rwdcore/openhelpwindow.rb +6 -1
- data/code/superant.com.rubyslippers/gemcommands.rb +1 -1
- data/code/superant.com.rubyslippers/helptexthashrubyslippers.rb +43 -5
- data/code/superant.com.rubyslippers/listgemrecord.rb +1 -1
- data/code/superant.com.rubyslippers/listinstalledgemsfiles.rb +13 -0
- data/code/superant.com.rubyslippers/openhelpwindowrubyslippers.rb +19 -2
- data/code/superant.com.rubyslippers/returntomain.rb +10 -0
- data/code/superant.com.rubyslippers/runrubyslippersmenu1.rb +57 -0
- data/code/superant.com.rubyslippers/viewgemdata.rb +1 -1
- data/code/superant.com.rubyslippersbackwindow/listgemdir.rb +19 -0
- data/code/superant.com.rubyslippersbackwindow/listgemdirectories.rb +4 -1
- data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +100 -0
- data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +8 -8
- data/code/superant.com.rwdtinkerbackwindow/network.rb +87 -0
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +1 -1
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -0
- data/configuration/rubyslippers.cnf +2 -2
- data/configuration/rubyslippersversion.cnf +1 -1
- data/configuration/rwdapplicationidentity.cnf +3 -0
- data/configuration/rwdtinker.cnf +1 -0
- data/configuration/rwdtinkerversion.cnf +1 -1
- data/ev/rwd.rb +4 -3
- data/gui/frontwindow0/superant.com.rubyslippers/{80gemcommands.rwd → 25gemcommands.rwd} +13 -1
- data/gui/frontwindow0/superant.com.rubyslippers/30viewgemdata.rwd +2 -2
- data/gui/frontwindow0/superant.com.rubyslippers/m01menubegin.rwd +10 -0
- data/gui/frontwindow0/superant.com.rubyslippers/m02menu.rwd +60 -0
- data/gui/frontwindow0/superant.com.rubyslippers/m03menu.rwd +12 -0
- data/gui/frontwindow0/superant.com.rubyslippers/m85menu.rwd +21 -0
- data/gui/frontwindow0/superant.com.rubyslippers/m88menu.rwd +12 -0
- data/gui/frontwindow0/superant.com.rubyslippers/m99menuend.rwd +3 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/3viewgemspec.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/5editgemspecrecord.rwd +18 -18
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/6buildgem.rwd +1 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/7viewgemdir.rwd +26 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/{7gemcommands.rwd → 8gemcommands.rwd} +2 -1
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/92viewconfiguration.rwd +31 -9
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m01menubegin.rwd +10 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m02menu.rwd +60 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m03menu.rwd +12 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m85menu.rwd +21 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m88menu.rwd +12 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/m99menuend.rwd +3 -0
- data/gui/tinkerbackwindows/superant.com.rubyslippersbackwindow/{98returntab.rwd → v9returntab.rwd} +1 -1
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/{50rwdlistzips.rwd → 40rwdlistzips.rwd} +9 -2
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +10 -9
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/75rwdcontrol.rwd +33 -0
- data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +2 -2
- data/init.rb +38 -2
- data/installed/rwdtinkerwin2-0.5.inf +8 -0
- data/installed/rwdviewlogo-0.4.inf +4 -0
- data/rwd_files/HowTo_RubySlippers.txt +12 -1
- data/rwd_files/HowTo_Tinker.txt +37 -0
- data/rwd_files/remotegemlist.txt +43 -27
- data/zips/rwdcalc-0.4.zip +0 -0
- metadata +81 -58
- data/code/dd0viewphoto/dd0viewphoto.rb +0 -4
- data/gui/frontwindow0/superant.com.rubyslippers/92viewconfiguration.rwd +0 -38
@@ -44,5 +44,8 @@ Then you should be able to login at: http://yourhostname:8080",
|
|
44
44
|
|
45
45
|
|
46
46
|
when you click on a document name, the document should pop up in a
|
47
|
-
browser window, or in another browser tab."
|
47
|
+
browser window, or in another browser tab.",
|
48
|
+
:remote_control => "Remote control gives you a way to determine what applications are running on which ports
|
49
|
+
|
50
|
+
The name of the application is set in the config file"
|
48
51
|
|
@@ -24,10 +24,15 @@ end
|
|
24
24
|
$help_topic = "applet_tinkerbackeditconfiguration"
|
25
25
|
$helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
|
26
26
|
end
|
27
|
-
|
27
|
+
if @rwd_tab == "rwdremotecontrol"
|
28
|
+
$help_topic = "remote_control"
|
29
|
+
$helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing", "remote_control"]
|
30
|
+
end
|
31
|
+
|
28
32
|
$previouswindow = @rwd_window
|
29
33
|
$previoustab = @rwd_tab
|
30
34
|
end
|
35
|
+
|
31
36
|
if @rwd_window == "rwdtinkerhelpwindow"
|
32
37
|
$helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
|
33
38
|
end
|
@@ -15,5 +15,5 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
def showgemcommandoptions
|
18
|
-
@gemcommandoptions = ["help","--version","list --local","check -a","check --test"," "].rwd_options
|
18
|
+
@gemcommandoptions = ["help","--version","list --local","check -a","check --test","search","search --remote","specification","uninstall"," "].rwd_options
|
19
19
|
end
|
@@ -20,11 +20,23 @@
|
|
20
20
|
Click on Show Environment
|
21
21
|
This will show your setup
|
22
22
|
|
23
|
-
You can run a Gem command or a shell command
|
23
|
+
You can run a Gem command or a shell command
|
24
|
+
|
25
|
+
Click on the 'Show Gem Command Choices' this will bringup the command that will be added to 'gem'
|
26
|
+
you can choose the blank choice or:
|
27
|
+
help,--version,list --local,check -a,check --test,search,search --remote,specification,uninstall
|
28
|
+
|
24
29
|
Enter the command in the box and press the
|
25
30
|
Run Command button
|
26
31
|
|
27
|
-
It displays the result of the command on the screen.
|
32
|
+
It displays the result of the command on the screen.
|
33
|
+
|
34
|
+
Click 'List Installed Gem Files' to bring up a list at the bottom of the page.
|
35
|
+
You can click on one to fill in the second command box. You will probably need to remove the version on the end
|
36
|
+
of the file name for the gem command to properly work.
|
37
|
+
the commands that can take a file name are: list --local,check --test,search,search --remote,specification,uninstall
|
38
|
+
|
39
|
+
",
|
28
40
|
:gemfiles_help => "You can view the files that are installed for applications
|
29
41
|
|
30
42
|
Click on Show Gem Dirs
|
@@ -36,8 +48,34 @@
|
|
36
48
|
:gemdocs_help => "You can scan for the Gem doc server.
|
37
49
|
|
38
50
|
If the gem doc server is running you can click and view the docs
|
39
|
-
The docs for installed Gems should be visible "
|
40
|
-
|
41
|
-
|
51
|
+
The docs for installed Gems should be visible ",
|
52
|
+
:gemfilesinstalled => "You can see a list of gems that are installed on your system",
|
53
|
+
:gemconfiguration_help => "You can view the configuration file for Rubyslippers and edit it
|
54
|
+
'Fill Record' will load the configuration file rubyslippers.cnf into the screen input boxes
|
55
|
+
'Save Changes' will save the changes you have made - BE CERTAIN YOUR CHANGES ARE CORRECT
|
56
|
+
'Reload Variables' will load the changes you have made - otherwise your changes will be load next reboot
|
57
|
+
|
58
|
+
",
|
59
|
+
:gemspecdata_help => "You can view gemspecs
|
60
|
+
|
61
|
+
The directory searched in is in the rubyslippers.cnf
|
62
|
+
",
|
63
|
+
:editgemspec_help => "You can edit gemspec
|
64
|
+
You need to open a gemspec in the 'View Gemspec' tab first
|
65
|
+
|
66
|
+
The directory searched in is in the rubyslippers.cnf
|
67
|
+
",
|
68
|
+
:buildgem_help => "gem utilities are available as well as the gem build command
|
69
|
+
|
70
|
+
You can rename a gemspec, copy a gemspec or delete a gemspec
|
71
|
+
|
72
|
+
You can select a gemspec by clicking on 'list gemspecs'
|
73
|
+
|
74
|
+
You need to select a directory for the gem to be built in by clicking on 'list Gem Directories'
|
75
|
+
|
76
|
+
The directory searched in is in the rubyslippers.cnf",
|
77
|
+
:viewgemdir_help => "you can view the files in the gem directory before you build it
|
78
|
+
You can select a directory for the gem to be built in by clicking on 'list Gem Directories'
|
79
|
+
"
|
42
80
|
|
43
81
|
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# this code is to list the
|
1
|
+
# this code is to list the gemspecs
|
2
2
|
def listgemrecordfiles
|
3
3
|
# fileList = Dir.new($gemspecificationsdirectory).entries.sort.reverse.delete_if { |x| ! (x =~ /gemspec$/) }
|
4
4
|
fileList = Dir.new($gemspecificationsdirectory).entries.sort
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# this code is to list the gem installed
|
2
|
+
def listinstalledgemsfiles
|
3
|
+
|
4
|
+
fileList = Dir.new($gemspecificationsdirectory).entries.sort
|
5
|
+
@listgemrecordfilesresult = fileList.rwd_method("fillgemspecname")
|
6
|
+
@gemcommandresult = " "
|
7
|
+
end
|
8
|
+
|
9
|
+
def fillgemspecname(inffile)
|
10
|
+
applet = inffile.gsub(/\.gemspec$/, "")
|
11
|
+
@a_gemcommandoptioninput = applet
|
12
|
+
|
13
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# this code is to call the help window
|
2
2
|
def runhelpwindowrubyslippers
|
3
3
|
|
4
|
-
$help_topic = "
|
4
|
+
$help_topic = "GemCommands_help"
|
5
5
|
if @rwd_tab == "Viewgemdata"
|
6
6
|
$help_topic = "rubyslippers_generalhelp"
|
7
7
|
end
|
@@ -17,8 +17,25 @@ def runhelpwindowrubyslippers
|
|
17
17
|
if @rwd_tab == "gemservescan"
|
18
18
|
$help_topic = "gemdocs_help"
|
19
19
|
end
|
20
|
+
if @rwd_tab == "viewrubyslippersconfiguration"
|
21
|
+
$help_topic = "gemconfiguration_help"
|
22
|
+
end
|
23
|
+
|
24
|
+
if @rwd_tab == "Viewgemspecdata"
|
25
|
+
$help_topic = "gemspecdata_help"
|
26
|
+
end
|
27
|
+
|
28
|
+
if @rwd_tab == "editgemspecrecordfile"
|
29
|
+
$help_topic = "editgemspec_help"
|
30
|
+
end
|
31
|
+
if @rwd_tab == "gemutilitiesrubyslippers"
|
32
|
+
$help_topic = "buildgem_help"
|
33
|
+
end
|
34
|
+
if @rwd_tab == "viewgemdir"
|
35
|
+
$help_topic = "viewgemdir_help"
|
36
|
+
end
|
20
37
|
|
21
|
-
$helptopicsarray = $helptopicsarray | ["rubyslippers_generalhelp", "Install_Gem","GemCommands_help", "gemfilesinstalled","gemdocs_help"]
|
38
|
+
$helptopicsarray = $helptopicsarray | ["rubyslippers_generalhelp", "Install_Gem","GemCommands_help", "gemfilesinstalled","gemdocs_help","gemconfiguration_help","gemspecdata_help","editgemspec_help","buildgem_help","viewgemdir_help"]
|
22
39
|
$previouswindow = @rwd_window
|
23
40
|
$previoustab = @rwd_tab
|
24
41
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Application RwdAddresses orginally (c) 2004 Steven Gibson under GPL.
|
2
|
+
#
|
3
|
+
# For more information about see http://www.rubyforge.net/projects/rwdapplications
|
4
|
+
|
5
|
+
# call the window
|
6
|
+
def returntomain
|
7
|
+
@rwd_window = "main"
|
8
|
+
@rwd_tab = "rubyslippersselectiontab"
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Application RwdAddresses orginally (c) 2004 Steven Gibson under GPL.
|
2
|
+
#
|
3
|
+
# For more information about see http://www.rubyforge.net/projects/rwdapplications
|
4
|
+
|
5
|
+
# call the window
|
6
|
+
def runrubyslippersmenu1
|
7
|
+
@rwd_window = "main"
|
8
|
+
@rwd_tab = "gemcommands"
|
9
|
+
end
|
10
|
+
def runrubyslippersmenu2
|
11
|
+
@rwd_window = "main"
|
12
|
+
@rwd_tab = "Viewgemdata"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def runrubyslippersmenu3
|
17
|
+
@rwd_window = "main"
|
18
|
+
@rwd_tab = "geminstall"
|
19
|
+
end
|
20
|
+
|
21
|
+
def runrubyslippersmenu4
|
22
|
+
@rwd_window = "main"
|
23
|
+
@rwd_tab = "gemfilesinstalled"
|
24
|
+
end
|
25
|
+
def runrubyslippersmenu5
|
26
|
+
@rwd_window = "main"
|
27
|
+
@rwd_tab = "gemservescan"
|
28
|
+
end
|
29
|
+
|
30
|
+
def runrubyslippersmenu6
|
31
|
+
@rwd_window = "rubyslippersbackwindow"
|
32
|
+
@rwd_tab = "Viewgemspecdata"
|
33
|
+
end
|
34
|
+
|
35
|
+
def runrubyslippersmenu7
|
36
|
+
@rwd_window = "rubyslippersbackwindow"
|
37
|
+
@rwd_tab = "editgemspecrecordfile"
|
38
|
+
end
|
39
|
+
|
40
|
+
def runrubyslippersmenu8
|
41
|
+
@rwd_window = "rubyslippersbackwindow"
|
42
|
+
@rwd_tab = "gemutilitiesrubyslippers"
|
43
|
+
end
|
44
|
+
def runrubyslippersmenu9
|
45
|
+
@rwd_window = "rubyslippersbackwindow"
|
46
|
+
@rwd_tab = "viewgemdir"
|
47
|
+
end
|
48
|
+
|
49
|
+
def runrubyslippersmenu10
|
50
|
+
@rwd_window = "rubyslippersbackwindow"
|
51
|
+
@rwd_tab = "viewrubyslippersconfiguration"
|
52
|
+
end
|
53
|
+
def runrubyslippersmenu11
|
54
|
+
@rwd_window = "main"
|
55
|
+
@rwd_tab = "documentsrwdtinkerone"
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# this code is to list the gem directory
|
2
|
+
def listgemdir
|
3
|
+
begin
|
4
|
+
gemdirectory_gemfiles = File.join($gembuild_directory,@a_gemdirectoryinput)
|
5
|
+
fileList = Dir.new(gemdirectory_gemfiles ).entries.sort
|
6
|
+
|
7
|
+
@gemdirresult = fileList.rwd_method("fillviewgemdir")
|
8
|
+
rescue
|
9
|
+
@gemdirresult = "file error"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
# this method is to help fill in list of gemspecs
|
15
|
+
def fillviewgemdir(inffile)
|
16
|
+
applet = inffile
|
17
|
+
@a_gemdirectoryinput = applet
|
18
|
+
end
|
19
|
+
|
@@ -2,8 +2,11 @@
|
|
2
2
|
def listgemdirectories
|
3
3
|
gemdirectory_gemfiles = $gembuild_directory
|
4
4
|
fileList = Dir.new(gemdirectory_gemfiles).entries.sort
|
5
|
+
Dir.chdir(gemdirectory_gemfiles)
|
6
|
+
fileList.delete_if {|x| !test(?d,x)}
|
5
7
|
@listgemspecrecordfilesresult = ""
|
6
|
-
@listgemdirectoriesresult = fileList.rwd_method("fillshowgemdirsname")
|
8
|
+
@listgemdirectoriesresult = fileList.rwd_method("fillshowgemdirsname")
|
9
|
+
Dir.chdir($progdir)
|
7
10
|
end
|
8
11
|
|
9
12
|
def fillshowgemdirsname(inffile)
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#
|
2
|
+
|
3
|
+
def runcontrolcommand
|
4
|
+
require 'socket'
|
5
|
+
|
6
|
+
# Change this line...
|
7
|
+
ip = '127.0.0.1'
|
8
|
+
# And this one...
|
9
|
+
port = $rwdcontrolport1
|
10
|
+
if @a_remoteportinput
|
11
|
+
port = @a_remoteportinput.to_i
|
12
|
+
end
|
13
|
+
# Done!
|
14
|
+
|
15
|
+
|
16
|
+
commandtext = @a_remotecommandinput.to_s
|
17
|
+
|
18
|
+
remotehostnotfound = true
|
19
|
+
|
20
|
+
client = UDPSocket::new()
|
21
|
+
client.send(commandtext, 0, ip, port)
|
22
|
+
|
23
|
+
|
24
|
+
if (commandtext == "stop")
|
25
|
+
begin
|
26
|
+
@socket = UDPSocket::new()
|
27
|
+
@socket.bind(ip, port)
|
28
|
+
# Rescue the "Address in use" error
|
29
|
+
rescue Errno::EADDRINUSE
|
30
|
+
|
31
|
+
databack, info = client.recv(128)
|
32
|
+
@remotecommandresult = databack
|
33
|
+
@lastremotecommand = "rwdtinker remote:: Port #{port} on host #{ip} ."
|
34
|
+
remotehostnotfound = false
|
35
|
+
|
36
|
+
# Rescue the "Address not available" error
|
37
|
+
rescue Errno::EADDRNOTAVAIL
|
38
|
+
puts "Network plugin: Address #{host} is not available to bind."
|
39
|
+
|
40
|
+
# Rescue "permission denied errors
|
41
|
+
rescue Errno::EACCES
|
42
|
+
puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
43
|
+
|
44
|
+
# Rescue all other errors
|
45
|
+
rescue
|
46
|
+
puts "Network plugin: An error occured."
|
47
|
+
|
48
|
+
# Rescue all other errors
|
49
|
+
end
|
50
|
+
if remotehostnotfound
|
51
|
+
@remotecommandresult = "Remote Host not running"
|
52
|
+
end
|
53
|
+
@socket.close
|
54
|
+
end
|
55
|
+
|
56
|
+
remotehostnotfound = true
|
57
|
+
if (commandtext == "query")
|
58
|
+
begin
|
59
|
+
@socket = UDPSocket::new()
|
60
|
+
@socket.bind(ip, port)
|
61
|
+
# Rescue the "Address in use" error
|
62
|
+
rescue Errno::EADDRINUSE
|
63
|
+
|
64
|
+
|
65
|
+
databack, info = client.recv(128)
|
66
|
+
@remotecommandresult = databack
|
67
|
+
@lastremotecommand = "rwdtinker remote: Port #{port} on host #{ip} "
|
68
|
+
remotehostnotfound = false
|
69
|
+
|
70
|
+
# Rescue the "Address not available' error
|
71
|
+
rescue Errno::EADDRNOTAVAIL
|
72
|
+
puts "Network plugin: Address #{host} is not available to bind."
|
73
|
+
|
74
|
+
# Rescue "permission denied errors
|
75
|
+
rescue Errno::EACCES
|
76
|
+
puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
77
|
+
|
78
|
+
# Rescue all other errors
|
79
|
+
rescue
|
80
|
+
puts "Network plugin: An error occured."
|
81
|
+
|
82
|
+
# Rescue all other errors
|
83
|
+
end
|
84
|
+
@socket.close
|
85
|
+
end
|
86
|
+
if remotehostnotfound
|
87
|
+
@remotecommandresult = "Remote Host not running"
|
88
|
+
end
|
89
|
+
# Close the socket after use
|
90
|
+
client.close()
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
def showremoteportoptions
|
95
|
+
|
96
|
+
@remoteportoptions = ["#{$rwdcontrolport1}","#{$rwdcontrolport2}","#{$rwdcontrolport3}"].rwd_options
|
97
|
+
@remotecommandoptions = ["query","stop"].rwd_options
|
98
|
+
end
|
99
|
+
|
100
|
+
|
@@ -1,21 +1,21 @@
|
|
1
1
|
def installapplet
|
2
2
|
require 'fileutils'
|
3
|
+
require 'extras/zip/zip'
|
3
4
|
nametext = "%s" % [@a_installapplet]
|
4
5
|
|
5
6
|
begin # exception trapped block
|
6
7
|
fullname = nametext + ".zip"
|
7
8
|
fileName = File.join($zipslocation,fullname)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
system(commandline)
|
9
|
+
|
10
|
+
zf = Zip::ZipFile.new(fileName)
|
11
|
+
zf.sort.each {
|
12
|
+
|entry|
|
13
|
+
zf.extract(entry.to_s, entry.to_s)
|
14
|
+
}
|
15
15
|
@installapplettext = Message[:applet_installed]
|
16
16
|
|
17
17
|
rescue
|
18
|
-
@installapplettext = "
|
18
|
+
@installapplettext = "unzip error - applet may not be installed correctly"
|
19
19
|
end # exception rescue
|
20
20
|
|
21
21
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!ruby
|
2
|
+
require 'socket' # Network stuff
|
3
|
+
require 'timeout' # Timeout functions
|
4
|
+
|
5
|
+
def network_start
|
6
|
+
if RUBY_PLATFORM != "i386-mswin32"
|
7
|
+
processone = fork {
|
8
|
+
network_demon }
|
9
|
+
Process.detach(processone)
|
10
|
+
|
11
|
+
else
|
12
|
+
puts "fork not tried winXP?"
|
13
|
+
end
|
14
|
+
@viewremotecommandresult = "starting controller on next available port"
|
15
|
+
end
|
16
|
+
|
17
|
+
def network_demon
|
18
|
+
# Find configuration variables
|
19
|
+
host = "127.0.0.1"
|
20
|
+
port = $rwdcontrolport1
|
21
|
+
|
22
|
+
openportfound = false
|
23
|
+
until openportfound
|
24
|
+
|
25
|
+
# Create a socket to listen on and bind it to the host and port
|
26
|
+
begin
|
27
|
+
@socket = UDPSocket::new()
|
28
|
+
@socket.bind(host, port)
|
29
|
+
# Rescue the "Address in use" error
|
30
|
+
openportfound = true
|
31
|
+
|
32
|
+
rescue Errno::EADDRINUSE
|
33
|
+
puts "controller startup: Port #{port} on host #{host} is already in use."
|
34
|
+
port=port+1
|
35
|
+
# Rescue the "Address not available' error
|
36
|
+
rescue Errno::EADDRNOTAVAIL
|
37
|
+
puts "Network plugin: Address #{host} is not available to bind."
|
38
|
+
port=port+1
|
39
|
+
# Rescue "permission denied errors
|
40
|
+
rescue Errno::EACCES
|
41
|
+
puts "controller startup: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
|
42
|
+
port=port+1
|
43
|
+
# Rescue all other errors
|
44
|
+
rescue
|
45
|
+
puts "Network plugin: An error occured."
|
46
|
+
port = port+1
|
47
|
+
# Rescue all other errors
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# Get all acceptable hosts
|
54
|
+
hosts = ["localhost","vaio-sag"]
|
55
|
+
# Do some nice errorchecking
|
56
|
+
if(hosts.type != Array)
|
57
|
+
puts "Network plugin: No hosts found in networkConfig/acceptHosts. Shutting down plugin."
|
58
|
+
return -1 # Return the errorcode for plugin failure
|
59
|
+
end
|
60
|
+
|
61
|
+
# Main loop
|
62
|
+
while(true)
|
63
|
+
# Get data and client data from the client
|
64
|
+
data, info = @socket.recvfrom(256)
|
65
|
+
|
66
|
+
# Is this an acceptable IP address?
|
67
|
+
if(hosts.include?(info[2]) || hosts.include?(info[3]))
|
68
|
+
command, parameter = data.split(';')
|
69
|
+
|
70
|
+
# Command actions
|
71
|
+
command.downcase!()
|
72
|
+
case command
|
73
|
+
|
74
|
+
when 'stop'
|
75
|
+
@socket.send("hello world",0,info[3],info[1].to_i)
|
76
|
+
|
77
|
+
when 'query'
|
78
|
+
@socket.send("#{$rwdapplicationidentity} on port #{$port}",0,info[3],info[1].to_i)
|
79
|
+
|
80
|
+
|
81
|
+
end # case command
|
82
|
+
|
83
|
+
end # Access control if
|
84
|
+
end # while(true)
|
85
|
+
|
86
|
+
end # Network::start()
|
87
|
+
|