// Online UINT NtOnline(NAT *n, RPC_DUMMY *t) { UINT ret = ERR_NO_ERROR; Lock(n->lock); { if (n->Online) { // It is already online ret = ERR_ALREADY_ONLINE; } else { if (n->ClientOption == NULL || n->ClientAuth == NULL) { // Setting is not yet done ret = ERR_ACCOUNT_NOT_PRESENT; } else { // OK n->Online = true; // Start connection n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); } } } Unlock(n->lock); NiWriteConfig(n); return ret; }
// オンラインにする UINT NtOnline(NAT *n, RPC_DUMMY *t) { UINT ret = ERR_NO_ERROR; Lock(n->lock); { if (n->Online) { // すでにオンラインである ret = ERR_ALREADY_ONLINE; } else { if (n->ClientOption == NULL || n->ClientAuth == NULL) { // 設定がまだ ret = ERR_ACCOUNT_NOT_PRESENT; } else { // OK n->Online = true; // 接続開始 n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); } } } Unlock(n->lock); NiWriteConfig(n); return ret; }
// Create a NAT NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o) { NAT *n = ZeroMalloc(sizeof(NAT)); n->lock = NewLock(); Hash(n->HashedPassword, "", 0, true); n->HaltEvent = NewEvent(); //n->Cedar = NewCedar(NULL, NULL); n->SecureNAT = snat; // Raise the priority //OSSetHighPriority(); // Initialize the settings NiInitConfig(n); #if 0 // Start the operation of the virtual host if (n->Online && n->ClientOption != NULL) { n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); } else { n->Online = false; n->Virtual = NULL; } #else n->Virtual = NewVirtualHostEx(n->Cedar, NULL, NULL, o, n); n->Online = true; #endif // Start management command //NiInitAdminAccept(n); return n; }
// NAT の作成 NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o) { NAT *n = ZeroMalloc(sizeof(NAT)); n->lock = NewLock(); Hash(n->HashedPassword, "", 0, true); n->HaltEvent = NewEvent(); //n->Cedar = NewCedar(NULL, NULL); n->SecureNAT = snat; // 優先順位を上げる //OSSetHighPriority(); // 設定の初期化 NiInitConfig(n); #if 0 // 仮想ホストの動作を開始 if (n->Online && n->ClientOption != NULL) { n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); } else { n->Online = false; n->Virtual = NULL; } #else n->Virtual = NewVirtualHostEx(n->Cedar, NULL, NULL, o, n); n->Online = true; #endif // 管理コマンド開始 //NiInitAdminAccept(n); return n; }