limit incoming connections to localhost

This commit is contained in:
Rob Watson 2009-04-15 11:23:45 +01:00
parent e95907663a
commit d548d34fc9
1 changed files with 63 additions and 63 deletions

View File

@ -21,7 +21,7 @@ SC3Controller {
}; };
if(nodes.isEmpty) { if(nodes.isEmpty) {
node = OSCresponderNode(nil, '/sc3ctrl/cmd') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/cmd') { |t, r, msg|
{ {
thisThread.clock = SystemClock; thisThread.clock = SystemClock;
msg[1].asString.interpretPrint; msg[1].asString.interpretPrint;
@ -30,32 +30,32 @@ SC3Controller {
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/help') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/help') { |t, r, msg|
{ msg[1].asString.openHelpFile }.defer { msg[1].asString.openHelpFile }.defer
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/class') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/class') { |t, r, msg|
{ msg[1].asString.interpret.openCodeFile }.defer { msg[1].asString.interpret.openCodeFile }.defer
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/implementations') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/implementations') { |t, r, msg|
{ SC3Controller.methodTemplates(msg[1]) }.defer { SC3Controller.methodTemplates(msg[1]) }.defer
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/references') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/references') { |t, r, msg|
{ SC3Controller.methodReferences(msg[1]) }.defer { SC3Controller.methodReferences(msg[1]) }.defer
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/stop') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/stop') { |t, r, msg|
thisProcess.stop; thisProcess.stop;
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/clear') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/clear') { |t, r, msg|
{ {
Document.listener.string = ""; ""; Document.listener.string = ""; "";
postToFront.(); postToFront.();
@ -63,12 +63,12 @@ SC3Controller {
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/postfront') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/postfront') { |t, r, msg|
{ postToFront.() }.defer; { postToFront.() }.defer;
}.add; }.add;
nodes.add(node); nodes.add(node);
node = OSCresponderNode(nil, '/sc3ctrl/recompile') { |t, r, msg| node = OSCresponderNode(NetAddr("localhost", nil), '/sc3ctrl/recompile') { |t, r, msg|
{ {
thisProcess.recompile; thisProcess.recompile;
postToFront.(); postToFront.();
@ -83,61 +83,61 @@ SC3Controller {
} }
// adapated from Kernel.sc // adapated from Kernel.sc
*methodTemplates { |name| *methodTemplates { |name|
var out, found = 0, namestring; var out, found = 0, namestring;
out = CollStream.new; out = CollStream.new;
out << "Implementations of '" << name << "' :\n"; out << "Implementations of '" << name << "' :\n";
Class.allClasses.do({ arg class; Class.allClasses.do({ arg class;
class.methods.do({ arg method; class.methods.do({ arg method;
if (method.name == name, { if (method.name == name, {
found = found + 1; found = found + 1;
namestring = class.name ++ ":" ++ name; namestring = class.name ++ ":" ++ name;
out << " " << namestring << " : "; out << " " << namestring << " : ";
if (method.argNames.isNil or: { method.argNames.size == 1 }, { if (method.argNames.isNil or: { method.argNames.size == 1 }, {
out << "this." << name; out << "this." << name;
if (name.isSetter, { out << "(val)"; }); if (name.isSetter, { out << "(val)"; });
},{ },{
out << method.argNames.at(0); out << method.argNames.at(0);
if (name.asString.at(0).isAlpha, { if (name.asString.at(0).isAlpha, {
out << "." << name << "("; out << "." << name << "(";
method.argNames.do({ arg argName, i; method.argNames.do({ arg argName, i;
if (i > 0, { if (i > 0, {
if (i != 1, { out << ", " }); if (i != 1, { out << ", " });
out << argName; out << argName;
}); });
}); });
out << ")"; out << ")";
},{ },{
out << " " << name << " "; out << " " << name << " ";
out << method.argNames.at(1); out << method.argNames.at(1);
}); });
}); });
out.nl; out.nl;
}); });
}); });
}); });
if(found == 0) if(found == 0)
{ {
Post << "\nNo implementations of '" << name << "'.\n"; Post << "\nNo implementations of '" << name << "'.\n";
} }
{ {
out.collection.newTextWindow(name.asString); out.collection.newTextWindow(name.asString);
}; };
} }
// adapted from Kernel.sc // adapted from Kernel.sc
*methodReferences { |name| *methodReferences { |name|
var out, references; var out, references;
name = name.asSymbol; name = name.asSymbol;
out = CollStream.new; out = CollStream.new;
references = Class.findAllReferences(name); references = Class.findAllReferences(name);
if (references.notNil, { if (references.notNil, {
out << "References to '" << name << "' :\n"; out << "References to '" << name << "' :\n";
references.do({ arg ref; out << " " << ref.asString << "\n"; }); references.do({ arg ref; out << " " << ref.asString << "\n"; });
out.collection.newTextWindow(name.asString); out.collection.newTextWindow(name.asString);
},{ },{
Post << "\nNo references to '" << name << "'.\n"; Post << "\nNo references to '" << name << "'.\n";
}); });
} }
} }