Exemple #1
0
    /// <summary>Create a XmppEL.</summary>
    public XmppEdgeListener(XmppService xmpp)
    {
      _it = new IdentifierTable();
      _running = 0;
      _started = 0;
      _ready = 0;

      _xmpp = xmpp;
      xmpp.OnStreamInit += XmppRelayFactory.HandleStreamInit;
      // After we've authenticated we setup the rest of our paths
      xmpp.OnAuthenticate += HandleAuthenticate;
      if(xmpp.IsAuthenticated) {
        HandleAuthenticate(null);
      }
    }
Exemple #2
0
        /// <summary>Create a XmppEL.</summary>
        public XmppEdgeListener(XmppService xmpp)
        {
            _it      = new IdentifierTable();
            _running = 0;
            _started = 0;
            _ready   = 0;

            _xmpp              = xmpp;
            xmpp.OnStreamInit += XmppRelayFactory.HandleStreamInit;
            // After we've authenticated we setup the rest of our paths
            xmpp.OnAuthenticate += HandleAuthenticate;
            if (xmpp.IsAuthenticated)
            {
                HandleAuthenticate(null);
            }
        }
        /// <summary>A rendezvous service for finding remote TAs and sharing
        /// our TA, so that peers can become connected.</summary>
        public XmppDiscovery(ITAHandler ta_handler, XmppService xmpp, string realm) :
            base(ta_handler)
        {
            _realm = realm;
            _xmpp  = xmpp;
            _ready = 0;
            _xmpp.Register(typeof(XmppTARequest), HandleRequest);
            _xmpp.Register(typeof(XmppTAReply), HandleReply);
            _xmpp.OnStreamInit += XmppTAFactory.HandleStreamInit;

            // Operations aren't valid until Xmpp has authenticated with the servers
            xmpp.OnAuthenticate += HandleAuthenticate;
            if (xmpp.IsAuthenticated)
            {
                HandleAuthenticate(null);
            }
        }
Exemple #4
0
    /// <summary>Prepares a BasicNode.</summary>
    /// <param name="node_config">A node config object.</param>
    public BasicNode(NodeConfig node_config)
    {
      _node_config = node_config;
      _running = true;
      _shutdown = Shutdown.GetShutdown();
      _shutdown.OnExit += OnExit;

      _type_to_pem = new Dictionary<string, PathELManager>();
      _rand = new Random();

      if(_node_config.XmppServices.Enabled) {
        XmppService = new XmppService(_node_config.XmppServices.Username,
            _node_config.XmppServices.Password,// _node_config.XmppServices.Server,
            _node_config.XmppServices.Port);
        XmppService.Connect();
      }
    }
Exemple #5
0
    public JabberNetwork(string uid, string password, 
      string host, string port) {
      _addresses = ImmutableDictionary<string, string>.Empty;
      _fingerprints = ImmutableDictionary<string, string>.Empty;
      _doc = new XmlDocument();
      _port = Int32.Parse(port);
      _host = host;
      _data = String.Empty;
      _message = "Offline";
      _uid = uid;
      _password = password;
      _auto_connect = false;
      _timer = new Timer(TimerHandler, null, PUB_PERIOD, PUB_PERIOD);

      _xmpp = new XmppService(uid, password, _port);
      _xmpp.Register(typeof(SvpnMsg), HandleSvpnMsg);
      _xmpp.OnStreamInit += SvpnFactory.HandleStreamInit;
      _xmpp.OnAuthenticate += HandleAuthenticate;
      _xmpp.OnAuthError += HandleAuthError;
      _xmpp.OnPresence += HandlePresence;
      _xmpp.OnError += HandleError;
    }