Commit ac9f82ee authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Merge remote-tracking branch 'mstrum/flack3'

Conflicts:
	protogeni/flack/README
	protogeni/flack/src/com/flack/geni/tasks/process/GenerateRequestManifestTask.as
	protogeni/flack/src/com/flack/geni/tasks/tests/TestsliceRspec.as
	protogeni/flack/src/com/flack/geni/tasks/tests/TestsliceRspecLeft.as
	protogeni/flack/src/com/flack/geni/tasks/tests/TestsliceRspecRight.as
parents 39c249d6 097b56c3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="flack.mxml" projectUUID="b36db05d-671c-420d-a77c-fb5420040cb2" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="js" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<actionScriptProperties analytics="false" mainApplicationPath="flack.mxml" projectUUID="4ce6005b-0cb7-45ed-8c85-63d8eb364ed9" version="11">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" flex3CompatMode="false" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="js" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path="">
......@@ -17,6 +17,7 @@
<application path="flack.mxml"/>
</applications>
<modules/>
<workers/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
</actionScriptProperties>
flack.mxml
- Main application, mostly bootstrapping and high-level stuff.
com.flack.shared.*
- Code that isn't GENI-specific. The original purpose of this shared library was to extract classes which could be used in either the GENI or Emulab code.
- Top-level classes help with some basic stuff like caching or bootstrapping. The FlackDispatcher is the main class which is responsible for throwing flack-related events.
com.flack.shared.display.*
- Visual elements to represent tasks
com.flack.shared.display.areas.*
- Base code for areas along with some basic implementations like the tasker and map areas.
com.flack.shared.display.components.*
- Some basic components like buttons or editors.
com.flack.shared.display.panes.*
- Just the task pane, to show currently running tasks.
com.flack.shared.display.skins.*
- Skins, mostly used to make sure everything was big enough for touch interfaces. There are also some to improve behavior.
com.flack.shared.display.windows.*
- Base code for pop-up windows.
com.flack.shared.logging.*
- Base code for the logging mechanism used everywhere.
com.flack.shared.resources.*
- Some basic objects used to represent managers, resource documents, components, sites, APIs, users, IDN-URNs, and identifiable objects.
com.flack.shared.tasks.*
- Base code for the task engine.
com.flack.shared.tasks.file.*
- Basic tasks to handle loading or saving files.
com.flack.shared.tasks.http.*
- Base tasks for HTTP tasks (through the browser or Forge).
com.flack.shared.tasks.xmlrpc.*
- Base task for XML-RPC calls.
com.flack.shared.utils.*
- Basic utility files that provide helpers for math, strings, etc.
com.flack.emulab.*
- You can ignore this, it's basically the code I got working to make flack talk with Emulab's XML-RPC interface.
com.flack.geni.*
- All of the Flack code specific to the GENI world.
- GeniUniverse (instantiated at GeniMain.geniUniverse) basically holds all GENI information (user, aggregates, authorities)
- GeniCache uses SharedCache to save/load GENI-specific stuff which should persist.
com.geni.display.*
- GUI code (areas, mapping, panes, slice, windows, etc.). Basically if you use Flack and you can see it, the class will be in here and may extend basic classes in com.shared.display.*.
com.geni.plugins.*
- Gemini, Instools, ShadowNet, etc.
- Sliver types are defined here. The Emulab plugin defines the sliver types found at Emulab, PlanetLab defines sliver types found there, etc. This allows Flack to control behavior based on the sliver type.
- Each plugin can also have an area which is available in the slice editor but it isn't required.
- Plugins like Instools listen for events like when a slice has been completely parsed (all manifests recieved) and perform actions like determining whether instools was used or not.
com.geni.resources.*
- Data structures used to represent the GENI universe
com.geni.resources.docs.*
- Credentials
com.geni.resources.physical.*
- Advertised resources (nodes, links, interfaces).
com.geni.resources.sites.*
- Representations for aggregate managers, slice authorities, and clearinghouse. The managers package also includes helper classes for determining what certain link types or sliver types are able to do.
com.geni.resources.virt.*
- Resources that are (or will be) sliced. This includes everything from stitching, slivers, aggregate slivers, slices, nodes, links, etc. If it isn't advertised but needs to be used when working with slices, it's here.
com.geni.tasks.*
- Tasks that need to be done (parsing rspecs, submitting slices, etc.)
com.geni.tasks.groups.*
- Tasks which are multi-step (creating slices, listing resources, etc.)
com.geni.tasks.groups.slice.*
- Multi-step tasks for slices (deleting, creating, submitting, getting, etc.)
com.geni.tasks.http.*
- Basic HTTP tasks to use the public lists for authorities and maangers.
com.geni.tasks.process.*
- Generate and parse RSPECs.
com.geni.tasks.tests.*
- Tests that have probably all bit-rot which were used to test the initial version of the task engine, event engine, GUI, and some specific scenarios.
com.geni.tasks.xmlrpc.am.*
- AM API tasks
com.geni.tasks.xmlrpc.protogeni.*
- ProtoGENI API tasks
com.geni.tasks.xmlrpc.scs.*
- SCS (stitching) tasks
Flack2
Flack3
Development
===========
......@@ -6,24 +6,22 @@ FlashBuilder is not required, but recommended. Below are directions for using e
Flash Builder
------------
Version: Any (reference is 4.5)
Flex SDK: >= 4.6 (copy to the flash builder's SDK folder and add to the installed SDKs in the Flash Builder section of preferences)
Version: 4.7+ (support for Apache Flex was added in that version)
SDK: >= Apache Flex 4.9 (copy to the flash builder's SDK folder and add to the installed SDKs in the Flash Builder section of preferences)
The version of Flash Builder doesn't really matter, just make sure it has the minimum required version of the Flex SDK installed.
The version of Flash Builder doesn't really matter, just make sure it has the minimum required version of the Apache Flex SDK installed.
You should be able to copy the flack directory into a FlashBuilder workspace and import it as a project.
Ensure:
- In the run configurations, make sure it launches 'js\flack.html' instead of the default .swf
- In the project preferences: under 'Flex Compiler':
* >= 4.6 SDK is selected
* >= 4.9 SDK is selected
* 'generate HTML wrapper' is unselected
- In the project preferences: under 'Flex Build Path':
* Output directory is 'js'
* Framework linkage is 'merged into code'
FLEX SDK only
Apache FLEX SDK only
-------------
You can use the included config.xml with the freely available Flex SDK >= 4.6 to generage a flack.swf which you can copy into the js/ directory and run the flack.html.
Make sure to copy the config.xml file and modify the paths to point to your version of the sdk and the appropriate directories for source and libraries.
\ No newline at end of file
You should be able to use the included build.xml with the freely available Flex SDK >= 4.9 to generate a flack.swf which you can copy into the js/ directory and run the flack.html.
......@@ -56,7 +56,7 @@
</extensions>
<!-- compiler.external-library-path: list of SWC files or directories to compile against but to omit from linking-->
<external-library-path>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\player\11.1\playerglobal.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\player\11.1\playerglobal.swc</path-element>
</external-library-path>
<fonts>
<!-- compiler.fonts.advanced-anti-aliasing: enables advanced anti-aliasing for embedded fonts, which provides greater clarity for small fonts.-->
......@@ -129,20 +129,38 @@
<keep-generated-actionscript>false</keep-generated-actionscript>
<!-- compiler.library-path: list of SWC files or directories that contain SWC files-->
<library-path>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\framework.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\textLayout.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\spark.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\sparkskins.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\rpc.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\charts.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\spark_dmv.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\mx\mx.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\osmf.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\advancedgrids.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\authoringsupport.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\libs\flash-integration.swc</path-element>
<path-element>C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.6.0\frameworks\locale\{locale}</path-element>
<path-element>D:\Projects\Flash Builder 4.5\flack2\libs</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\framework.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\textLayout.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\spark.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\sparkskins.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\rpc.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\charts.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\spark_dmv.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\osmf.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\mx\mx.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\advancedgrids.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\apache.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\authoringsupport.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\experimental.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\libs\flash-integration.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\advancedgrids_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\airframework_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\airspark_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\apache_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\automation_agent_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\automation_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\charts_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\experimental_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\flash-integration_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\framework_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\mobilecomponents_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\mx_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\playerglobal_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\rpc_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\spark_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\textLayout_rb.swc</path-element>
<path-element>C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.9.0\frameworks\locale\en_US\tool_air_rb.swc</path-element>
<path-element>E:\Documents\fb47\flack\libs</path-element>
</library-path>
<!-- compiler.locale: specifies the locale for internationalization-->
<locale>
......@@ -183,6 +201,14 @@
<uri>http://www.adobe.com/2006/mxml</uri>
<manifest>mxml-manifest.xml</manifest>
</namespace>
<namespace>
<uri>http://flex.apache.org/ns</uri>
<manifest>apache-manifest.xml</manifest>
</namespace>
<namespace>
<uri>http://flex.apache.org/experimental/ns</uri>
<manifest>experimental-manifest.xml</manifest>
</namespace>
</namespaces>
<!-- compiler.omit-trace-statements: toggle whether trace statements are omitted-->
<omit-trace-statements>true</omit-trace-statements>
......@@ -218,7 +244,7 @@
<show-unused-type-selector-warnings>true</show-unused-type-selector-warnings>
<!-- compiler.source-path: list of path elements that form the roots of ActionScript class hierarchies-->
<source-path>
<path-element>D:\Projects\Flash Builder 4.5\flack2\src</path-element>
<path-element>E:\Documents\fb47\flack\src</path-element>
</source-path>
<!-- compiler.strict: runs the AS3 compiler in strict error checking mode.-->
<strict>true</strict>
......@@ -378,7 +404,7 @@
<date>text</date>
-->
<!-- metadata.description: The default description to store in the SWF metadata-->
<description>http://www.adobe.com/products/flex</description>
<description>http://incubator.apache.org/flex</description>
<!-- metadata.language: The language to store in the SWF metadata (i.e. EN, FR)-->
<language>EN</language>
<!-- metadata.localized-description: A localized RDF/XMP description to store in the SWF metadata-->
......@@ -398,9 +424,9 @@
</localized-title>
-->
<!-- metadata.publisher: A publisher's name to store in the SWF metadata-->
<publisher>unknown</publisher>
<publisher>Apache Software Foundation</publisher>
<!-- metadata.title: The default title to store in the SWF metadata-->
<title>Adobe Flex 4 Application</title>
<title>Apache Flex Application</title>
</metadata>
<!-- raw-metadata: XML text to store in the SWF metadata (overrides metadata.* configuration)-->
<!-- raw-metadata usage:
......@@ -448,7 +474,7 @@
<size-report>filename</size-report>
-->
<!-- static-link-runtime-shared-libraries: statically link the libraries specified by the -runtime-shared-libraries-path option.-->
<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<!-- swf-version: specifies the version of the compiled SWF file.-->
<swf-version>14</swf-version>
<!-- target-player: specifies the version of the player the application is targeting. Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".-->
......
......@@ -20,8 +20,8 @@
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="history/history.css" /> -->
<!-- <script type="text/javascript" src="history/history.js"></script> -->
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
......@@ -62,11 +62,13 @@
<script type="text/javascript" src="forge/aes.js"></script>
<script type="text/javascript" src="forge/asn1.js"></script>
<script type="text/javascript" src="forge/jsbn.js"></script>
<script type="text/javascript" src="forge/jsbn2.js"></script>
<script type="text/javascript" src="forge/prng.js"></script>
<script type="text/javascript" src="forge/random.js"></script>
<script type="text/javascript" src="forge/oids.js"></script>
<script type="text/javascript" src="forge/rsa.js"></script>
<script type="text/javascript" src="forge/pki.js"></script>
<script type="text/javascript" src="forge/tls.js"></script>
<script type="text/javascript" src="forge/tlssocket.js"></script>
<script type="text/javascript" src="forge/http.js"></script>
<script type="text/javascript">
......@@ -168,6 +170,19 @@
}
}
function addServerCert(newCert)
{
try {
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function setClientCert(newCert)
{
try {
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Flack</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Initially,
don't display flashContent div so it won't show if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #d2e1f0; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<!-- <link rel="stylesheet" type="text/css" href="history/history.css" /> -->
<!-- <script type="text/javascript" src="history/history.js"></script> -->
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="forge/debug.js"></script>
<script type="text/javascript" src="forge/util.js"></script>
<script type="text/javascript" src="forge/log.js"></script>
<script type="text/javascript" src="forge/socket.js"></script>
<script type="text/javascript" src="forge/md5.js"></script>
<script type="text/javascript" src="forge/sha1.js"></script>
<script type="text/javascript" src="forge/hmac.js"></script>
<script type="text/javascript" src="forge/aes.js"></script>
<script type="text/javascript" src="forge/asn1.js"></script>
<script type="text/javascript" src="forge/jsbn.js"></script>
<script type="text/javascript" src="forge/prng.js"></script>
<script type="text/javascript" src="forge/random.js"></script>
<script type="text/javascript" src="forge/oids.js"></script>
<script type="text/javascript" src="forge/rsa.js"></script>
<script type="text/javascript" src="forge/pki.js"></script>
<script type="text/javascript" src="forge/tls.js"></script>
<script type="text/javascript" src="forge/tlssocket.js"></script>
<script type="text/javascript" src="forge/http.js"></script>
<script type="text/javascript">
//<![CDATA[
// logging category
var cat = 'forge.tests.tls';
swfobject.embedSWF(
'forge/SocketPool.swf', 'socketPool', '0', '0', '9.0.0',
false, {}, {allowscriptaccess: 'always'}, {});
// CA certificate for test server
var serverCerts = [];
var clientCert = '';
var clientKey = '';
var flash_id = "";
function getSWF()
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[flash_id];
}
else
{
return document[flash_id];
}
}
var sp;
function init(new_flash_id)
{
try {
flash_id = new_flash_id;
sp = net.createSocketPool({
flashId: 'socketPool',
policyPort: 843,
msie: false
});
} catch(ex) {
forge.log.error(cat, ex);
}
}
// local aliases
var net = window.forge.net;
var tls = window.forge.tls;
var http = window.forge.http;
var util = window.forge.util;
var clients = new Object();
function make_request(instance, host, path, sendData)
{
try {
var newClient = client_init(host);
if (clients[instance] == null)
{
clients[instance] = newClient;
client_send(newClient, path, sendData, instance);
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function cancel_request(instance)
{
try {
var client = clients[instance];
if (client != null)
{
client_cleanup(client);
delete client[instance];
if (client[instance] != null)
{
forge.log.debug(cat, "instance not really deleted", "");
}
}
} catch(ex) {
forge.log.error(cat, ex);
}
return false;
}
function setServerCert(newCert)
{
try {
serverCerts = [];
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function setClientCert(newCert)
{
try {
clientCert = newCert;
} catch(ex) {
forge.log.error(cat, ex);
}
}
function setClientKey(newKey)
{
try {
clientKey = newKey;
} catch(ex) {
forge.log.error(cat, ex);
}
}
function client_init(host)
{
var result = null;
try
{
var arg = {
url: host,
socketPool: sp,
connections: 1,
// optional cipher suites in order of preference
caCerts : serverCerts,
cipherSuites: [
tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
verify: function(c, verified, depth, certs)
{
/*
forge.log.debug(cat,
'TLS certificate ' + depth + ' subject: ' + certs[depth].subject.getField('CN').value + " issuer: " + certs[depth].issuer.getField('CN').value, verified);
// Note: change to always true to test verifying without cert
//return verified;
// FIXME: temporarily accept any cert to allow hitting any bpe
if(verified !== true)
{
forge.log.warning(cat,
'Certificate NOT verified. Ignored for test.');
}
return true;
*/
return verified;
},
primeTlsSockets: false
};
if (clientCert != "")
{
arg.getCertificate = function(c, request) { return clientCert; };
arg.getPrivateKey = function(c, cert) { return clientKey; };
}
result = http.createClient(arg);
}
catch(ex)
{
forge.log.error(cat, ex);
}
return result;
}
function client_cleanup(client)
{
client.destroy();
}
function client_send(client, path, data, instance)
{
var requestArg = {
path: path,
method: 'GET' };
if (data != "")
{
requestArg.method = 'POST';
requestArg.headers = [{'Content-Type': 'text/xml'}];
requestArg.body = data;
}
var request = http.createRequest(requestArg);
client.send({
request: request,
connected: function(e)
{
// forge.log.debug(cat, 'connected', e);
},
headerReady: function(e)
{
// forge.log.debug(cat, 'header ready', e);
},
bodyReady: function(e)
{
// forge.log.debug(cat, 'body ready called', e);
var response = e.response.body;
e.socket.close();
getSWF().flash_onbody(instance, response);
},
error: function(e)
{
var response = e.type + ": " + e.message;
if (e.cause != null)
{
// response += ": " + String(e.cause);
}
e.socket.close();
getSWF().flash_onerror(instance, response);
}
});
return false;
}
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
flashvars.skipstartup = "1";
flashvars.keycert = "URL_ENCODED_PEM"
flashvars.keypassphrase = "URL_ENCODED_PASSPHRASE";
//flashvars.bundlepreset = "1";
//flashvars.keycertpreset = "1";
flashvars.loadallmanagerswithoutasking = "1";
flashvars.saurl = "https%3A%2F%2Fwww.emulab.net%3A12369%2Fprotogeni%2Fxmlrpc%2Fsa";
flashvars.saurn = "urn%3Apublicid%3AIDN%2Bemulab.net%2Bauthority%2Bsa";
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.fullScreenOnSelection = "true";
var attributes = {};
attributes.id = "flack";
attributes.name = "flack";
attributes.align = "middle";
swfobject.embedSWF(
"flack.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
//]]>