instrumentation: add next-share/
[cs-p2p-next.git] / instrumentation / next-share / BaseLib / Transport / components / SwarmTransport.js
1 // -*- coding: utf-8 -*-
2 // vi:si:et:sw=2:sts=2:ts=2
3 /*
4   JavaScript global constructor swarmTransport
5   
6   Written by Jan Gerber
7   see LICENSE.txt for license information
8  */
9
10 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
11
12 const Cc = Components.classes;
13 const Ci = Components.interfaces;
14
15 function SwarmTransport() {
16 }
17
18 SwarmTransport.prototype =
19 {
20   classDescription: "swarmTransport",
21   classID: Components.ID("3dfea7b2-52e6-467f-b2c6-19fd6d4596bf"),
22   contractID: "@p2pnext.org/tribe/swarmTransport;1",
23   QueryInterface: XPCOMUtils.generateQI(
24     [Ci.tribeISwarmTransport,
25      Ci.nsISecurityCheckedComponent,
26      Ci.nsISupportsWeakReference,
27      Ci.nsIClassInfo]),
28   _xpcom_factory : SwarmTransportFactory,
29   _xpcom_categories : [{
30     category: "JavaScript global constructor",
31     entry: "swarmTransport"
32   }],
33   version: 0.1,
34
35
36 var SwarmTransportFactory =
37 {
38   createInstance: function (outer, iid)
39   {
40     if (outer != null)
41       throw Components.results.NS_ERROR_NO_AGGREGATION;
42
43     if (!iid.equals(Ci.nsIProtocolHandler) &&
44         !iid.equals(Ci.nsISupports) )
45       throw Components.results.NS_ERROR_NO_INTERFACE;
46
47     return (new SwarmTransport()).QueryInterface(iid);
48   }
49 };
50
51 function NSGetModule(compMgr, fileSpec) {
52   return XPCOMUtils.generateModule([SwarmTransport]);
53 }
54