/**
  * Constructor.
  * @param node the social node.
  * @param provider the identity provider.
  * @param network the social network.
  * @param port the port number for the HTTP interface.
  * @param srh the social rpc handler.
  */
 public SocialConnectionManager(SocialNode node, IProvider provider,
                                ISocialNetwork network, string port,
                                Dictionary <string, SocialUser> friends,
                                SocialRpcHandler srh)
 {
     _snode              = node;
     _provider           = provider;
     _network            = network;
     _friendlist         = new List <string>();
     _friends            = friends;
     _http               = new HttpInterface(port);
     _http.ProcessEvent += ProcessHandler;
     _http.Start();
     _srh            = srh;
     _srh.SyncEvent += SyncHandler;
     _timer_thread   = new Timer(new TimerCallback(TimerHandler), null,
                                 STARTTIME, INTERVALTIME);
 }
Esempio n. 2
0
        public static new void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("usage: SocialVPN.exe <brunet.config path> " +
                                  "<ipop.config path> <http port>");
                return;
            }

            NodeConfig config = Utils.ReadConfig <NodeConfig>(args[0]);

            if (!System.IO.File.Exists(config.Security.KeyPath))
            {
                Console.Write("Enter Name (First Last): ");
                string name = Console.ReadLine();
                Console.Write("Enter Email Address: ");
                string uid = Console.ReadLine();
                Console.Write("Enter a name for this PC: ");
                string pcid    = Console.ReadLine();
                string version = "SVPN_0.3.0";
                string country = "US";

                config.NodeAddress = (Utils.GenerateAHAddress()).ToString();
                Utils.WriteConfig(args[0], config);
                SocialUtils.CreateCertificate(uid, name, pcid, version, country,
                                              config.NodeAddress,
                                              config.Security.CertificatePath,
                                              config.Security.KeyPath);
            }

            SocialNode node = new SocialNode(args[0], args[1],
                                             config.Security.CertificatePath,
                                             args[2]);

            node.Run();
        }
 /**
  * Constructor.
  * @param node the social node.
  * @param provider the identity provider.
  * @param network the social network.
  * @param port the port number for the HTTP interface.
  * @param srh the social rpc handler.
  */
 public SocialConnectionManager(SocialNode node, IProvider provider,
                            ISocialNetwork network, string port,
                            Dictionary<string, SocialUser> friends,
                            SocialRpcHandler srh)
 {
     _snode = node;
       _provider = provider;
       _network = network;
       _friendlist = new List<string>();
       _friends = friends;
       _http = new HttpInterface(port);
       _http.ProcessEvent += ProcessHandler;
       _http.Start();
       _srh = srh;
       _srh.SyncEvent += SyncHandler;
       _timer_thread = new Timer(new TimerCallback(TimerHandler), null,
                         STARTTIME, INTERVALTIME);
 }
Esempio n. 4
0
        /**
         * The main function, starting point for the program.
         */
        public static void Main(string[] args)
        {
            SocialConfig social_config = null;
              NodeConfig node_config = null;
              IpopConfig ipop_config = null;
              string http_port, jabber_port, global_access;

              social_config = Utils.ReadConfig<SocialConfig>("social.config");
              node_config = Utils.ReadConfig<NodeConfig>(social_config.BrunetConfig);
              ipop_config = Utils.ReadConfig<IpopConfig>(social_config.IpopConfig);
              http_port = social_config.HttpPort;
              jabber_port = social_config.JabberPort;
              global_access = social_config.GlobalAccess;

              SocialNode node = new SocialNode(node_config, ipop_config,
                                       node_config.Security.CertificatePath,
                                       http_port, jabber_port, global_access);
              node.Run();
        }
Esempio n. 5
0
        public static new void Main(string[] args)
        {
            if(args.Length < 3) {
            Console.WriteLine("usage: SocialVPN.exe <brunet.config path> " +
                           "<ipop.config path> <http port>");
            return;
              }

              NodeConfig config = Utils.ReadConfig<NodeConfig>(args[0]);

              if(!System.IO.File.Exists(config.Security.KeyPath)) {
            Console.Write("Enter Name (First Last): ");
            string name = Console.ReadLine();
            Console.Write("Enter Email Address: ");
            string uid = Console.ReadLine();
            Console.Write("Enter a name for this PC: ");
            string pcid = Console.ReadLine();
            string version = "SVPN_0.3.0";
            string country = "US";

            config.NodeAddress = (Utils.GenerateAHAddress()).ToString();
            Utils.WriteConfig(args[0], config);
            SocialUtils.CreateCertificate(uid, name, pcid, version, country,
                                      config.NodeAddress,
                                      config.Security.CertificatePath,
                                      config.Security.KeyPath);
              }

              SocialNode node = new SocialNode(args[0], args[1],
                                       config.Security.CertificatePath,
                                       args[2]);
              node.Run();
        }
Esempio n. 6
0
        protected virtual void Start()
        {
            string app_dir = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
              System.IO.Directory.SetCurrentDirectory(app_dir);

              SocialConfig social_config = null;
              NodeConfig node_config = null;
              IpopConfig ipop_config = null;
              string http_port, jabber_port, global_access;

              social_config = Utils.ReadConfig<SocialConfig>("social.config");
              node_config = Utils.ReadConfig<NodeConfig>(social_config.BrunetConfig);
              ipop_config = Utils.ReadConfig<IpopConfig>(social_config.IpopConfig);
              http_port = social_config.HttpPort;
              jabber_port = social_config.JabberPort;
              global_access = social_config.GlobalAccess;

              _node = new SocialNode(node_config, ipop_config,
                                       node_config.Security.CertificatePath,
                                       http_port, jabber_port, global_access);
              _node.Run();
              //Thread.MemoryBarrier();
        }
Esempio n. 7
0
 /**
  * Constructor.
  * @param node the social node.
  * @param provider the identity provider.
  * @param network the social network.
  * @param port the port number for the HTTP interface.
  * @param srh the social rpc handler.
  */
 public SocialConnectionManager(SocialNode node,SocialNetworkProvider snp,
                            SocialRpcHandler srh, string port,
                            BlockingQueue queue, 
                            SocialDnsManager sdm)
 {
     _snode = node;
       _snp = snp;
       _http = new HttpInterface(port);
       _http.ProcessEvent += ProcessHandler;
       _http.Start();
       _srh = srh;
       _queue = queue;
       _sdm = sdm;
       _main_thread = new Thread(Start);
       _main_thread.Start();
       _delims = new char[] {'\n',','};
       _last_update = DateTime.MinValue;
       _last_store = _last_update;
       _last_publish = _last_update;
       _last_ping = _last_update;
       _heartbeat_counter = 0;
 }