コード例 #1
0
ファイル: Node.cs プロジェクト: sprig/libzt
 /// <summary>
 /// Creates a new Node. Start this object by calling Start().
 /// </summary>
 /// <param name="configFilePath">Where keys and config files will be stored on the filesystem</param>
 /// <param name="managedCallback">Where you would like to receive ZeroTier event notifications</param>
 /// <param name="servicePort">The port ZeroTier will use to send its encrypted </param>
 /// <returns></returns>
 public Node(string configFilePath, ZeroTierManagedEventCallback managedCallback, UInt16 servicePort)
 {
     if (String.IsNullOrEmpty(configFilePath))
     {
         throw new ArgumentNullException("configFilePath");
     }
     if (managedCallback == null)
     {
         throw new ArgumentNullException("managedCallback");
     }
     _nodeId          = 0x0;
     _configFilePath  = configFilePath;
     _servicePort     = servicePort;
     _managedCallback = new ZeroTierManagedEventCallback(managedCallback);
 }
コード例 #2
0
        public int InitSetEventHandler(ZeroTierManagedEventCallback managedCallback)
        {
            if (managedCallback == null)
            {
                throw new ArgumentNullException("managedCallback");
            }
            int res = Constants.ERR_OK;

            if ((res = zts_init_set_event_handler(OnZeroTierEvent)) == Constants.ERR_OK)
            {
                _unmanagedCallback = OnZeroTierEvent;
                _managedCallback   = new ZeroTierManagedEventCallback(managedCallback);
            }
            return(res);
        }