diff --git a/developer_tools/vpnserver-jsonrpc-codegen/.gitignore b/developer_tools/vpnserver-jsonrpc-codegen/.gitignore new file mode 100644 index 00000000..ab0f72cb --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/.gitignore @@ -0,0 +1,350 @@ +# Created by https://www.gitignore.io/api/visualstudio +# Edit at https://www.gitignore.io/?templates=visualstudio + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- Backup*.rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# End of https://www.gitignore.io/api/visualstudio diff --git a/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs b/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs new file mode 100644 index 00000000..9a71f0a7 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs @@ -0,0 +1,2059 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using System.Linq; +using static System.Console; +using System.Xml.Linq; +using SoftEther.JsonRpc; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; +using Markdig; + +namespace VPNServer_JSONRPC_CodeGen +{ + public enum TargetLang + { + CSharp, + TypeScript, + } + + static class CodeGenUtil + { + public static string AppExeDir; + public static string ProjectDir; + public static string VpnSrcDir; + public static string OutputDir_Clients; + public static string OutputDir_HamCore; + + static CodeGenUtil() + { + AppExeDir = System.AppContext.BaseDirectory; + ProjectDir = AppExeDir; + string tmp = AppExeDir; + while (true) + { + try + { + tmp = Path.GetDirectoryName(tmp); + if (Directory.GetFiles(tmp, "*.csproj").Length >= 1) + { + ProjectDir = tmp; + break; + } + } + catch + { + break; + } + } + OutputDir_Clients = Path.Combine(ProjectDir, @"..\vpnserver-jsonrpc-clients"); + + string root_dir = Path.Combine(ProjectDir, @"..\.."); + string dirname = null; + if (Directory.Exists(Path.Combine(root_dir, "Main"))) dirname = "Main"; + if (Directory.Exists(Path.Combine(root_dir, "src"))) dirname = "src"; + if (string.IsNullOrEmpty(dirname)) throw new ApplicationException($"Directory '{root_dir}' is not a root dir."); + + VpnSrcDir = dirname; + + OutputDir_HamCore = Path.Combine(root_dir, dirname, @"bin\hamcore"); + if (Directory.Exists(OutputDir_HamCore) == false) throw new ApplicationException($"Direction '{OutputDir_HamCore}' not found."); + } + + public static void MakeDir(string path) + { + try + { + Directory.CreateDirectory(path); + } + catch + { + } + } + } + + class CSharpSourceCode + { + public SyntaxTree Tree { get; } + public CompilationUnitSyntax Root { get; } + public SemanticModel Model { get; set; } + + public CSharpSourceCode(string filename) : this(File.ReadAllText(filename), filename) + { + } + + public CSharpSourceCode(string body, string filename) + { + this.Tree = CSharpSyntaxTree.ParseText(body, path: filename); + this.Root = this.Tree.GetCompilationUnitRoot(); + } + } + + + class CSharpCompiler + { + public string AssemblyName { get; } + public List ReferencesList { get; } = new List(); + public List SourceCodeList { get; } = new List(); + + CSharpCompilation _compilation = null; + + public CSharpCompilation Compilation + { + get + { + if (_compilation == null) + { + _compilation = CSharpCompilation.Create(this.AssemblyName, + this.SourceCodeList.Select(s => s.Tree), + this.ReferencesList, + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Debug, + assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default)); + + } + return _compilation; + } + } + + public CSharpCompiler(string assembly_name) + { + this.AssemblyName = assembly_name; + } + + public void AddReference(MetadataReference r) + { + this.ReferencesList.Add(r); + } + public void AddReferenceByPath(string path) + { + AddReference(MetadataReference.CreateFromFile(path)); + } + public void AddReferenceByType(Type type) + { + AddReferenceByPath(type.Assembly.Location); + } + public void AddReferenceByAssemblyName(string name) + { + var a = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName(name)); + + AddReferenceByPath(a.Location); + } + public void AddReferenceDotNetStandard() + { + var a = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("netstandard")); + + AddReferenceByPath(a.Location); + + string dir = Path.GetDirectoryName(a.Location); + + AddReferenceByPath(Path.Combine(dir, "System.Private.CoreLib.dll")); + + foreach (var refa in a.GetReferencedAssemblies()) + { + string dll_name = Path.Combine(dir, refa.Name) + ".dll"; + + if (File.Exists(dll_name)) + { + AddReferenceByPath(dll_name); + } + } + } + + public void AddSourceCode(CSharpSourceCode cs) + { + this.SourceCodeList.Add(cs); + } + + public bool OkOrPrintErrors() + { + MemoryStream ms = new MemoryStream(); + Microsoft.CodeAnalysis.Emit.EmitResult ret = Compilation.Emit(ms); + + if (ret.Success) + { + return true; + } + + IEnumerable failures = ret.Diagnostics.Where(diagnostic => + diagnostic.IsWarningAsError || + diagnostic.Severity == DiagnosticSeverity.Error); + + foreach (Diagnostic diagnostic in failures) + { + WriteLine(diagnostic.ToString()); + } + return false; + } + + public void Compile(bool test_full_compile = false) + { + if (test_full_compile) + { + if (OkOrPrintErrors() == false) + { + throw new ApplicationException("Compile Error."); + } + } + + foreach (CSharpSourceCode cs in this.SourceCodeList) + { + cs.Model = this.Compilation.GetSemanticModel(cs.Tree); + } + } + } + + class GeneratedCodePart + { + public int Seq = 0; + public string Text = ""; + } + + class GeneratedCodeSection + { + public List PartList = new List(); + + public override string ToString() + { + StringWriter w = new StringWriter(); + var a = this.PartList.OrderBy(x => x.Seq); + + foreach (var b in a) + { + w.Write(b.Text.ToString()); + } + + return w.ToString(); + } + + public void AddPart(int seq, string text) + { + this.PartList.Add(new GeneratedCodePart() { Seq = seq, Text = text }); + } + } + + class GeneratedCode + { + public GeneratedCodeSection Types = new GeneratedCodeSection(); + public GeneratedCodeSection Stubs = new GeneratedCodeSection(); + public GeneratedCodeSection Tests = new GeneratedCodeSection(); + + public override string ToString() + { + StringWriter w = new StringWriter(); + + w.WriteLine("// --- Types ---"); + w.Write(this.Types.ToString()); + w.WriteLine(); + + w.WriteLine("// --- Stubs ---"); + w.Write(this.Stubs.ToString()); + w.WriteLine(); + + w.WriteLine("// --- Tests ---"); + w.Write(this.Tests.ToString()); + w.WriteLine(); + + return w.ToString(); + } + } + + class GeneratedCodeForLang + { + public GeneratedCode TypeScript = new GeneratedCode(); + + public string DocsRpc = ""; + } + + static class CodeGenExtensions + { + public static string GetDocumentStr(this ISymbol sym) + { + if (sym == null) return ""; + string xml = sym.GetDocumentationCommentXml(); + if (string.IsNullOrEmpty(xml)) return ""; + XDocument doc = XDocument.Parse(xml); + var summary = doc.Descendants("summary").FirstOrDefault(); + string str = summary.Value; + if (string.IsNullOrEmpty(str)) return ""; + str = str.Replace(" (Async mode)", "", StringComparison.InvariantCultureIgnoreCase); + str = str.Trim(); + return str; + } + } + + class RpcInfo + { + public string Name; + public string TypeName; + + public IMethodSymbol Symbol; + + public HashSet InputParamMembers = new HashSet(); + } + + class RpcTypeParameterInfo + { + public string Name; + public string Type; + public string Description; + } + + class RpcTypeInfo + { + public string Name; + public string Description; + + public List Params = new List(); + public List SubTypes = new List(); + } + + class CodeGen + { + CSharpSourceCode cs_types, cs_stubs, cs_tests; + + public Dictionary rpc_list = new Dictionary(); + public Dictionary rpc_type_list = new Dictionary(); + + CSharpCompiler csc; + + public CodeGen() + { + csc = new CSharpCompiler("Test"); + + csc.AddReferenceDotNetStandard(); + csc.AddReferenceByType(typeof(Newtonsoft.Json.JsonPropertyAttribute)); + + cs_types = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpc\VPNServerRpcTypes.cs")); + csc.AddSourceCode(cs_types); + + cs_stubs = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpc\VPNServerRpc.cs")); + csc.AddSourceCode(cs_stubs); + + cs_tests = new CSharpSourceCode(Path.Combine(CodeGenUtil.ProjectDir, @"VpnServerRpcTest\VpnServerRpcTest.cs")); + csc.AddSourceCode(cs_tests); + + csc.Compile(); + } + + void generate_types(GeneratedCodeForLang ret) + { + var model = cs_types.Model; + + var class_list = cs_types.Root.DescendantNodes().OfType(); + + foreach (ClassDeclarationSyntax c in class_list) + { + StringWriter ts = new StringWriter(); + + string doc = model.GetDeclaredSymbol(c).GetDocumentStr(); + if (string.IsNullOrEmpty(doc) == false) + { + ts.WriteLine($"/** {doc} */"); + } + + RpcTypeInfo info = new RpcTypeInfo() + { + Name = c.Identifier.Text, + Description = doc, + }; + rpc_type_list[c.Identifier.Text] = info; + + ts.WriteLine($"export class {c.Identifier.Text}"); + ts.WriteLine("{"); + + foreach (var member in model.GetDeclaredSymbol(c).GetMembers()) + { + string json_name = ""; + bool json_name_has_special_char = false; + var atts = member.GetAttributes(); + var y = atts.Where(x => x.AttributeClass.Name == "JsonPropertyAttribute").FirstOrDefault(); + if (y != null) + { + json_name = y.ConstructorArguments.FirstOrDefault().Value.ToString(); + if (json_name.IndexOf(':') != -1 || json_name.IndexOf('.') != -1) json_name_has_special_char = true; + } + + string default_value = "\"\""; + + string enum_type = ""; + + switch (member) + { + case IFieldSymbol field: + string ts_type = ""; + ITypeSymbol type = field.Type; + switch (type.Kind) + { + case SymbolKind.NamedType: + switch (type.Name) + { + case "UInt32": + case "UInt64": + ts_type = "number"; + default_value = "0"; + break; + + case "String": + ts_type = "string"; + break; + + case "Boolean": + ts_type = "boolean"; + default_value = "false"; + break; + + case "DateTime": + ts_type = "Date"; + default_value = "new Date()"; + break; + + default: + if (type.TypeKind == TypeKind.Enum) + { + ts_type = type.Name; + enum_type = type.Name; + default_value = "0"; + break; + } + throw new ApplicationException($"{c.Identifier}.{member.Name}: type.Name = {type.Name}"); + } + break; + + case SymbolKind.ArrayType: + ITypeSymbol type2 = ((IArrayTypeSymbol)type).ElementType; + + default_value = "[]"; + + switch (type2.Kind) + { + case SymbolKind.NamedType: + switch (type2.Name) + { + case "UInt32": + case "UInt64": + ts_type = "number[]"; + break; + + case "String": + ts_type = "string[]"; + break; + + case "Boolean": + ts_type = "boolean[]"; + break; + + case "Byte": + ts_type = "Uint8Array"; + default_value = "new Uint8Array([])"; + break; + + default: + if (type2.ContainingAssembly.Name == csc.AssemblyName) + { + ts_type = type2.Name + "[]"; + enum_type = type2.Name; + break; + } + throw new ApplicationException($"{c.Identifier}.{member.Name}: type2.Name = {type2.Name}"); + } + break; + + default: + throw new ApplicationException($"{c.Identifier}.{member.Name}: type2.Kind = {type2.Kind}"); + } + + break; + + default: + throw new ApplicationException($"{c.Identifier}.{member.Name}: type.Kind = {type.Kind}"); + } + + if (string.IsNullOrEmpty(ts_type) == false) + { + string field_name = field.Name; + string doc2 = member.GetDocumentStr(); + + if (string.IsNullOrEmpty(json_name) == false) field_name = json_name; + + string info_type = ts_type; + string info_type2 = ""; + if (field_name.EndsWith("_str")) info_type2 = "ASCII"; + if (field_name.EndsWith("_utf")) info_type2 = "UTF8"; + if (field_name.EndsWith("_ip")) info_type2 = "IP address"; + if (field_name.EndsWith("_u32")) info_type2 = "uint32"; + if (field_name.EndsWith("_u64")) info_type2 = "uint64"; + if (field_name.EndsWith("_bin")) { info_type2 = "Base64 binary"; info_type = "string"; } + + string docs_add = ""; + + if (string.IsNullOrEmpty(enum_type) == false) + { + Type et = Type.GetType("SoftEther.VPNServerRpc." + enum_type); + if (et.IsEnum) + { + docs_add += "
Values:"; + + var ed = cs_types.Root.DescendantNodes().OfType() + .Where(e => e.Identifier.Text == enum_type) + .Single(); + + foreach (var em in model.GetDeclaredSymbol(ed).GetMembers()) + { + switch (em) + { + case IFieldSymbol ef: + if (ef.IsConst && ef.IsDefinition) + { + string doc3 = em.GetDocumentStr(); + docs_add += $"
`{ef.ConstantValue}`: {doc3}"; + } + break; + } + } + + info_type = "number"; + info_type2 = "enum"; + } + else + { + if (info.SubTypes.Contains(enum_type) == false) + { + info.SubTypes.Add(enum_type); + info_type = "Array object"; + } + } + } + + info_type = "`" + info_type + "`"; + if (string.IsNullOrEmpty(info_type2) == false) info_type += " (" + info_type2 + ")"; + + info.Params.Add(new RpcTypeParameterInfo() + { + Name = field_name, + Type = info_type, + Description = doc2 + docs_add, + }); + + if (json_name_has_special_char) field_name = $"[\"{json_name}\"]"; + + if (string.IsNullOrEmpty(doc2) == false) + { + ts.WriteLine($" /** {doc2} */"); + } + + ts.WriteLine($" public {field_name}: {ts_type} = {default_value};"); + + ts.WriteLine(); + } + break; + + case IMethodSymbol method when method.MethodKind == MethodKind.Constructor: + break; + + default: + throw new ApplicationException($"{c.Identifier}.{member.Name}: type = {member.GetType()}"); + } + } + + if (string.IsNullOrEmpty(doc) == false) + { + ts.WriteLine($" /** Constructor for the '{c.Identifier.Text}' class: {doc} */"); + } + ts.WriteLine($" public constructor(init?: Partial<{c.Identifier.Text}>)"); + ts.WriteLine(" {"); + ts.WriteLine(" Object.assign(this, init);"); + ts.WriteLine(" }"); + + ts.WriteLine("}"); + ts.WriteLine(); + + ret.TypeScript.Types.AddPart(c.SpanStart, ts.ToString()); + } + + var enum_list = cs_types.Root.DescendantNodes().OfType(); + + foreach (EnumDeclarationSyntax e in enum_list) + { + StringWriter ts = new StringWriter(); + + string doc = model.GetDeclaredSymbol(e).GetDocumentStr(); + if (string.IsNullOrEmpty(doc) == false) + { + ts.WriteLine($"/** {doc} */"); + } + + ts.WriteLine($"export enum {e.Identifier.Text}"); + ts.WriteLine("{"); + + foreach (var member in model.GetDeclaredSymbol(e).GetMembers()) + { + switch (member) + { + case IFieldSymbol field: + if (field.IsConst && field.IsDefinition) + { + string doc2 = member.GetDocumentStr(); + if (string.IsNullOrEmpty(doc2) == false) + { + ts.WriteLine($" /** {doc2} */"); + } + + ts.WriteLine($" {field.Name} = {field.ConstantValue},"); + + ts.WriteLine(); + } + break; + } + } + + ts.WriteLine("}"); + ts.WriteLine(); + + ret.TypeScript.Types.AddPart(e.SpanStart, ts.ToString()); + } + } + + void generate_stubs(GeneratedCodeForLang ret) + { + var model = cs_stubs.Model; + + var rpc_class = cs_stubs.Root.DescendantNodes().OfType().Where(c => c.Identifier.Text == "VpnServerRpc").First(); + + var members = model.GetDeclaredSymbol(rpc_class).GetMembers(); + + var methods = members.Where(m => m is IMethodSymbol).Select(m => m as IMethodSymbol).Where(m => m.IsStatic == false) + .Where(m => m.IsAsync).Where(m => m.Name != "CallAsync"); + + foreach (var method in methods) + { + string method_name = method.Name; + if (method_name.EndsWith("Async") == false) throw new ApplicationException($"{method.Name}: method_name = {method_name}"); + method_name = method_name.Substring(0, method_name.Length - 5); + + INamedTypeSymbol ret_type = (INamedTypeSymbol)method.ReturnType; + if (ret_type.Name != "Task") throw new ApplicationException($"{method.Name}: ret_type.Name = {ret_type.Name}"); + + var ret_type_args = ret_type.TypeArguments; + if (ret_type_args.Length != 1) throw new ApplicationException($"{method.Name}: type_args.Length = {ret_type_args.Length}"); + + var ret_type_name = ret_type_args[0].Name; + + if (method.Parameters.Length >= 2) throw new ApplicationException($"{method.Name}: method.Parameters.Length = {method.Parameters.Length}"); + + if (method.DeclaringSyntaxReferences.Length != 1) throw new ApplicationException($"{method.Name}: method.DeclaringSyntaxReferences.Length = {method.DeclaringSyntaxReferences.Length}"); + + MethodDeclarationSyntax syntax = (MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax(); + if (syntax.Body != null) throw new ApplicationException($"{method.Name}: syntax.Body != null"); + if (syntax.ExpressionBody == null) throw new ApplicationException($"{method.Name}: syntax.ExpressionBody == null"); + + ArrowExpressionClauseSyntax body = syntax.ExpressionBody; + InvocationExpressionSyntax invoke = body.DescendantNodes().OfType().Single(); + + if (model.GetSymbolInfo(invoke.Expression).Symbol.Name != "CallAsync") throw new ApplicationException($"{method.Name}: model.GetSymbolInfo(invoke.Expression).Symbol.Name = {model.GetSymbolInfo(invoke.Expression).Symbol.Name}"); + + if (invoke.ArgumentList.Arguments.Count != 2) throw new ApplicationException($"{method.Name}: invoke.ArgumentList.Arguments.Count = {invoke.ArgumentList.Arguments.Count}"); + + LiteralExpressionSyntax str_syntax = (LiteralExpressionSyntax)invoke.ArgumentList.Arguments[0].Expression; + + string str = str_syntax.Token.Text; + + StringWriter ts = new StringWriter(); + + string doc2 = method.GetDocumentStr(); + if (string.IsNullOrEmpty(doc2) == false) + { + ts.WriteLine($" /** {doc2} */"); + } + + if (method.Parameters.Length == 0) + { + ts.WriteLine($" public {method_name} = (): Promise<{ret_type_name}> =>"); + ts.WriteLine(" {"); + ts.WriteLine($" return this.CallAsync<{ret_type_name}>({str}, new {ret_type_name}());"); + ts.WriteLine(" }"); + ts.WriteLine(" "); + } + else + { + ts.WriteLine($" public {method_name} = (in_param: {ret_type_name}): Promise<{ret_type_name}> =>"); + ts.WriteLine(" {"); + ts.WriteLine($" return this.CallAsync<{ret_type_name}>({str}, in_param);"); + ts.WriteLine(" }"); + ts.WriteLine(" "); + } + + rpc_list[method_name] = new RpcInfo() + { + Name = method_name, + TypeName = ret_type_name, + Symbol = method, + }; + + ret.TypeScript.Stubs.AddPart(method.DeclaringSyntaxReferences[0].Span.Start, ts.ToString()); + } + } + + class CcWalker : CSharpSyntaxWalker + { + StringWriter w = new StringWriter(); + + List lines = new List(); + string current_line = ""; + int current_depth = 0; + const int TabSpace = 4; + CSharpSourceCode src; + + TargetLang lang; + + public CcWalker(CSharpSourceCode src, TargetLang lang) : base(SyntaxWalkerDepth.StructuredTrivia) + { + this.src = src; + this.lang = lang; + } + + string convert_type(string src) + { + if (lang == TargetLang.TypeScript) + { + if (src.StartsWith("Vpn")) + { + src = "VPN." + src; + } + + if (src == "int" || src == "uint" || src == "long" || src == "ulong") + { + src = "number"; + } + + if (src == "bool") + { + src = "boolean"; + } + + if (src == "DateTime") + { + src = "Date"; + } + } + return src; + } + + string convert_function(string src) + { + if (lang == TargetLang.TypeScript) + { + if (src == "Console.WriteLine" || src == "print_object") + { + src = "console.log"; + } + + if (src.StartsWith("api.") || src.StartsWith("Test_")) + { + src = "await " + src; + } + } + return src; + } + + void _emit_internal(string str, bool new_line) + { + if (string.IsNullOrEmpty(current_line)) + { + current_line += new string(' ', current_depth * TabSpace); + } + current_line += str; + if (new_line) + { + lines.Add(current_line); + current_line = ""; + } + } + + void emit_line(string str = "") => emit(str + "\r\n"); + + void emit(string str, bool new_line) + { + if (new_line == false) + { + emit(str); + } + else + { + emit_line(str); + } + } + + void emit(string str) + { + string tmp = ""; + for (int i = 0; i < str.Length; i++) + { + char c = str[i]; + if (c == '\r') { } + else if (c == '\n') + { + _emit_internal(tmp, true); + tmp = ""; + } + else + { + tmp += c; + } + } + if (String.IsNullOrEmpty(tmp) == false) + { + _emit_internal(tmp, false); + } + } + + public override void VisitMethodDeclaration(MethodDeclarationSyntax node) + { + if (node.Identifier.Text == "print_object") return; + + if (lang == TargetLang.TypeScript) + { + emit_line(); + + var sem = src.Model.GetDeclaredSymbol(node); + string doc2 = sem.GetDocumentStr(); + if (string.IsNullOrEmpty(doc2) == false) + { + emit_line($"/** {doc2} */"); + } + + emit("async function "); + emit(node.Identifier.Text); + Visit(node.ParameterList); + emit(": "); + emit("Promise<"); + Visit(node.ReturnType); + emit(">"); + emit_line(""); + + Visit(node.Body); + } + else + { + emit("public"); + emit(" "); + Visit(node.ReturnType); + emit(" "); + emit(node.Identifier.Text); + Visit(node.ParameterList); + emit_line(""); + + Visit(node.Body); + } + } + + public override void VisitParameter(ParameterSyntax node) + { + if (lang == TargetLang.TypeScript) + { + emit($"{node.Identifier.Text}"); + emit(": "); + Visit(node.Type); + } + else + { + Visit(node.Type); + emit(" "); + emit($"{node.Identifier.Text}"); + } + } + + public override void VisitParameterList(ParameterListSyntax node) + { + emit("("); + int num = 0; + foreach (ParameterSyntax p in node.Parameters) + { + if (num >= 1) + { + emit(", "); + } + + Visit(p); + + num++; + } + emit(")"); + } + + public override void VisitArgumentList(ArgumentListSyntax node) + { + emit("("); + int num = 0; + foreach (ArgumentSyntax arg in node.Arguments) + { + if (num >= 1) + { + emit(", "); + } + + this.VisitArgument(arg); + + num++; + } + emit(")"); + } + + public override void VisitAssignmentExpression(AssignmentExpressionSyntax node) + { + if (lang == TargetLang.TypeScript) + { + if (node.Parent.Kind() == SyntaxKind.ObjectInitializerExpression) + { + Visit(node.Left); + + emit(": "); + + Visit(node.Right); + } + else + { + Visit(node.Left); + + emit(" = "); + + Visit(node.Right); + } + } + else + { + Visit(node.Left); + + emit(" = "); + + Visit(node.Right); + } + } + + public override void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) + { + Visit(node.Expression); + + emit(node.OperatorToken.Text); + + Visit(node.Name); + } + + public override void VisitCastExpression(CastExpressionSyntax node) + { + if (lang == TargetLang.TypeScript) + { + Visit(node.Expression); + } + else + { + emit("("); + Visit(node.Type); + emit(")"); + Visit(node.Expression); + } + } + + public override void VisitBreakStatement(BreakStatementSyntax node) + { + emit_line("break;"); + } + + public override void VisitReturnStatement(ReturnStatementSyntax node) + { + if (node.Expression == null) + { + emit_line("return;"); + } + else + { + emit("return"); + emit(" "); + Visit(node.Expression); + emit_line(";"); + } + } + + public override void VisitForEachStatement(ForEachStatementSyntax node) + { + if (lang == TargetLang.TypeScript) + { + emit("for (let "); + emit(node.Identifier.Text); + emit(" of "); + Visit(node.Expression); + emit_line(")"); + Visit(node.Statement); + } + else + { + emit("foreach ("); + + Visit(node.Type); + + emit(" "); + + emit(node.Identifier.Text); + + emit(" in "); + + Visit(node.Expression); + + emit_line(")"); + + Visit(node.Statement); + } + } + + public override void VisitExpressionStatement(ExpressionStatementSyntax node) + { + Visit(node.Expression); + + emit_line(";"); + } + + public override void VisitConditionalExpression(ConditionalExpressionSyntax node) + { + Visit(node.Condition); + emit(" ? "); + Visit(node.WhenTrue); + emit(" : "); + Visit(node.WhenFalse); + } + + public override void VisitIfStatement(IfStatementSyntax node) + { + emit("if ("); + Visit(node.Condition); + emit_line(")"); + + Visit(node.Statement); + + if (node.Else != null) + { + if (node.Else.Statement is IfStatementSyntax) + { + emit("else "); + } + else + { + emit_line("else"); + } + + Visit(node.Else.Statement); + } + } + + public override void VisitInitializerExpression(InitializerExpressionSyntax node) + { + if (lang == TargetLang.TypeScript) + { + if (node.Kind() == SyntaxKind.ArrayInitializerExpression) + { + bool is_byte_array = false; + + if (node.Parent.Kind() == SyntaxKind.ArrayCreationExpression && + ((ArrayCreationExpressionSyntax)node.Parent).Type.ElementType.ToString() == "byte") + { + is_byte_array = true; + } + + if (is_byte_array) + { + emit("new Uint8Array("); + } + + emit("[ "); + current_depth++; + + foreach (var exp in node.Expressions) + { + this.Visit(exp); + + emit(", "); + } + + current_depth--; + emit(" ]"); + + if (is_byte_array) + { + emit(")"); + } + } + else + { + emit_line("{"); + current_depth++; + + foreach (var exp in node.Expressions) + { + this.Visit(exp); + + emit_line(","); + } + + current_depth--; + emit("}"); + } + } + else + { + if (node.Kind() == SyntaxKind.ArrayInitializerExpression) + { + emit("{ "); + current_depth++; + + foreach (var exp in node.Expressions) + { + this.Visit(exp); + + emit(", "); + } + + current_depth--; + emit(" }"); + } + else + { + emit_line("{"); + current_depth++; + + foreach (var exp in node.Expressions) + { + this.Visit(exp); + + emit_line(","); + } + + current_depth--; + emit("}"); + } + } + } + + public override void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) + { + if (lang == TargetLang.TypeScript) + { + var type = node.Type; + + if (node.Initializer != null) + { + emit(" "); + Visit(node.Initializer); + } + else + { + emit("[]"); + } + } + else + { + var type = node.Type; + + emit("new "); + + Visit(node.Type); + + if (node.Initializer != null) + { + emit(" "); + Visit(node.Initializer); + } + } + } + + public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) + { + if (lang == TargetLang.TypeScript) + { + var type = (IdentifierNameSyntax)node.Type; + + if (node.Initializer == null) + { + emit("new "); + Visit(node.Type); +// emit($"new {type.Identifier.Text}"); + + Visit(node.ArgumentList); + } + else + { + emit("new "); + Visit(node.Type); + emit_line("("); + Visit(node.Initializer); + emit(")"); + } + } + else + { + var type = (IdentifierNameSyntax)node.Type; + + emit($"new {type.Identifier.Text}"); + + Visit(node.ArgumentList); + + if (node.Initializer != null) + { + emit_line(""); + Visit(node.Initializer); + } + } + } + + public override void VisitLiteralExpression(LiteralExpressionSyntax node) + { + emit(node.Token.Text); + } + + public override void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) + { + emit("("); + base.Visit(node.Expression); + emit(")"); + } + + public override void VisitBinaryExpression(BinaryExpressionSyntax node) + { + base.Visit(node.Left); + emit($" {node.OperatorToken.Text} "); + base.Visit(node.Right); + } + + public override void VisitIdentifierName(IdentifierNameSyntax node) + { + string name = node.Identifier.Text; + + if (node.Parent.Kind() == SyntaxKind.VariableDeclaration + || node.Parent.Kind() == SyntaxKind.MethodDeclaration + || node.Parent.Kind() == SyntaxKind.SimpleMemberAccessExpression + || node.Parent.Kind() == SyntaxKind.ForEachStatement + || node.Parent.Kind() == SyntaxKind.Parameter + || node.Parent.Kind() == SyntaxKind.ObjectCreationExpression) + { + name = convert_type(name); + } + + var sym = src.Model.GetSymbolInfo(node); + string json_name = ""; + bool json_name_has_special_char = false; + var atts = sym.Symbol.GetAttributes(); + var y = atts.Where(x => x.AttributeClass.Name == "JsonPropertyAttribute").FirstOrDefault(); + if (y != null) + { + json_name = y.ConstructorArguments.FirstOrDefault().Value.ToString(); + if (json_name.IndexOf(':') != -1 || json_name.IndexOf('.') != -1) json_name_has_special_char = true; + } + + string field_name = name; + if (lang == TargetLang.TypeScript) + { + if (string.IsNullOrEmpty(json_name) == false) field_name = json_name; + if (json_name_has_special_char) field_name = $"[\"{json_name}\"]"; + } + + emit(field_name); + } + + public override void VisitInvocationExpression(InvocationExpressionSyntax node) + { + string func_name = node.Expression.ToString(); + func_name = convert_function(func_name); + + if (lang == TargetLang.TypeScript) + { + if (func_name == "rand.Next") + { + string a = node.ArgumentList.Arguments[0].ToString(); + string b = node.ArgumentList.Arguments[1].ToString(); + emit($"Math.floor((Math.random() * ({b} - {a})) + {a})"); + return; + } + + if (func_name == "System.Threading.Thread.Sleep") + { + string a = node.ArgumentList.Arguments[0].ToString(); + emit($"await new Promise((r) => setTimeout(r, {a}))"); + return; + } + } + + emit(func_name); + + Visit(node.ArgumentList); + } + + public override void VisitPredefinedType(PredefinedTypeSyntax node) + { + string name = node.Keyword.Text; + name = convert_type(name); + emit(name); + } + + public override void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) + { + emit("["); + + int num = 0; + + foreach (ExpressionSyntax exp in node.Sizes) + { + if (num >= 1) + { + emit(","); + } + + Visit(exp); + + num++; + } + + emit("]"); + } + + public override void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) + { + /*foreach (var statement in node.Body.Statements) + { + Visit(statement); + }*/ + } + + public override void VisitArrayType(ArrayTypeSyntax node) + { + Visit(node.ElementType); + + foreach (var rank in node.RankSpecifiers) + { + Visit(rank); + } + } + + public void VisitVariableDeclarator(VariableDeclaratorSyntax node, TypeSyntax type) + { + if (lang == TargetLang.TypeScript) + { +// if (node.Parent.Parent.Kind() == SyntaxKind.LocalDeclarationStatement) + { + emit("let "); + } + + emit($"{node.Identifier.Text}"); + + emit(": "); + + var type_dec = src.Model.GetTypeInfo(type); + + if (type is PredefinedTypeSyntax) + { + Visit(type); + } + else if (type is ArrayTypeSyntax) + { + Visit(type); + } + else if (type is IdentifierNameSyntax) + { + Visit(type); + } + else + { + throw new ApplicationException($"VisitVariableDeclarator: {type.GetType().ToString()}"); + } + + if (node.Initializer != null) + { + emit(" = "); + + var value = node.Initializer.Value; + + base.Visit(value); + } + + emit_line(";"); + } + else + { + var type_dec = src.Model.GetTypeInfo(type); + + if (type is PredefinedTypeSyntax) + { + Visit(type); + } + else if (type is ArrayTypeSyntax) + { + Visit(type); + } + else if (type is IdentifierNameSyntax) + { + Visit(type); + } + else + { + throw new ApplicationException($"VisitVariableDeclarator: {type.GetType().ToString()}"); + } + + emit($" {node.Identifier.Text}"); + + if (node.Initializer != null) + { + emit(" = "); + + var value = node.Initializer.Value; + + base.Visit(value); + } + + emit_line(";"); + } + } + + public override void VisitVariableDeclaration(VariableDeclarationSyntax node) + { + foreach (var v in node.Variables) + { + VisitVariableDeclarator(v, node.Type); + } + } + + public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) + { + Visit(node.Declaration); + } + + public override void VisitFieldDeclaration(FieldDeclarationSyntax node) + { + //Visit(node.Declaration); + } + + public override void VisitBlock(BlockSyntax node) + { + emit_line("{"); + current_depth++; + + foreach (var statement in node.Statements) + { + Visit(statement); + } + + current_depth--; + emit_line("}"); + } + + public override void VisitClassDeclaration(ClassDeclarationSyntax node) + { + if (lang == TargetLang.TypeScript) + { + base.VisitClassDeclaration(node); + } + else + { + emit_line($"class {node.Identifier.Text}"); + emit_line("{"); + + current_depth++; + + base.VisitClassDeclaration(node); + + current_depth--; + + emit_line("}"); + } + } + + public override string ToString() + { + StringWriter w = new StringWriter(); + this.lines.ForEach(x => w.WriteLine(x)); + if (String.IsNullOrEmpty(this.current_line) == false) w.WriteLine(this.current_line); + return w.ToString(); + } + } + + void generate_tests(GeneratedCodeForLang ret) + { + var test_class = cs_tests.Root.DescendantNodes().OfType().Where(c => c.Identifier.Text == "VPNRPCTest").First(); + + CcWalker ts_walker = new CcWalker(cs_tests, TargetLang.TypeScript); + ts_walker.Visit(test_class); + ret.TypeScript.Tests.PartList.Add(new GeneratedCodePart() { Seq = 0, Text = ts_walker.ToString() }); + } + + void doc_write_parameters(StringWriter w, RpcTypeInfo type_info) + { + List plist = new List(); + + foreach (RpcTypeParameterInfo p in type_info.Params) + { + plist.Add(p); + } + + foreach (string subtype in type_info.SubTypes) + { + foreach (RpcTypeParameterInfo p in rpc_type_list[subtype].Params) + { + plist.Add(p); + } + } + + w.WriteLine("Name | Type | Descrption"); + w.WriteLine("--- | --- | ---"); + foreach (RpcTypeParameterInfo p in plist) + { + w.WriteLine($"`{p.Name}` | {p.Type} | {p.Description}"); + } + } + + void doc_write_function(StringWriter w, RpcInfo rpc) + { + string func_summary = rpc.Symbol.GetDocumentStr(); + int index = func_summary.IndexOf("."); + if (index != -1) func_summary = func_summary.Substring(0, index + 1); + func_summary = func_summary.TrimEnd('.'); + + w.WriteLine($""); + w.WriteLine($"## \"{rpc.Name}\" RPC API - {func_summary}"); + + w.WriteLine(rpc.Symbol.GetDocumentStr()); + + var model = cs_tests.Model; + + var func = cs_tests.Root.DescendantNodes().OfType() + .Where(f => f.Identifier.Text == "Test_" + rpc.Name) + .Single(); + + var fields = func.DescendantNodes().OfType() + .Where(i => i.Kind() == SyntaxKind.ObjectInitializerExpression) + .SelectMany(o => o.DescendantNodes().OfType()) + .Where(a => a.Kind() == SyntaxKind.SimpleAssignmentExpression) + .Select(a => (a.Left as IdentifierNameSyntax)); + + foreach (var field in fields) + { + string json_name = field.Identifier.Text; + var sym = model.GetSymbolInfo(field); + + var atts = sym.Symbol.GetAttributes(); + var y = atts.Where(x => x.AttributeClass.Name == "JsonPropertyAttribute").FirstOrDefault(); + if (y != null) + { + json_name = y.ConstructorArguments.FirstOrDefault().Value.ToString(); + } + + rpc.InputParamMembers.Add(json_name); + } + + Type obj_type = Type.GetType("SoftEther.VPNServerRpc." + rpc.TypeName); + + object in_object = Activator.CreateInstance(obj_type); + object out_object = Activator.CreateInstance(obj_type); + + JsonRpcRequest rpc_in = new JsonRpcRequest() { Method = rpc.Name, Params = in_object, Id = "rpc_call_id", }; + Type rpc_out_type = typeof(JsonRpcResponse<>).MakeGenericType(obj_type); + var rpc_out = Activator.CreateInstance(rpc_out_type); + + rpc_out_type.GetProperty("Id").SetValue(rpc_out, "rpc_call_id"); + rpc_out_type.GetProperty("Result").SetValue(rpc_out, out_object); + + sample_fill_object(in_object); + sample_fill_object(out_object); + + JsonSerializerSettings rpc_in_settings = new JsonSerializerSettings() + { + MaxDepth = 8, + NullValueHandling = NullValueHandling.Include, + ReferenceLoopHandling = ReferenceLoopHandling.Error, + PreserveReferencesHandling = PreserveReferencesHandling.None, + ContractResolver = new JSonInputContractResolver(rpc), + }; + + JsonSerializerSettings rpc_out_settings = new JsonSerializerSettings() + { + MaxDepth = 8, + NullValueHandling = NullValueHandling.Include, + ReferenceLoopHandling = ReferenceLoopHandling.Error, + PreserveReferencesHandling = PreserveReferencesHandling.None, + ContractResolver = new JSonOutputContractResolver(rpc), + }; + + string in_str = JsonConvert.SerializeObject(rpc_in, Formatting.Indented, rpc_in_settings); + string out_str = JsonConvert.SerializeObject(rpc_out, Formatting.Indented, rpc_out_settings); + + w.WriteLine(); + w.WriteLine("### Input JSON-RPC Format"); + w.WriteLine("```json"); + w.WriteLine(in_str); + w.WriteLine("```"); + + w.WriteLine(); + w.WriteLine("### Output JSON-RPC Format"); + w.WriteLine("```json"); + w.WriteLine(out_str); + w.WriteLine("```"); + + w.WriteLine(); + w.WriteLine("### Parameters"); + w.WriteLine(); + doc_write_parameters(w, rpc_type_list[rpc.TypeName]); + + //w.WriteLine("
"); + w.WriteLine(); + } + + class JSonOutputContractResolver : DefaultContractResolver + { + RpcInfo rpc_info; + + public JSonOutputContractResolver(RpcInfo info) : base() + { + this.rpc_info = info; + } + + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + if (member.Name == "Error") return null; + JsonProperty ret = base.CreateProperty(member, memberSerialization); + return ret; + } + } + + + class JSonInputConverter : JsonConverter + { + RpcInfo rpc_info; + + public JSonInputConverter(RpcInfo info) + { + this.rpc_info = info; + } + + public override bool CanRead => false; + + public override bool CanConvert(Type objectType) + { + return true; + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter w, object value, JsonSerializer serializer) + { + JToken t = JToken.FromObject(value); + List a = new List(); + bool all = false; + if (rpc_info.Name == "SetHubLog") all = true; + + foreach (var p1 in t.Children()) + { + foreach (var p2 in p1.Children()) + { + if (rpc_info.InputParamMembers.Contains(p2.Name) == false) a.Add(p2); + } + if (rpc_info.InputParamMembers.Contains(p1.Name) == false) a.Add(p1); + } + if (all == false) + { + foreach (var p in a) + { + try + { + p.Remove(); + } + catch + { + } + } + } + t.WriteTo(w); + } + } + + class JSonInputContractResolver : DefaultContractResolver + { + RpcInfo rpc_info; + + public JSonInputContractResolver(RpcInfo info) : base() + { + this.rpc_info = info; + } + + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + JsonProperty ret = base.CreateProperty(member, memberSerialization); + ret.Converter = new JSonInputConverter(this.rpc_info); + return ret; + } + } + + void sample_fill_object(object o) + { + Type t = o.GetType(); + + var fields = t.GetFields(); + foreach (var field in fields) + { + Type t2 = field.FieldType; + object v = null; + + if (t2 == typeof(string)) + { + string tmp = field.Name.ToLowerInvariant(); + if (tmp.EndsWith("_str") || tmp.EndsWith("_utf")) tmp = tmp.Substring(0, tmp.Length - 4); + if (tmp.EndsWith("_ip")) + { + if (tmp.IndexOf("mask", StringComparison.InvariantCultureIgnoreCase) == -1) + tmp = "192.168.0.1"; + else + tmp = "255.255.255.255"; + } + v = tmp; + } + else if (t2 == typeof(uint)) + v = (uint)0; + else if (t2 == typeof(ulong)) + v = (ulong)0; + else if (t2 == typeof(bool)) + v = (bool)false; + else if (t2 == typeof(byte[])) + v = Encoding.UTF8.GetBytes("Hello World"); + else if (t2 == typeof(DateTime)) + v = new DateTime(DateTime.Now.Year + 1, 8, 1, 12, 24, 36, 123); + else if (t2.IsEnum) + { + v = (int)0; + } + else if (t2.IsArray) + { + if (t2 == typeof(uint[])) + { + v = new uint[] { 1, 2, 3 }; + } + else + { + if (t2.GetArrayRank() != 1) throw new ApplicationException("Array rank != 1"); + Type obj_type = t2.GetElementType(); + + if (obj_type.IsEnum) + { + v = new int[] { 1, 2, 3 }; + } + else + { + int num = 3; + + if (field.Name.IndexOf("single", StringComparison.CurrentCultureIgnoreCase) != -1) + { + num = 1; + } + + object list = Activator.CreateInstance(typeof(List<>).MakeGenericType(obj_type)); + + for (int i = 0; i < num; i++) + { + object a = Activator.CreateInstance(obj_type); + sample_fill_object(a); + + list.GetType().GetMethod("Add").Invoke(list, new object[] { a }); + } + + v = list.GetType().GetMethod("ToArray").Invoke(list, new object[] { } ); + } + } + } + else if (t2.Name.StartsWith("Vpn")) + { + Type obj_type = Type.GetType("SoftEther.VPNServerRpc." + t2.Name); + v = Activator.CreateInstance(obj_type); + sample_fill_object(v); + } + else + { + throw new ApplicationException($"sample_fill_object: type: {t2.ToString()}"); + } + + field.SetValue(o, v); + } + } + + void generate_documents(GeneratedCodeForLang ret) + { + StringWriter w = new StringWriter(); + + string doc_txt = read_text_resource("doc.txt"); + w.WriteLine(doc_txt); + + w.WriteLine("## Table of contents"); + foreach (RpcInfo rpc in rpc_list.Values) + { + string func_summary = rpc.Symbol.GetDocumentStr(); + int index = func_summary.IndexOf("."); + if (index != -1) func_summary = func_summary.Substring(0, index + 1); + func_summary = func_summary.TrimEnd('.'); + + w.WriteLine($"- [{rpc.Name} - {func_summary}](#{rpc.Name.ToLowerInvariant()})"); + + } + + w.WriteLine(); + w.WriteLine("***"); + + foreach (RpcInfo rpc in rpc_list.Values) + { + doc_write_function(w, rpc); + + w.WriteLine("***"); + } + + w.WriteLine($"Automatically generated at {timestamp.ToString("yyyy-MM-dd HH:mm:ss")} by vpnserver-jsonrpc-codegen. "); + w.WriteLine("Copyright (c) 2014 - " + DateTime.Now.Year + " [SoftEther VPN Project](https://www.softether.org/) under the Apache License 2.0. "); + w.WriteLine(); + + ret.DocsRpc = w.ToString(); + } + + public GeneratedCodeForLang GenerateCodes() + { + GeneratedCodeForLang ret = new GeneratedCodeForLang(); + + generate_stubs(ret); + + generate_tests(ret); + + generate_types(ret); + + generate_documents(ret); + + return ret; + } + + public void GenerateAndSaveCodes(string output_dir) + { + CodeGenUtil.MakeDir(output_dir); + + WriteLine($"GenerateAndSaveCodes(): output_dir = '{output_dir}'"); + WriteLine(); + WriteLine("Generating codes ..."); + GeneratedCodeForLang codes = GenerateCodes(); + WriteLine("Generating codes: done."); + WriteLine(); + + output_docs(codes, output_dir); + + output_csharp(Path.Combine(output_dir, "vpnserver-jsonrpc-client-csharp")); + + output_typescript(codes.TypeScript, Path.Combine(output_dir, "vpnserver-jsonrpc-client-typescript")); + } + + static Assembly this_assembly = Assembly.GetExecutingAssembly(); + static string read_text_resource(string name) + { + var x = this_assembly.GetManifestResourceNames(); + string resourceName = this_assembly.GetManifestResourceNames().Single(str => str.EndsWith(name)); + using (Stream stream = this_assembly.GetManifestResourceStream(resourceName)) + { + using (StreamReader reader = new StreamReader(stream)) + { + return reader.ReadToEnd(); + } + } + } + + static string read_text_file(string name) + { + using (Stream stream = File.OpenRead(name)) + { + using (StreamReader reader = new StreamReader(stream)) + { + return reader.ReadToEnd(); + } + } + } + + static string replace_strings(string src, params string[] replace_list) + { + int i; + for (i = 0; i < replace_list.Length / 2; i++) + { + string s1 = replace_list[i * 2]; + string s2 = replace_list[i * 2 + 1]; + src = src.Replace(s1, s2, StringComparison.InvariantCultureIgnoreCase); + } + return src; + } + + static string normalize_crlf(string src, string crlf) + { + StringReader r = new StringReader(src); + StringWriter w = new StringWriter(); + w.NewLine = crlf; + while (true) + { + string line = r.ReadLine(); + if (line == null) break; + w.WriteLine(line); + } + return w.ToString(); + } + + static void normalize(ref string str, string crlf, params string[] replace_list) + { + str = normalize_crlf(replace_strings(str, replace_list), crlf); + } + + static void save(string path, string body, bool bom) + { + string dir_name = Path.GetDirectoryName(path); + CodeGenUtil.MakeDir(dir_name); + + if (bom) + File.WriteAllText(path, body, Encoding.UTF8); + else + File.WriteAllText(path, body); + } + + DateTime timestamp = DateTime.Now; + + void output_docs(GeneratedCodeForLang c, string output_dir) + { + CodeGenUtil.MakeDir(output_dir); + + save(Path.Combine(output_dir, "README.md"), c.DocsRpc, true); + + var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); + + string md_html_body = Markdown.ToHtml(c.DocsRpc, pipeline); + + string html = read_text_resource("md_html.html"); + + string[] replace_list = + { + "__BODY__", md_html_body, + }; + + normalize(ref html, "\r\n", replace_list); + + save(Path.Combine(output_dir, "README.html"), html, true); + save(Path.Combine(CodeGenUtil.OutputDir_HamCore, "vpnserver_api_doc.html"), html, true); + } + + void output_typescript(GeneratedCode c, string output_dir) + { + CodeGenUtil.MakeDir(output_dir); + + string ts_rpc = read_text_resource("ts_rpc.txt"); + string ts_test = read_text_resource("ts_test.txt"); + + string[] replace_list = + { + "__YEAR__", timestamp.Year.ToString(), + "__TESTS__", c.Tests.ToString(), + "__STUBS__", c.Stubs.ToString(), + "__TYPES__", c.Types.ToString(), + "__TIMESTAMP__", timestamp.ToString("yyyy-MM-dd HH:mm:ss"), + }; + + normalize(ref ts_rpc, "\n", replace_list); + normalize(ref ts_test, "\n", replace_list); + + save(Path.Combine(output_dir, "vpnrpc.ts"), ts_rpc, true); + save(Path.Combine(output_dir, "sample.ts"), ts_test, true); + } + + void output_csharp(string output_dir) + { + CodeGenUtil.MakeDir(output_dir); + + string cs_proj = read_text_resource("cs_proj.txt"); + string cs_sln = read_text_resource("cs_sln.txt"); + string cs_main = read_text_resource("cs_main.txt"); + + string cs_code_jsonrpc = read_text_file(Path.Combine(CodeGenUtil.ProjectDir, + @"VpnServerRpc/JsonRpc.cs")); + + string cs_code_vpnserver_rpc = read_text_file(Path.Combine(CodeGenUtil.ProjectDir, + @"VpnServerRpc/VPNServerRpc.cs")); + + string cs_code_vpnserver_rpc_types = read_text_file(Path.Combine(CodeGenUtil.ProjectDir, + @"VpnServerRpc/VPNServerRpcTypes.cs")); + + string cs_code_vpnserver_rpc_test = read_text_file(Path.Combine(CodeGenUtil.ProjectDir, + @"VpnServerRpcTest/VpnServerRpcTest.cs")); + + string[] replace_list = + { + "__YEAR__", timestamp.Year.ToString(), + "__TIMESTAMP__", timestamp.ToString("yyyy-MM-dd HH:mm:ss"), + }; + + normalize(ref cs_main, "\r\n", replace_list); + normalize(ref cs_proj, "\r\n", replace_list); + normalize(ref cs_sln, "\r\n", replace_list); + normalize(ref cs_code_jsonrpc, "\r\n", replace_list); + normalize(ref cs_code_vpnserver_rpc, "\r\n", replace_list); + normalize(ref cs_code_vpnserver_rpc_types, "\r\n", replace_list); + normalize(ref cs_code_vpnserver_rpc_test, "\r\n", replace_list); + + save(Path.Combine(output_dir, "vpnserver-jsonrpc-client-csharp.csproj"), + cs_proj, true); + + save(Path.Combine(output_dir, "vpnserver-jsonrpc-client-csharp.sln"), + cs_sln, true); + + save(Path.Combine(output_dir, @"rpc-stubs\JsonRpc.cs"), + cs_code_jsonrpc, true); + + save(Path.Combine(output_dir, @"rpc-stubs\VPNServerRpc.cs"), + cs_code_vpnserver_rpc, true); + + save(Path.Combine(output_dir, @"rpc-stubs\VPNServerRpcTypes.cs"), + cs_code_vpnserver_rpc_types, true); + + save(Path.Combine(output_dir, @"sample\VpnServerRpcTest.cs"), + cs_code_vpnserver_rpc_test, true); + + save(Path.Combine(output_dir, @"sample\Main.cs"), + cs_main, true); + } + + public void Test() + { + GeneratedCodeForLang ret = GenerateCodes(); + + Console.WriteLine(ret.TypeScript.ToString()); + + return; + var model = cs_types.Model; + + var type_classes = cs_types.Root.DescendantNodes() + .OfType(); + + foreach (ClassDeclarationSyntax v in type_classes) + { + WriteLine(v.Identifier.Text); + + var info = model.GetDeclaredSymbol(v); + + var x = info.GetMembers(); + + foreach (var y in x) + { + WriteLine(y.Name); + } + + break; + } + + Console.WriteLine(); + } + } +} diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Program.cs b/developer_tools/vpnserver-jsonrpc-codegen/Program.cs new file mode 100644 index 00000000..203860dd --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.Diagnostics; +using Newtonsoft.Json; +using SoftEther.VPNServerRpc; +using System.Text; +using SoftEther.JsonRpc; + + +namespace VPNServer_JSONRPC_CodeGen +{ + class Program + { + static void Main(string[] args) + { + string output_dir = CodeGenUtil.OutputDir_Clients; + + try + { + Directory.CreateDirectory(output_dir); + } + catch + { + } + + CodeGen g = new CodeGen(); + + g.GenerateAndSaveCodes(output_dir); + } + } +} + + + + + + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt new file mode 100644 index 00000000..a73d31ac --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt @@ -0,0 +1,17 @@ +// SoftEther VPN Server JSON-RPC Stub code for C# +// +// Program.cs - The Main() entry point +// +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +class Program +{ + static void Main(string[] args) + { + VPNRPCTest test = new VPNRPCTest(); + test.Test_All(); + } +} diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt new file mode 100644 index 00000000..6d97ba0c --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt @@ -0,0 +1,14 @@ + + + + Exe + netcoreapp2.1 + SoftEther.VPNServerRpc + + + + + + + + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_sln.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_sln.txt new file mode 100644 index 00000000..8cef1417 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_sln.txt @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2041 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vpnserver-jsonrpc-client-csharp", "vpnserver-jsonrpc-client-csharp.csproj", "{81CA3EC4-026E-4D37-9889-828186BBB8C0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D87E5CF1-9A10-431C-AC42-F1041470AEE8} + EndGlobalSection +EndGlobal diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt new file mode 100644 index 00000000..6d4888b5 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt @@ -0,0 +1,34 @@ +# SoftEther VPN Server JSON-RPC Document +This reference describes all JSON-RPC functions available on SoftEther VPN Server. + + +Please note that you can use [SoftEther VPN Server JSON-RPC Client Library](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/) to call these APIs easily instead of calling JSON through HTTPS. + + +## Principle + +### Entry point +The entry point URL of JSON-RPC is: +``` +https://:/api/ +``` + +### JSON-RPC specification +You must use HTTPS 1.1 `POST` method to call each of JSON-RPC APIs. +All APIs are based on the [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification). + - JSON-RPC Notification is not supported. + - JSON-RPC Batch is not supported. + +### Authentication +You must specify the following HTTPS custom headers for authentication on each of requests. + + +Value | Description +--- | --- +`X-VPNADMIN-HUBNAME` | The name of the Virtual Hub if you want to connect to the VPN Server as a Virtual Hub Admin Mode. Specify empty string if you want to connect to the VPN Server as the Entire VPN Server Admin Mode. +`X-VPNADMIN-PASSWORD` | Specify the administration password. + + +- You can omit the above HTTPS custom authentication headers if you are calling JSON-RPC APIs from the web browser which is already logged in to the VPN Server with HTTPS Basic Authentication. In such usage the credential of HTTPS Basic Authtication will be used. + +*** diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html b/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html new file mode 100644 index 00000000..341f7038 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html @@ -0,0 +1,16 @@ + + + + + SoftEther VPN Server JSON-RPC Document + + + + + + +
+__BODY__ +
+ + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt new file mode 100644 index 00000000..572cadb2 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt @@ -0,0 +1,576 @@ +// SoftEther VPN Server JSON-RPC Stub code for TypeScript +// +// vpnrpc.ts +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + + +// Trivial utility codes +let is_node_js = (typeof navigator === "undefined") || navigator.userAgent.indexOf("Node.js") !== -1 || navigator.userAgent.indexOf("jsdom") !== -1; +function is_null(obj: any) +{ + return (typeof obj === "undefined") || (obj === null); +} +let debug_mode: boolean = false; + +/** VPN Server RPC Stubs */ +export class VpnServerRpc +{ + /** Determine if this JavaScript environment is on the Node.js or not. */ + public static IsNodeJS(): boolean + { + return is_node_js; + } + + /** Set the debug mode flag */ + public static SetDebugMode(flag: boolean): void + { + debug_mode = flag; + } + + private rpc_url: string; + private rpc_client: JsonRpcClient; + + /** + * Constructor of the VpnServerRpc class + * @param vpnserver_hostname The hostname or IP address of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself. + * @param vpnserver_port The port number of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself. + * @param hubname The name of the Virtual Hub if you want to connect to the VPN Server as a Virtual Hub Admin Mode. Specify null if you want to connect to the VPN Server as the Entire VPN Server Admin Mode. + * @param password Specify the administration password. This value is valid only if vpnserver_hostname is sepcified. + * @param nodejs_https_client_reject_untrusted_server_cert In Node.js set this true to check the SSL server certificate on the destination VPN Server. Set this false to ignore the SSL server certification. + */ + constructor(vpnserver_hostname?: string, vpnserver_port?: number, hubname?: string, password?: string, nodejs_https_client_reject_untrusted_server_cert?: boolean) + { + let headers: { [name: string]: string } = {}; + let send_credentials: boolean = false; + + nodejs_https_client_reject_untrusted_server_cert = is_null(nodejs_https_client_reject_untrusted_server_cert) ? false : nodejs_https_client_reject_untrusted_server_cert!; + + if (is_null(vpnserver_hostname)) + { + this.rpc_url = "/api/"; + send_credentials = true; + } + else + { + if (is_null(vpnserver_port)) vpnserver_port = 443; + this.rpc_url = `https://${vpnserver_hostname}:${vpnserver_port}/api/`; + + + headers["X-VPNADMIN-HUBNAME"] = is_null(hubname) ? "" : hubname!; + headers["X-VPNADMIN-PASSWORD"] = is_null(password) ? "" : password!; + } + + if (is_null(nodejs_https_client_reject_untrusted_server_cert)) nodejs_https_client_reject_untrusted_server_cert = false; + + this.rpc_client = new JsonRpcClient(this.rpc_url, headers, send_credentials, nodejs_https_client_reject_untrusted_server_cert); + } + + // --- Stubs --- +__STUBS__ + + // -- Utility functions -- + /** Call a RPC procedure */ + public async CallAsync(method_name: string, request: T): Promise + { + let response: T = await this.rpc_client.CallAsync(method_name, request); + + return response; + } +} + + + + +// --- Types --- +__TYPES__ + + + +// --- Utility codes --- + +/** JSON-RPC request class. See https://www.jsonrpc.org/specification */ +export class JsonRpcRequest +{ + public jsonrpc: string = "2.0"; + public method: string; + public params: any; + public id: string; + + constructor(method: string = "", param: any = null, id: string = "") + { + this.method = method; + this.params = param; + this.id = id; + } +} + +/** JSON-RPC error class. See https://www.jsonrpc.org/specification */ +export class JsonRpcError +{ + public code: number; + public message: string; + public data: any; + + constructor(code: number = 0, message: string = "", data: any = null) + { + this.code = code; + this.message = message; + this.data = data; + } +} + +/** JSON-RPC response class with generics */ +export class JsonRpcResponse +{ + public jsonrpc: string = "2.0"; + public result: TResult = null!; + public error: JsonRpcError = null!; + public id: string = ""; +} + +/** JSON-RPC client class. See https://www.jsonrpc.org/specification */ +export class JsonRpcClient +{ + /** A utility function to convert any object to JSON string */ + public static ObjectToJson(obj: any): string + { + return JSON.stringify(obj, + (key, value) => + { + if (key.endsWith("_bin")) + { + return Util_Base64_Encode(value); + } + return value; + } + , 4); + } + + /** A utility function to convert JSON string to object */ + public static JsonToObject(str: string): any + { + return JSON.parse(str, + (key, value) => + { + if (key.endsWith("_bin")) + { + return Util_Base64_Decode(value); + } + else if (key.endsWith("_dt")) + { + return new Date(value); + } + return value; + }); + } + + /** Base URL */ + public BaseUrl: string; + + /** The instance of HTTP client */ + private client: HttpClient; + + /** Additional HTTP headers */ + private headers: { [name: string]: string }; + + /** + * JSON-RPC client class constructor + * @param url The URL + * @param headers Additional HTTP headers + * @param send_credential Set true to use the same credential with the browsing web site. Valid only if the code is running on the web browser. + */ + constructor(url: string, headers: { [name: string]: string }, send_credential: boolean, nodejs_https_client_reject_untrusted_server_cert: boolean) + { + this.BaseUrl = url; + this.headers = headers; + + this.client = new HttpClient(); + this.client.SendCredential = send_credential; + this.client.NodeJS_HTTPS_Client_Reject_Unauthorized = nodejs_https_client_reject_untrusted_server_cert; + } + + /** + * Call a single RPC call (without error check). You can wait for the response with Promise or await statement. + * @param method_name The name of RPC method + * @param param The parameters + */ + public async CallInternalAsync(method_name: string, param: any): Promise + { + let id = "1"; + + let req = new JsonRpcRequest(method_name, param, id); + + let req_string = JsonRpcClient.ObjectToJson(req); + + if (debug_mode) + { + console.log("--- RPC Request Body ---"); + console.log(req_string); + console.log("------------------------"); + } + + let http_response = await this.client.PostAsync(this.BaseUrl, this.headers, + req_string, "application/json"); + + let ret_string = http_response.Body; + + if (debug_mode) + { + console.log("--- RPC Response Body ---"); + console.log(ret_string); + console.log("-------------------------"); + } + + return ret_string; + } + + /** + * Call a single RPC call (with error check). You can wait for the response with Promise or await statement. In the case of error, it will be thrown. + * @param method_name The name of RPC method + * @param param The parameters + */ + public async CallAsync(method_name: string, param: any): Promise + { + let ret_string = await this.CallInternalAsync(method_name, param); + + let ret: JsonRpcResponse = JSON.parse(ret_string); + + if (is_null(ret.error) === false) + { + throw new JsonRpcException(ret.error); + } + + return ret.result; + } +} + +/** JSON-RPC exception class */ +export class JsonRpcException extends Error +{ + public Error: JsonRpcError; + + constructor(error: JsonRpcError) + { + super(`Code=${error.code}, Message=${error.message}`); + this.Error = error; + } +} + +/** HTTP client exception class */ +export class HttpClientException extends Error +{ + constructor(message: string) + { + super(message); + } +} + +/** HTTP client response class */ +export class HttpClientResponse +{ + public Body: string = ""; +} + +/** An HTTP client which can be used in both web browsers and Node.js */ +export class HttpClient +{ + public TimeoutMsecs: number = 60 * 5 * 1000; + public SendCredential: boolean = true; + public NodeJS_HTTPS_Client_Reject_Unauthorized: boolean = false; + + /** Post method. In web browsers this function will process the request by itself. In Node.js this function will call PostAsync_NodeJS() instead. */ + public async PostAsync(url: string, headers: { [name: string]: string }, + req_body: string, req_media_type: string): Promise + { + if (is_node_js) + { + return this.PostAsync_NodeJS(url, headers, req_body, req_media_type); + } + + let fetch_header_list = new Headers(); + + for (let name of Object.keys(headers)) + { + fetch_header_list.append(name, headers[name]); + } + + let fetch_init: RequestInit = + { + mode: "cors", + headers: fetch_header_list, + credentials: (this.SendCredential ? "include" : "omit"), + method: "POST", + cache: "no-cache", + keepalive: true, + redirect: "follow", + body: req_body, + }; + + let fetch_response = await fetch(url, fetch_init); + + if (fetch_response.ok === false) + { + throw new HttpClientException("HTTP Error: " + fetch_response.status + " " + fetch_response.statusText); + } + + let ret = new HttpClientResponse(); + + ret.Body = await fetch_response.text(); + + return ret; + } + + /** Post method for Node.js. */ + public PostAsync_NodeJS(url: string, headers: { [name: string]: string }, + req_body: string, req_media_type: string): Promise + { + const https = require("https"); + const keepAliveAgent = new https.Agent({ keepAlive: true }); + const urlparse = require("url"); + + const urlobj = urlparse.parse(url); + + if (is_null(urlobj.host)) throw new Error("URL is invalid."); + + let options = + { + host: urlobj.hostname, + port: urlobj.port, + path: urlobj.path, + rejectUnauthorized: this.NodeJS_HTTPS_Client_Reject_Unauthorized, + method: "POST", + timeout: this.TimeoutMsecs, + agent: keepAliveAgent, + }; + + return new Promise(function (resolve, reject) + { + let req = https.request(options, (res: any) => + { + if (res.statusCode !== 200) + { + reject(new HttpClientException("HTTP Error: " + res.statusCode + " " + res.statusMessage)); + } + + let recv_str: string = ""; + + res.on("data", (body: any) => + { + recv_str += body; + }); + + res.on("end", () => + { + let ret = new HttpClientResponse(); + + ret.Body = recv_str; + + resolve(ret); + }); + }).on("error", (err: any) => + { + throw err; + } + ); + + for (let name of Object.keys(headers)) + { + req.setHeader(name, !is_null(headers[name]) ? headers[name] : ""); + } + req.setHeader("Content-Type", req_media_type); + req.setHeader("Content-Length", Buffer.byteLength(req_body)); + req.write(req_body); + req.end(); + }); + } +} + + + + +//////// BEGIN: Base64 encode / decode utility functions from https://github.com/beatgammit/base64-js +// The MIT License(MIT) +// Copyright(c) 2014 +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +var lookup: any = []; +var revLookup: any = []; + +var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +for (var i = 0, len = code.length; i < len; ++i) +{ + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup["-".charCodeAt(0)] = 62; +revLookup["_".charCodeAt(0)] = 63; + +function getLens(b64: any) +{ + var len = b64.length; + + if (len % 4 > 0) + { + throw new Error("Invalid string. Length must be a multiple of 4"); + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf("="); + if (validLen === -1) validLen = len; + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4); + + return [validLen, placeHoldersLen]; +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength(b64: any) +{ + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen; +} + +function _byteLength(b64: any, validLen: any, placeHoldersLen: any) +{ + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen; +} + +export function Util_Base64_Decode(b64: any) +{ + var tmp; + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + + var arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen)); + + var curByte = 0; + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen; + + for (var i = 0; i < len; i += 4) + { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)]; + arr[curByte++] = (tmp >> 16) & 0xFF; + arr[curByte++] = (tmp >> 8) & 0xFF; + arr[curByte++] = tmp & 0xFF; + } + + if (placeHoldersLen === 2) + { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4); + arr[curByte++] = tmp & 0xFF; + } + + if (placeHoldersLen === 1) + { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2); + arr[curByte++] = (tmp >> 8) & 0xFF; + arr[curByte++] = tmp & 0xFF; + } + + return arr; +} + +function tripletToBase64(num: any) +{ + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F]; +} + +function encodeChunk(uint8: any, start: any, end: any) +{ + var tmp; + var output = []; + for (var i = start; i < end; i += 3) + { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF); + output.push(tripletToBase64(tmp)); + } + return output.join(""); +} + +export function Util_Base64_Encode(uint8: any) +{ + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) + { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )); + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) + { + tmp = uint8[len - 1]; + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + "==" + ); + } else if (extraBytes === 2) + { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + "=" + ); + } + + return parts.join(""); +} +//////// END: Base64 encode / decode utility functions from https://github.com/beatgammit/base64-js + + + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt new file mode 100644 index 00000000..a265ab04 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt @@ -0,0 +1,48 @@ +// Test sample code for SoftEther VPN Server JSON-RPC Stub +// Runs on both web browsers and Node.js +// +// sample.ts +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// This sample code shows how to call all available RPC functions. +// You can copy and paste test code to write your own web browser TypeScript / JavaScript codes. +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +// On the web browser uncomment below imports as necessary to support old browsers. +// import "core-js/es6/promise"; +// import "core-js/es6/string"; +// import "whatwg-fetch"; + + +// Import the vpnrpc.ts RPC stub. +import * as VPN from "./vpnrpc"; + +// Output JSON-RPC request / reply strings to the debug console. +VPN.VpnServerRpc.SetDebugMode(true); + +let api: VPN.VpnServerRpc; +// Creating the VpnServerRpc class instance here. +if (VPN.VpnServerRpc.IsNodeJS() === false) // // Determine if this JavaScript environment is on the Node.js or not +{ + // On the web browser. We do not need to specify any hostname, port or credential as the web browser already knows it. + api = new VPN.VpnServerRpc(); +} +else +{ + // On the Node.js. We need to specify the target VPN Server's hostname, port and credential. + api = new VPN.VpnServerRpc("127.0.0.1", 443, "", "PASSWORD_HERE", false); +} + +// A variable for test +let hub_name = "test"; + +// Call the Test_All() function to test almost all VPN APIs. +Test_All(); + + + +__TESTS__ + + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs new file mode 100644 index 00000000..d7ee166b --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs @@ -0,0 +1,282 @@ +// SoftEther VPN Server JSON-RPC Stub code for C# +// +// JsonRpc.cs - JSON-RPC Client Utility Functions +// +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +using System; +using System.IO; +using System.Net.Security; +using System.Net.Http; +using System.Collections.Generic; +using System.Text; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace SoftEther.JsonRpc +{ + /// + /// Internal utility class + /// + static class ClientUtil + { + public const int DefaultMaxDepth = 8; + + public static string NonNull(this string s) { if (s == null) return ""; else return s; } + public static bool IsEmpty(this string str) + { + if (str == null || str.Trim().Length == 0) + return true; + else + return false; + } + public static bool IsFilled(this string str) => !IsEmpty(str); + + public static string ObjectToJson(this object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false) => ClientUtil.Serialize(obj, include_null, escape_html, max_depth, compact, reference_handling); + public static T JsonToObject(this string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize(str, include_null, max_depth); + public static object JsonToObject(this string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize(str, type, include_null, max_depth); + + public static string Serialize(object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false) + { + JsonSerializerSettings setting = new JsonSerializerSettings() + { + MaxDepth = max_depth, + NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore, + ReferenceLoopHandling = ReferenceLoopHandling.Error, + PreserveReferencesHandling = reference_handling ? PreserveReferencesHandling.All : PreserveReferencesHandling.None, + StringEscapeHandling = escape_html ? StringEscapeHandling.EscapeHtml : StringEscapeHandling.Default, + }; + return JsonConvert.SerializeObject(obj, compact ? Formatting.None : Formatting.Indented, setting); + } + + public static T Deserialize(string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) + => (T)Deserialize(str, typeof(T), include_null, max_depth); + + public static object Deserialize(string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) + { + JsonSerializerSettings setting = new JsonSerializerSettings() + { + MaxDepth = max_depth, + NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore, + ObjectCreationHandling = ObjectCreationHandling.Replace, + ReferenceLoopHandling = ReferenceLoopHandling.Error, + }; + return JsonConvert.DeserializeObject(str, type, setting); + } + + public static void Print(this object o) + { + string str = o.ObjectToJson(); + + if (o is string) str = (string)o; + + Console.WriteLine(str); + } + } + + /// + /// JSON-RPC exception class + /// + class JsonRpcException : Exception + { + public JsonRpcError RpcError { get; } + public JsonRpcException(JsonRpcError err) + : base($"Code={err.Code}, Message={err.Message.NonNull()}" + + (err == null || err.Data == null ? "" : $", Data={err.Data.ObjectToJson(compact: true)}")) + { + this.RpcError = err; + } + } + + /// + /// JSON-RPC request class. See https://www.jsonrpc.org/specification + /// + class JsonRpcRequest + { + [JsonProperty("jsonrpc", Order = 1)] + public string Version { get; set; } = "2.0"; + + [JsonProperty("id", Order = 2)] + public string Id { get; set; } = null; + + [JsonProperty("method", Order = 3)] + public string Method { get; set; } = ""; + + [JsonProperty("params", Order = 4)] + public object Params { get; set; } = null; + + public JsonRpcRequest() { } + + public JsonRpcRequest(string method, object param, string id) + { + this.Method = method; + this.Params = param; + this.Id = id; + } + } + + /// + /// JSON-RPC response class with generics + /// + /// + class JsonRpcResponse + { + [JsonProperty("jsonrpc", Order = 1)] + public virtual string Version { get; set; } = "2.0"; + + [JsonProperty("id", NullValueHandling = NullValueHandling.Include, Order = 2)] + public virtual string Id { get; set; } = null; + + [JsonProperty("result", Order = 3)] + public virtual TResult Result { get; set; } = default(TResult); + + [JsonProperty("error", Order = 4)] + public virtual JsonRpcError Error { get; set; } = null; + + [JsonIgnore] + public virtual bool IsError => this.Error != null; + + [JsonIgnore] + public virtual bool IsOk => !IsError; + + public virtual void ThrowIfError() + { + if (this.IsError) throw new JsonRpcException(this.Error); + } + + public override string ToString() + { + return this.ObjectToJson(compact: true); + } + } + + /// + /// JSON-RPC error class. See https://www.jsonrpc.org/specification + /// + class JsonRpcError + { + public JsonRpcError() { } + public JsonRpcError(int code, string message, object data = null) + { + this.Code = code; + this.Message = message.NonNull(); + if (this.Message.IsEmpty()) this.Message = $"JSON-RPC Error {code}"; + this.Data = data; + } + + [JsonProperty("code")] + public int Code { get; set; } = 0; + + [JsonProperty("message")] + public string Message { get; set; } = null; + + [JsonProperty("data")] + public object Data { get; set; } = null; + } + + /// + /// JSON-RPC client. See https://www.jsonrpc.org/specification + /// + class JsonRpcClient + { + HttpClientHandler client_handler; + HttpClient client; + public const int DefaultTimeoutMsecs = 60 * 1000; + public int TimeoutMsecs { get => (int)client.Timeout.TotalMilliseconds; set => client.Timeout = new TimeSpan(0, 0, 0, 0, value); } + public Dictionary HttpHeaders { get; } = new Dictionary(); + + string base_url; + + /// + /// JSON-RPC client class constructor + /// + /// The URL + /// The SSL certificate validation callback + public JsonRpcClient(string url, Func cert_check_proc = null) + { + if (cert_check_proc == null) cert_check_proc = (message, cert, chain, errors) => true; + client_handler = new HttpClientHandler(); + + this.client_handler.AllowAutoRedirect = true; + this.client_handler.MaxAutomaticRedirections = 10; + + client_handler.ServerCertificateCustomValidationCallback = cert_check_proc; + + client = new HttpClient(client_handler, true); + //Console.WriteLine("new HttpClient(client_handler, true);"); + + this.base_url = url; + + this.TimeoutMsecs = DefaultTimeoutMsecs; + } + + /// + /// Call a single RPC call (without error check). You can wait for the response with Task or await statement. + /// + /// The name of RPC method + /// The parameters + public async Task CallInternalAsync(string method_name, object param) + { + string id = DateTime.Now.Ticks.ToString(); + + JsonRpcRequest req = new JsonRpcRequest(method_name, param, id); + + string req_string = req.ObjectToJson(); + + //Console.WriteLine($"req: {req_string}"); + + HttpContent content = new StringContent(req_string, Encoding.UTF8, "application/json"); + + foreach (string key in this.HttpHeaders.Keys) + { + string value = this.HttpHeaders[key]; + + content.Headers.Add(key, value); + } + + HttpResponseMessage response = await this.client.PostAsync(base_url, content); + + Stream responseStream = await response.Content.ReadAsStreamAsync(); + + if (!response.IsSuccessStatusCode) + { + using (StreamReader streamReader = new StreamReader(responseStream)) + { + throw new Exception($"Error: {response.StatusCode}: {await streamReader.ReadToEndAsync()}"); + } + } + + string ret_string; + + using (StreamReader streamReader = new StreamReader(responseStream)) + { + ret_string = await streamReader.ReadToEndAsync(); + } + + //Console.WriteLine($"ret: {ret_string}"); + + return ret_string; + } + + /// + /// Call a single RPC call (with error check). You can wait for the response with Promise or await statement. In the case of error, it will be thrown. + /// + /// The name of RPC method + /// The parameters + public async Task CallAsync(string method_name, object param) + { + string ret_string = await CallInternalAsync(method_name, param); + + JsonRpcResponse ret = ret_string.JsonToObject>(); + + ret.ThrowIfError(); + + return ret.Result; + } + } +} + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs new file mode 100644 index 00000000..63da0e6d --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs @@ -0,0 +1,1399 @@ +// SoftEther VPN Server JSON-RPC Stub code for C# +// +// VPNServerRpc.cs - SoftEther VPN Server's JSON-RPC Stubs +// +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +using System.Threading.Tasks; +using SoftEther.JsonRpc; + +namespace SoftEther.VPNServerRpc +{ + /// + /// VPN Server RPC Stubs + /// + public class VpnServerRpc + { + JsonRpcClient rpc_client; + + /// + /// Constructor of the VpnServerRpc class + /// + /// The hostname or IP address of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself. + /// The port number of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself. + /// Specify the administration password. This value is valid only if vpnserver_hostname is sepcified. + /// The name of the Virtual Hub if you want to connect to the VPN Server as a Virtual Hub Admin Mode. Specify null if you want to connect to the VPN Server as the Entire VPN Server Admin Mode. + public VpnServerRpc(string vpnserver_host, int vpnserver_port, string admin_password, string hub_name = null) + { + rpc_client = new JsonRpcClient($"https://{vpnserver_host}:{vpnserver_port}/api/", null); + + rpc_client.HttpHeaders.Add("X-VPNADMIN-HUBNAME", string.IsNullOrEmpty(hub_name) ? "" : hub_name); + rpc_client.HttpHeaders.Add("X-VPNADMIN-PASSWORD", admin_password); + } + + /// + /// Call a RPC procedure + /// + public async Task CallAsync(string method_name, T request) + { + T response = await rpc_client.CallAsync(method_name, request); + + return response; + } + + /// + /// Test RPC function (Async mode). Input any integer value to the IntValue_u32 field. Then the server will convert the integer to the string, and return the string in the StrValue_str field. + /// + public async Task TestAsync(VpnRpcTest t) => await CallAsync("Test", t); + + /// + /// Test RPC function (Sync mode). Input any integer value to the IntValue_u32 field. Then the server will convert the integer to the string, and return the string in the StrValue_str field. + /// + public VpnRpcTest Test(VpnRpcTest t) => TestAsync(t).Result; + + /// + /// Get server information (Async mode). This allows you to obtain the server information of the currently connected VPN Server or VPN Bridge. Included in the server information are the version number, build number and build information. You can also obtain information on the current server operation mode and the information of operating system that the server is operating on. + /// + public async Task GetServerInfoAsync() => await CallAsync("GetServerInfo", new VpnRpcServerInfo()); + + /// + /// Get server information (Sync mode). This allows you to obtain the server information of the currently connected VPN Server or VPN Bridge. Included in the server information are the version number, build number and build information. You can also obtain information on the current server operation mode and the information of operating system that the server is operating on. + /// + public VpnRpcServerInfo GetServerInfo() => GetServerInfoAsync().Result; + + /// + /// Get Current Server Status (Async mode). This allows you to obtain in real-time the current status of the currently connected VPN Server or VPN Bridge. You can get statistical information on data communication and the number of different kinds of objects that exist on the server. You can get information on how much memory is being used on the current computer by the OS. + /// + public async Task GetServerStatusAsync() => await CallAsync("GetServerStatus", new VpnRpcServerStatus()); + + /// + /// Get Current Server Status (Sync mode). This allows you to obtain in real-time the current status of the currently connected VPN Server or VPN Bridge. You can get statistical information on data communication and the number of different kinds of objects that exist on the server. You can get information on how much memory is being used on the current computer by the OS. + /// + public VpnRpcServerStatus GetServerStatus() => GetServerStatusAsync().Result; + + /// + /// Create New TCP Listener (Async mode). This allows you to create a new TCP Listener on the server. By creating the TCP Listener the server starts listening for a connection from clients at the specified TCP/IP port number. A TCP Listener that has been created can be deleted by the DeleteListener API. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To execute this API, you must have VPN Server administrator privileges. + /// + public async Task CreateListenerAsync(VpnRpcListener t) => await CallAsync("CreateListener", t); + + /// + /// Create New TCP Listener (Sync mode). This allows you to create a new TCP Listener on the server. By creating the TCP Listener the server starts listening for a connection from clients at the specified TCP/IP port number. A TCP Listener that has been created can be deleted by the DeleteListener API. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To execute this API, you must have VPN Server administrator privileges. + /// + public VpnRpcListener CreateListener(VpnRpcListener t) => CreateListenerAsync(t).Result; + + /// + /// Get List of TCP Listeners (Async mode). This allows you to get a list of TCP listeners registered on the current server. You can obtain information on whether the various TCP listeners have a status of operating or error. To call this API, you must have VPN Server administrator privileges. + /// + public async Task EnumListenerAsync() => await CallAsync("EnumListener", new VpnRpcListenerList()); + + /// + /// Get List of TCP Listeners (Async mode). This allows you to get a list of TCP listeners registered on the current server. You can obtain information on whether the various TCP listeners have a status of operating or error. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcListenerList EnumListener() => EnumListenerAsync().Result; + + /// + /// Delete TCP Listener (Async mode). This allows you to delete a TCP Listener that's registered on the server. When the TCP Listener is in a state of operation, the listener will automatically be deleted when its operation stops. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task DeleteListenerAsync(VpnRpcListener t) => await CallAsync("DeleteListener", t); + + /// + /// Delete TCP Listener (Async mode). This allows you to delete a TCP Listener that's registered on the server. When the TCP Listener is in a state of operation, the listener will automatically be deleted when its operation stops. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcListener DeleteListener(VpnRpcListener t) => DeleteListenerAsync(t).Result; + + /// + /// Enable / Disable TCP Listener (Async mode). This starts or stops the operation of TCP Listeners registered on the current server. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task EnableListenerAsync(VpnRpcListener t) => await CallAsync("EnableListener", t); + + /// + /// Enable / Disable TCP Listener (Async mode). This starts or stops the operation of TCP Listeners registered on the current server. You can also get a list of TCP Listeners currently registered by using the EnumListener API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcListener EnableListener(VpnRpcListener t) => EnableListenerAsync(t).Result; + + /// + /// Set VPN Server Administrator Password (Async mode). This sets the VPN Server administrator password. You can specify the password as a parameter. To call this API, you must have VPN Server administrator privileges. + /// + public async Task SetServerPasswordAsync(VpnRpcSetPassword t) => await CallAsync("SetServerPassword", t); + + /// + /// Set VPN Server Administrator Password (Async mode). This sets the VPN Server administrator password. You can specify the password as a parameter. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcSetPassword SetServerPassword(VpnRpcSetPassword t) => SetServerPasswordAsync(t).Result; + + /// + /// Set the VPN Server clustering configuration (Async mode). Use this to set the VPN Server type as Standalone Server, Cluster Controller Server or Cluster Member Server. Standalone server means a VPN Server that does not belong to any cluster in its current state. When VPN Server is installed, by default it will be in standalone server mode. Unless you have particular plans to configure a cluster, we recommend the VPN Server be operated in standalone mode. A cluster controller is the central computer of all member servers of a cluster in the case where a clustering environment is made up of multiple VPN Servers. Multiple cluster members can be added to the cluster as required. A cluster requires one computer to serve this role. The other cluster member servers that are configured in the same cluster begin operation as a cluster member by connecting to the cluster controller. To call this API, you must have VPN Server administrator privileges. Also, when this API is executed, VPN Server will automatically restart. This API cannot be called on VPN Bridge. + /// + public async Task SetFarmSettingAsync(VpnRpcFarm t) => await CallAsync("SetFarmSetting", t); + + /// + /// Set the VPN Server clustering configuration (Async mode). Use this to set the VPN Server type as Standalone Server, Cluster Controller Server or Cluster Member Server. Standalone server means a VPN Server that does not belong to any cluster in its current state. When VPN Server is installed, by default it will be in standalone server mode. Unless you have particular plans to configure a cluster, we recommend the VPN Server be operated in standalone mode. A cluster controller is the central computer of all member servers of a cluster in the case where a clustering environment is made up of multiple VPN Servers. Multiple cluster members can be added to the cluster as required. A cluster requires one computer to serve this role. The other cluster member servers that are configured in the same cluster begin operation as a cluster member by connecting to the cluster controller. To call this API, you must have VPN Server administrator privileges. Also, when this API is executed, VPN Server will automatically restart. This API cannot be called on VPN Bridge. + /// + public VpnRpcFarm SetFarmSetting(VpnRpcFarm t) => SetFarmSettingAsync(t).Result; + + /// + /// Get Clustering Configuration of Current VPN Server (Async mode). You can use this to acquire the clustering configuration of the current VPN Server. To call this API, you must have VPN Server administrator privileges. + /// + public async Task GetFarmSettingAsync() => await CallAsync("GetFarmSetting", new VpnRpcFarm()); + + /// + /// Get Clustering Configuration of Current VPN Server (Async mode). You can use this to acquire the clustering configuration of the current VPN Server. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcFarm GetFarmSetting() => GetFarmSettingAsync().Result; + + /// + /// Get Cluster Member Information (Async mode). When the VPN Server is operating as a cluster controller, you can get information on cluster member servers on that cluster by specifying the IDs of the member servers. You can get the following information about the specified cluster member server: Server Type, Time Connection has been Established, IP Address, Host Name, Points, Public Port List, Number of Operating Virtual Hubs, First Virtual Hub, Number of Sessions and Number of TCP Connections. This API cannot be invoked on VPN Bridge. + /// + public async Task GetFarmInfoAsync(VpnRpcFarmInfo t) => await CallAsync("GetFarmInfo", t); + + /// + /// Get Cluster Member Information (Async mode). When the VPN Server is operating as a cluster controller, you can get information on cluster member servers on that cluster by specifying the IDs of the member servers. You can get the following information about the specified cluster member server: Server Type, Time Connection has been Established, IP Address, Host Name, Points, Public Port List, Number of Operating Virtual Hubs, First Virtual Hub, Number of Sessions and Number of TCP Connections. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcFarmInfo GetFarmInfo(VpnRpcFarmInfo t) => GetFarmInfoAsync(t).Result; + + /// + /// Get List of Cluster Members (Async mode). Use this API when the VPN Server is operating as a cluster controller to get a list of the cluster member servers on the same cluster, including the cluster controller itself. For each member, the following information is also listed: Type, Connection Start, Host Name, Points, Number of Session, Number of TCP Connections, Number of Operating Virtual Hubs, Using Client Connection License and Using Bridge Connection License. This API cannot be invoked on VPN Bridge. + /// + public async Task EnumFarmMemberAsync() => await CallAsync("EnumFarmMember", new VpnRpcEnumFarm()); + + /// + /// Get List of Cluster Members (Async mode). Use this API when the VPN Server is operating as a cluster controller to get a list of the cluster member servers on the same cluster, including the cluster controller itself. For each member, the following information is also listed: Type, Connection Start, Host Name, Points, Number of Session, Number of TCP Connections, Number of Operating Virtual Hubs, Using Client Connection License and Using Bridge Connection License. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcEnumFarm EnumFarmMember() => EnumFarmMemberAsync().Result; + + /// + /// Get Connection Status to Cluster Controller (Async mode). Use this API when the VPN Server is operating as a cluster controller to get the status of connection to the cluster controller. You can get the following information: Controller IP Address, Port Number, Connection Status, Connection Start Time, First Connection Established Time, Current Connection Established Time, Number of Connection Attempts, Number of Successful Connections, Number of Failed Connections. This API cannot be invoked on VPN Bridge. + /// + public async Task GetFarmConnectionStatusAsync() => await CallAsync("GetFarmConnectionStatus", new VpnRpcFarmConnectionStatus()); + + /// + /// Get Connection Status to Cluster Controller (Sync mode). Use this API when the VPN Server is operating as a cluster controller to get the status of connection to the cluster controller. You can get the following information: Controller IP Address, Port Number, Connection Status, Connection Start Time, First Connection Established Time, Current Connection Established Time, Number of Connection Attempts, Number of Successful Connections, Number of Failed Connections. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcFarmConnectionStatus GetFarmConnectionStatus() => GetFarmConnectionStatusAsync().Result; + + /// + /// Set SSL Certificate and Private Key of VPN Server (Async mode). You can set the SSL certificate that the VPN Server provides to the connected client and the private key for that certificate. The certificate must be in X.509 format and the private key must be Base 64 encoded format. To call this API, you must have VPN Server administrator privileges. + /// + public async Task SetServerCertAsync(VpnRpcKeyPair t) => await CallAsync("SetServerCert", t); + + /// + /// Set SSL Certificate and Private Key of VPN Server (Sync mode). You can set the SSL certificate that the VPN Server provides to the connected client and the private key for that certificate. The certificate must be in X.509 format and the private key must be Base 64 encoded format. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcKeyPair SetServerCert(VpnRpcKeyPair t) => SetServerCertAsync(t).Result; + + /// + /// Get SSL Certificate and Private Key of VPN Server (Async mode). Use this to get the SSL certificate private key that the VPN Server provides to the connected client. To call this API, you must have VPN Server administrator privileges. + /// + public async Task GetServerCertAsync() => await CallAsync("GetServerCert", new VpnRpcKeyPair()); + + /// + /// Get SSL Certificate and Private Key of VPN Server (Async mode). Use this to get the SSL certificate private key that the VPN Server provides to the connected client. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcKeyPair GetServerCert() => GetServerCertAsync().Result; + + /// + /// Get the Encrypted Algorithm Used for VPN Communication (Async mode). Use this API to get the current setting of the algorithm used for the electronic signature and encrypted for SSL connection to be used for communication between the VPN Server and the connected client and the list of algorithms that can be used on the VPN Server. + /// + public async Task GetServerCipherAsync() => await CallAsync("GetServerCipher", new VpnRpcStr()); + + /// + /// Get the Encrypted Algorithm Used for VPN Communication (Async mode). Use this API to get the current setting of the algorithm used for the electronic signature and encrypted for SSL connection to be used for communication between the VPN Server and the connected client and the list of algorithms that can be used on the VPN Server. + /// + public VpnRpcStr GetServerCipher() => GetServerCipherAsync().Result; + + /// + /// Set the Encrypted Algorithm Used for VPN Communication (Async mode). Use this API to set the algorithm used for the electronic signature and encrypted for SSL connections to be used for communication between the VPN Server and the connected client. By specifying the algorithm name, the specified algorithm will be used later between the VPN Client and VPN Bridge connected to this server and the data will be encrypted. To call this API, you must have VPN Server administrator privileges. + /// + public async Task SetServerCipherAsync(VpnRpcStr t) => await CallAsync("SetServerCipher", t); + + /// + /// Set the Encrypted Algorithm Used for VPN Communication (Async mode). Use this API to set the algorithm used for the electronic signature and encrypted for SSL connections to be used for communication between the VPN Server and the connected client. By specifying the algorithm name, the specified algorithm will be used later between the VPN Client and VPN Bridge connected to this server and the data will be encrypted. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcStr SetServerCipher(VpnRpcStr t) => SetServerCipherAsync(t).Result; + + /// + /// Create New Virtual Hub (Async mode). Use this to create a new Virtual Hub on the VPN Server. The created Virtual Hub will begin operation immediately. When the VPN Server is operating on a cluster, this API is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the SetHub API. To get a list of Virtual Hubs that are already on the VPN Server, use the EnumHub API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. + /// + public async Task CreateHubAsync(VpnRpcCreateHub input_param) => await CallAsync("CreateHub", input_param); + + /// + /// Create New Virtual Hub (Async mode). Use this to create a new Virtual Hub on the VPN Server. The created Virtual Hub will begin operation immediately. When the VPN Server is operating on a cluster, this API is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the SetHub API. To get a list of Virtual Hubs that are already on the VPN Server, use the EnumHub API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. + /// + public VpnRpcCreateHub CreateHub(VpnRpcCreateHub input_param) => CreateHubAsync(input_param).Result; + + /// + /// Set the Virtual Hub configuration (Async mode). You can call this API to change the configuration of the specified Virtual Hub. You can set the Virtual Hub online or offline. You can set the maximum number of sessions that can be concurrently connected to the Virtual Hub that is currently being managed. You can set the Virtual Hub administrator password. You can set other parameters for the Virtual Hub. Before call this API, you need to obtain the latest state of the Virtual Hub by using the GetHub API. + /// + public async Task SetHubAsync(VpnRpcCreateHub input_param) => await CallAsync("SetHub", input_param); + + /// + /// Set the Virtual Hub configuration (Async mode). You can call this API to change the configuration of the specified Virtual Hub. You can set the Virtual Hub online or offline. You can set the maximum number of sessions that can be concurrently connected to the Virtual Hub that is currently being managed. You can set the Virtual Hub administrator password. You can set other parameters for the Virtual Hub. Before call this API, you need to obtain the latest state of the Virtual Hub by using the GetHub API. + /// + public VpnRpcCreateHub SetHub(VpnRpcCreateHub input_param) => SetHubAsync(input_param).Result; + + /// + /// Get the Virtual Hub configuration (Async mode). You can call this API to get the current configuration of the specified Virtual Hub. To change the configuration of the Virtual Hub, call the SetHub API. + /// + public async Task GetHubAsync(VpnRpcCreateHub input_param) => await CallAsync("GetHub", input_param); + + /// + /// Get the Virtual Hub configuration (Async mode). You can call this API to get the current configuration of the specified Virtual Hub. To change the configuration of the Virtual Hub, call the SetHub API. + /// + public VpnRpcCreateHub GetHub(VpnRpcCreateHub input_param) => GetHubAsync(input_param).Result; + + /// + /// Get List of Virtual Hubs (Async mode). Use this to get a list of existing Virtual Hubs on the VPN Server. For each Virtual Hub, you can get the following information: Virtual Hub Name, Status, Type, Number of Users, Number of Groups, Number of Sessions, Number of MAC Tables, Number of IP Tables, Number of Logins, Last Login, and Last Communication. Note that when connecting in Virtual Hub Admin Mode, if in the options of a Virtual Hub that you do not have administrator privileges for, the option Don't Enumerate this Virtual Hub for Anonymous Users is enabled then that Virtual Hub will not be enumerated. If you are connected in Server Admin Mode, then the list of all Virtual Hubs will be displayed. When connecting to and managing a non-cluster-controller cluster member of a clustering environment, only the Virtual Hub currently being hosted by that VPN Server will be displayed. When connecting to a cluster controller for administration purposes, all the Virtual Hubs will be displayed. + /// + public async Task EnumHubAsync() => await CallAsync("EnumHub", new VpnRpcEnumHub()); + + /// + /// Get List of Virtual Hubs (Async mode). Use this to get a list of existing Virtual Hubs on the VPN Server. For each Virtual Hub, you can get the following information: Virtual Hub Name, Status, Type, Number of Users, Number of Groups, Number of Sessions, Number of MAC Tables, Number of IP Tables, Number of Logins, Last Login, and Last Communication. Note that when connecting in Virtual Hub Admin Mode, if in the options of a Virtual Hub that you do not have administrator privileges for, the option Don't Enumerate this Virtual Hub for Anonymous Users is enabled then that Virtual Hub will not be enumerated. If you are connected in Server Admin Mode, then the list of all Virtual Hubs will be displayed. When connecting to and managing a non-cluster-controller cluster member of a clustering environment, only the Virtual Hub currently being hosted by that VPN Server will be displayed. When connecting to a cluster controller for administration purposes, all the Virtual Hubs will be displayed. + /// + public VpnRpcEnumHub EnumHub() => EnumHubAsync().Result; + + /// + /// Delete Virtual Hub (Async mode). Use this to delete an existing Virtual Hub on the VPN Server. If you delete the Virtual Hub, all sessions that are currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect to the Virtual Hub. Also, this will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. Once you delete the Virtual Hub, it cannot be recovered. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. + /// + public async Task DeleteHubAsync(VpnRpcDeleteHub input_param) => await CallAsync("DeleteHub", input_param); + + /// + /// Delete Virtual Hub (Async mode). Use this to delete an existing Virtual Hub on the VPN Server. If you delete the Virtual Hub, all sessions that are currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect to the Virtual Hub. Also, this will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. Once you delete the Virtual Hub, it cannot be recovered. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. + /// + public VpnRpcDeleteHub DeleteHub(VpnRpcDeleteHub input_param) => DeleteHubAsync(input_param).Result; + + /// + /// Get Setting of RADIUS Server Used for User Authentication (Async mode). Use this to get the current settings for the RADIUS server used when a user connects to the currently managed Virtual Hub using RADIUS Server Authentication Mode. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetHubRadiusAsync(VpnRpcRadius input_param) => await CallAsync("GetHubRadius", input_param); + + /// + /// Get Setting of RADIUS Server Used for User Authentication (Async mode). Use this to get the current settings for the RADIUS server used when a user connects to the currently managed Virtual Hub using RADIUS Server Authentication Mode. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcRadius GetHubRadius(VpnRpcRadius input_param) => GetHubRadiusAsync(input_param).Result; + + /// + /// Set RADIUS Server to use for User Authentication (Async mode). To accept users to the currently managed Virtual Hub in RADIUS server authentication mode, you can specify an external RADIUS server that confirms the user name and password. (You can specify multiple hostname by splitting with comma or semicolon.) The RADIUS server must be set to receive requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetHubRadiusAsync(VpnRpcRadius input_param) => await CallAsync("SetHubRadius", input_param); + + /// + /// Set RADIUS Server to use for User Authentication (Async mode). To accept users to the currently managed Virtual Hub in RADIUS server authentication mode, you can specify an external RADIUS server that confirms the user name and password. (You can specify multiple hostname by splitting with comma or semicolon.) The RADIUS server must be set to receive requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcRadius SetHubRadius(VpnRpcRadius input_param) => SetHubRadiusAsync(input_param).Result; + + /// + /// Get List of TCP Connections Connecting to the VPN Server (Async mode). Use this to get a list of TCP/IP connections that are currently connecting to the VPN Server. It does not display the TCP connections that have been established as VPN sessions. To get the list of TCP/IP connections that have been established as VPN sessions, you can use the EnumSession API. You can get the following: Connection Name, Connection Source, Connection Start and Type. To call this API, you must have VPN Server administrator privileges. + /// + public async Task EnumConnectionAsync() => await CallAsync("EnumConnection", new VpnRpcEnumConnection()); + + /// + /// Get List of TCP Connections Connecting to the VPN Server (Async mode). Use this to get a list of TCP/IP connections that are currently connecting to the VPN Server. It does not display the TCP connections that have been established as VPN sessions. To get the list of TCP/IP connections that have been established as VPN sessions, you can use the EnumSession API. You can get the following: Connection Name, Connection Source, Connection Start and Type. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcEnumConnection EnumConnection() => EnumConnectionAsync().Result; + + /// + /// Disconnect TCP Connections Connecting to the VPN Server (Async mode). Use this to forcefully disconnect specific TCP/IP connections that are connecting to the VPN Server. To call this API, you must have VPN Server administrator privileges. + /// + public async Task DisconnectConnectionAsync(VpnRpcDisconnectConnection input_param) => await CallAsync("DisconnectConnection", input_param); + + /// + /// Disconnect TCP Connections Connecting to the VPN Server (Async mode). Use this to forcefully disconnect specific TCP/IP connections that are connecting to the VPN Server. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcDisconnectConnection DisconnectConnection(VpnRpcDisconnectConnection input_param) => DisconnectConnectionAsync(input_param).Result; + + /// + /// Get Information of TCP Connections Connecting to the VPN Server (Async mode). Use this to get detailed information of a specific TCP/IP connection that is connecting to the VPN Server. You can get the following information: Connection Name, Connection Type, Source Hostname, Source IP Address, Source Port Number (TCP), Connection Start, Server Product Name, Server Version, Server Build Number, Client Product Name, Client Version, and Client Build Number. To call this API, you must have VPN Server administrator privileges. + /// + public async Task GetConnectionInfoAsync(VpnRpcConnectionInfo input_param) => await CallAsync("GetConnectionInfo", input_param); + + /// + /// Get Information of TCP Connections Connecting to the VPN Server (Async mode). Use this to get detailed information of a specific TCP/IP connection that is connecting to the VPN Server. You can get the following information: Connection Name, Connection Type, Source Hostname, Source IP Address, Source Port Number (TCP), Connection Start, Server Product Name, Server Version, Server Build Number, Client Product Name, Client Version, and Client Build Number. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcConnectionInfo GetConnectionInfo(VpnRpcConnectionInfo input_param) => GetConnectionInfoAsync(input_param).Result; + + /// + /// Switch Virtual Hub to Online or Offline (Async mode). Use this to set the Virtual Hub to online or offline. A Virtual Hub with an offline status cannot receive VPN connections from clients. When you set the Virtual Hub offline, all sessions will be disconnected. A Virtual Hub with an offline status cannot receive VPN connections from clients. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetHubOnlineAsync(VpnRpcSetHubOnline input_param) => await CallAsync("SetHubOnline", input_param); + + /// + /// Switch Virtual Hub to Online or Offline (Async mode). Use this to set the Virtual Hub to online or offline. A Virtual Hub with an offline status cannot receive VPN connections from clients. When you set the Virtual Hub offline, all sessions will be disconnected. A Virtual Hub with an offline status cannot receive VPN connections from clients. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcSetHubOnline SetHubOnline(VpnRpcSetHubOnline input_param) => SetHubOnlineAsync(input_param).Result; + + /// + /// Get Current Status of Virtual Hub (Async mode). Use this to get the current status of the Virtual Hub currently being managed. You can get the following information: Virtual Hub Type, Number of Sessions, Number of Each Type of Object, Number of Logins, Last Login, Last Communication, and Communication Statistical Data. + /// + public async Task GetHubStatusAsync(VpnRpcHubStatus input_param) => await CallAsync("GetHubStatus", input_param); + + /// + /// Get Current Status of Virtual Hub (Async mode). Use this to get the current status of the Virtual Hub currently being managed. You can get the following information: Virtual Hub Type, Number of Sessions, Number of Each Type of Object, Number of Logins, Last Login, Last Communication, and Communication Statistical Data. + /// + public VpnRpcHubStatus GetHubStatus(VpnRpcHubStatus input_param) => GetHubStatusAsync(input_param).Result; + + /// + /// Set the logging configuration of the Virtual Hub (Async mode). Use this to enable or disable a security log or packet logs of the Virtual Hub currently being managed, set the save contents of the packet log for each type of packet to be saved, and set the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. There are the following packet types: TCP Connection Log, TCP Packet Log, DHCP Packet Log, UDP Packet Log, ICMP Packet Log, IP Packet Log, ARP Packet Log, and Ethernet Packet Log. To get the current setting, you can use the LogGet API. The log file switch cycle can be changed to switch in every second, every minute, every hour, every day, every month or not switch. To get the current setting, you can use the GetHubLog API. + /// + public async Task SetHubLogAsync(VpnRpcHubLog input_param) => await CallAsync("SetHubLog", input_param); + + /// + /// Set the logging configuration of the Virtual Hub (Async mode). Use this to enable or disable a security log or packet logs of the Virtual Hub currently being managed, set the save contents of the packet log for each type of packet to be saved, and set the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. There are the following packet types: TCP Connection Log, TCP Packet Log, DHCP Packet Log, UDP Packet Log, ICMP Packet Log, IP Packet Log, ARP Packet Log, and Ethernet Packet Log. To get the current setting, you can use the LogGet API. The log file switch cycle can be changed to switch in every second, every minute, every hour, every day, every month or not switch. To get the current setting, you can use the GetHubLog API. + /// + public VpnRpcHubLog SetHubLog(VpnRpcHubLog input_param) => SetHubLogAsync(input_param).Result; + + /// + /// Get the logging configuration of the Virtual Hub (Async mode). Use this to get the configuration for a security log or packet logs of the Virtual Hub currently being managed, get the setting for save contents of the packet log for each type of packet to be saved, and get the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. To set the current setting, you can use the SetHubLog API. + /// + public async Task GetHubLogAsync(VpnRpcHubLog input_param) => await CallAsync("GetHubLog", input_param); + + /// + /// Get the logging configuration of the Virtual Hub (Async mode). Use this to get the configuration for a security log or packet logs of the Virtual Hub currently being managed, get the setting for save contents of the packet log for each type of packet to be saved, and get the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. To set the current setting, you can use the SetHubLog API. + /// + public VpnRpcHubLog GetHubLog(VpnRpcHubLog input_param) => GetHubLogAsync(input_param).Result; + + /// + /// Add Trusted CA Certificate (Async mode). Use this to add a new certificate to a list of CA certificates trusted by the currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. To get a list of the current certificates you can use the EnumCa API. The certificate you add must be saved in the X.509 file format. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task AddCaAsync(VpnRpcHubAddCA input_param) => await CallAsync("AddCa", input_param); + + /// + /// Add Trusted CA Certificate (Async mode). Use this to add a new certificate to a list of CA certificates trusted by the currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. To get a list of the current certificates you can use the EnumCa API. The certificate you add must be saved in the X.509 file format. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcHubAddCA AddCa(VpnRpcHubAddCA input_param) => AddCaAsync(input_param).Result; + + /// + /// Get List of Trusted CA Certificates (Async mode). Here you can manage the certificate authority certificates that are trusted by this currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task EnumCaAsync(VpnRpcHubEnumCA input_param) => await CallAsync("EnumCa", input_param); + + /// + /// Get List of Trusted CA Certificates (Async mode). Here you can manage the certificate authority certificates that are trusted by this currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcHubEnumCA EnumCa(VpnRpcHubEnumCA input_param) => EnumCaAsync(input_param).Result; + + /// + /// Get Trusted CA Certificate (Async mode). Use this to get an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub and save it as a file in X.509 format. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task GetCaAsync(VpnRpcHubGetCA input_param) => await CallAsync("GetCa", input_param); + + /// + /// Get Trusted CA Certificate (Async mode). Use this to get an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub and save it as a file in X.509 format. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcHubGetCA GetCa(VpnRpcHubGetCA input_param) => GetCaAsync(input_param).Result; + + /// + /// Delete Trusted CA Certificate (Async mode). Use this to delete an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub. To get a list of the current certificates you can use the EnumCa API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task DeleteCaAsync(VpnRpcHubDeleteCA input_param) => await CallAsync("DeleteCa", input_param); + + /// + /// Delete Trusted CA Certificate (Async mode). Use this to delete an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub. To get a list of the current certificates you can use the EnumCa API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcHubDeleteCA DeleteCa(VpnRpcHubDeleteCA input_param) => DeleteCaAsync(input_param).Result; + + /// + /// Create New Cascade Connection (Async mode). Use this to create a new Cascade Connection on the currently managed Virtual Hub. By using a Cascade Connection, you can connect this Virtual Hub by Cascade Connection to another Virtual Hub that is operating on the same or a different computer. To create a Cascade Connection, you must specify the name of the Cascade Connection, destination server and destination Virtual Hub and user name. When a new Cascade Connection is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after a Cascade Connection has been created, use the other APIs that include the name "Link". [Warning About Cascade Connections] By connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task CreateLinkAsync(VpnRpcCreateLink input_param) => await CallAsync("CreateLink", input_param); + + /// + /// Create New Cascade Connection (Async mode). Use this to create a new Cascade Connection on the currently managed Virtual Hub. By using a Cascade Connection, you can connect this Virtual Hub by Cascade Connection to another Virtual Hub that is operating on the same or a different computer. To create a Cascade Connection, you must specify the name of the Cascade Connection, destination server and destination Virtual Hub and user name. When a new Cascade Connection is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after a Cascade Connection has been created, use the other APIs that include the name "Link". [Warning About Cascade Connections] By connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCreateLink CreateLink(VpnRpcCreateLink input_param) => CreateLinkAsync(input_param).Result; + + /// + /// Get the Cascade Connection Setting (Async mode). Use this to get the Connection Setting of a Cascade Connection that is registered on the currently managed Virtual Hub. To change the Connection Setting contents of the Cascade Connection, use the APIs that include the name "Link" after creating the Cascade Connection. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetLinkAsync(VpnRpcCreateLink input_param) => await CallAsync("GetLink", input_param); + + /// + /// Get the Cascade Connection Setting (Async mode). Use this to get the Connection Setting of a Cascade Connection that is registered on the currently managed Virtual Hub. To change the Connection Setting contents of the Cascade Connection, use the APIs that include the name "Link" after creating the Cascade Connection. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCreateLink GetLink(VpnRpcCreateLink input_param) => GetLinkAsync(input_param).Result; + + /// + /// Change Existing Cascade Connection (Async mode). Use this to alter the setting of an existing Cascade Connection on the currently managed Virtual Hub. + /// + public async Task SetLinkAsync(VpnRpcCreateLink input_param) => await CallAsync("SetLink", input_param); + + /// + /// Change Existing Cascade Connection (Async mode). Use this to alter the setting of an existing Cascade Connection on the currently managed Virtual Hub. + /// + public VpnRpcCreateLink SetLink(VpnRpcCreateLink input_param) => SetLinkAsync(input_param).Result; + + /// + /// Get List of Cascade Connections (Async mode). Use this to get a list of Cascade Connections that are registered on the currently managed Virtual Hub. By using a Cascade Connection, you can connect this Virtual Hub by Layer 2 Cascade Connection to another Virtual Hub that is operating on the same or a different computer. [Warning About Cascade Connections] By connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnumLinkAsync(VpnRpcEnumLink input_param) => await CallAsync("EnumLink", input_param); + + /// + /// Get List of Cascade Connections (Async mode). Use this to get a list of Cascade Connections that are registered on the currently managed Virtual Hub. By using a Cascade Connection, you can connect this Virtual Hub by Layer 2 Cascade Connection to another Virtual Hub that is operating on the same or a different computer. [Warning About Cascade Connections] By connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcEnumLink EnumLink(VpnRpcEnumLink input_param) => EnumLinkAsync(input_param).Result; + + /// + /// Switch Cascade Connection to Online Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to online status. The Cascade Connection that is switched to online status begins the process of connecting to the destination VPN Server in accordance with the Connection Setting. The Cascade Connection that is switched to online status will establish normal connection to the VPN Server or continue to attempt connection until it is switched to offline status. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetLinkOnlineAsync(VpnRpcLink input_param) => await CallAsync("SetLinkOnline", input_param); + + /// + /// Switch Cascade Connection to Online Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to online status. The Cascade Connection that is switched to online status begins the process of connecting to the destination VPN Server in accordance with the Connection Setting. The Cascade Connection that is switched to online status will establish normal connection to the VPN Server or continue to attempt connection until it is switched to offline status. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcLink SetLinkOnline(VpnRpcLink input_param) => SetLinkOnlineAsync(input_param).Result; + + /// + /// Switch Cascade Connection to Offline Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to offline status. The Cascade Connection that is switched to offline will not connect to the VPN Server until next time it is switched to the online status using the SetLinkOnline API You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetLinkOfflineAsync(VpnRpcLink input_param) => await CallAsync("SetLinkOffline", input_param); + + /// + /// Switch Cascade Connection to Offline Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to offline status. The Cascade Connection that is switched to offline will not connect to the VPN Server until next time it is switched to the online status using the SetLinkOnline API You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcLink SetLinkOffline(VpnRpcLink input_param) => SetLinkOfflineAsync(input_param).Result; + + /// + /// Delete Cascade Connection Setting (Async mode). Use this to delete a Cascade Connection that is registered on the currently managed Virtual Hub. If the specified Cascade Connection has a status of online, the connections will be automatically disconnected and then the Cascade Connection will be deleted. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task DeleteLinkAsync(VpnRpcLink input_param) => await CallAsync("DeleteLink", input_param); + + /// + /// Delete Cascade Connection Setting (Async mode). Use this to delete a Cascade Connection that is registered on the currently managed Virtual Hub. If the specified Cascade Connection has a status of online, the connections will be automatically disconnected and then the Cascade Connection will be deleted. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcLink DeleteLink(VpnRpcLink input_param) => DeleteLinkAsync(input_param).Result; + + /// + /// Change Name of Cascade Connection (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to change the name of that Cascade Connection. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task RenameLinkAsync(VpnRpcRenameLink input_param) => await CallAsync("RenameLink", input_param); + + /// + /// Change Name of Cascade Connection (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to change the name of that Cascade Connection. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcRenameLink RenameLink(VpnRpcRenameLink input_param) => RenameLinkAsync(input_param).Result; + + /// + /// Get Current Cascade Connection Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is currently online, use this to get its connection status and other information. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetLinkStatusAsync(VpnRpcLinkStatus input_param) => await CallAsync("GetLinkStatus", input_param); + + /// + /// Get Current Cascade Connection Status (Async mode). When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is currently online, use this to get its connection status and other information. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcLinkStatus GetLinkStatus(VpnRpcLinkStatus input_param) => GetLinkStatusAsync(input_param).Result; + + /// + /// Add Access List Rule (Async mode). Use this to add a new rule to the access list of the currently managed Virtual Hub. The access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the access list to generate delays, jitters and packet losses. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task AddAccessAsync(VpnRpcAddAccess input_param) => await CallAsync("AddAccess", input_param); + + /// + /// Add Access List Rule (Async mode). Use this to add a new rule to the access list of the currently managed Virtual Hub. The access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the access list to generate delays, jitters and packet losses. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcAddAccess AddAccess(VpnRpcAddAccess input_param) => AddAccessAsync(input_param).Result; + + /// + /// Delete Rule from Access List (Async mode). Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and delete it. To delete a rule, you must specify that rule's ID. You can display the ID by using the EnumAccess API. If you wish not to delete the rule but to only temporarily disable it, use the SetAccessList API to set the rule status to disable. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task DeleteAccessAsync(VpnRpcDeleteAccess input_param) => await CallAsync("DeleteAccess", input_param); + + /// + /// Delete Rule from Access List (Async mode). Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and delete it. To delete a rule, you must specify that rule's ID. You can display the ID by using the EnumAccess API. If you wish not to delete the rule but to only temporarily disable it, use the SetAccessList API to set the rule status to disable. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcDeleteAccess DeleteAccess(VpnRpcDeleteAccess input_param) => DeleteAccessAsync(input_param).Result; + + /// + /// Get Access List Rule List (Async mode). Use this to get a list of packet filter rules that are registered on access list of the currently managed Virtual Hub. The access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task EnumAccessAsync(VpnRpcEnumAccessList input_param) => await CallAsync("EnumAccess", input_param); + + /// + /// Get Access List Rule List (Async mode). Use this to get a list of packet filter rules that are registered on access list of the currently managed Virtual Hub. The access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcEnumAccessList EnumAccess(VpnRpcEnumAccessList input_param) => EnumAccessAsync(input_param).Result; + + /// + /// Replace all access lists on a single bulk API call (Async mode). This API removes all existing access list rules on the Virtual Hub, and replace them by new access list rules specified by the parameter. + /// + public async Task SetAccessListAsync(VpnRpcEnumAccessList input_param) => await CallAsync("SetAccessList", input_param); + + /// + /// Replace all access lists on a single bulk API call (Async mode). This API removes all existing access list rules on the Virtual Hub, and replace them by new access list rules specified by the parameter. + /// + public VpnRpcEnumAccessList SetAccessList(VpnRpcEnumAccessList input_param) => SetAccessListAsync(input_param).Result; + + /// + /// Create a user (Async mode). Use this to create a new user in the security account database of the currently managed Virtual Hub. By creating a user, the VPN Client can connect to the Virtual Hub by using the authentication information of that user. Note that a user whose user name has been created as "*" (a single asterisk character) will automatically be registered as a RADIUS authentication user. For cases where there are users with "*" as the name, when a user, whose user name that has been provided when a client connected to a VPN Server does not match existing user names, is able to be authenticated by a RADIUS server or NT domain controller by inputting a user name and password, the authentication settings and security policy settings will follow the setting for the user "*". To change the user information of a user that has been created, use the SetUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task CreateUserAsync(VpnRpcSetUser input_param) => await CallAsync("CreateUser", input_param); + + /// + /// Create a user (Async mode). Use this to create a new user in the security account database of the currently managed Virtual Hub. By creating a user, the VPN Client can connect to the Virtual Hub by using the authentication information of that user. Note that a user whose user name has been created as "*" (a single asterisk character) will automatically be registered as a RADIUS authentication user. For cases where there are users with "*" as the name, when a user, whose user name that has been provided when a client connected to a VPN Server does not match existing user names, is able to be authenticated by a RADIUS server or NT domain controller by inputting a user name and password, the authentication settings and security policy settings will follow the setting for the user "*". To change the user information of a user that has been created, use the SetUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetUser CreateUser(VpnRpcSetUser input_param) => CreateUserAsync(input_param).Result; + + /// + /// Change User Settings (Async mode). Use this to change user settings that is registered on the security account database of the currently managed Virtual Hub. The user settings that can be changed using this API are the three items that are specified when a new user is created using the CreateUser API: Group Name, Full Name, and Description. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task SetUserAsync(VpnRpcSetUser input_param) => await CallAsync("SetUser", input_param); + + /// + /// Change User Settings (Async mode). Use this to change user settings that is registered on the security account database of the currently managed Virtual Hub. The user settings that can be changed using this API are the three items that are specified when a new user is created using the CreateUser API: Group Name, Full Name, and Description. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetUser SetUser(VpnRpcSetUser input_param) => SetUserAsync(input_param).Result; + + /// + /// Get User Settings (Async mode). Use this to get user settings information that is registered on the security account database of the currently managed Virtual Hub. The information that you can get using this API are User Name, Full Name, Group Name, Expiration Date, Security Policy, and Auth Type, as well as parameters that are specified as auth type attributes and the statistical data of that user. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task GetUserAsync(VpnRpcSetUser input_param) => await CallAsync("GetUser", input_param); + + /// + /// Get User Settings (Async mode). Use this to get user settings information that is registered on the security account database of the currently managed Virtual Hub. The information that you can get using this API are User Name, Full Name, Group Name, Expiration Date, Security Policy, and Auth Type, as well as parameters that are specified as auth type attributes and the statistical data of that user. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetUser GetUser(VpnRpcSetUser input_param) => GetUserAsync(input_param).Result; + + /// + /// Delete a user (Async mode). Use this to delete a user that is registered on the security account database of the currently managed Virtual Hub. By deleting the user, that user will no long be able to connect to the Virtual Hub. You can use the SetUser API to set the user's security policy to deny access instead of deleting a user, set the user to be temporarily denied from logging in. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task DeleteUserAsync(VpnRpcDeleteUser input_param) => await CallAsync("DeleteUser", input_param); + + /// + /// Delete a user (Sync mode). Use this to delete a user that is registered on the security account database of the currently managed Virtual Hub. By deleting the user, that user will no long be able to connect to the Virtual Hub. You can use the SetUser API to set the user's security policy to deny access instead of deleting a user, set the user to be temporarily denied from logging in. To get the list of currently registered users, use the EnumUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcDeleteUser DeleteUser(VpnRpcDeleteUser input_param) => DeleteUserAsync(input_param).Result; + + /// + /// Get List of Users (Async mode). Use this to get a list of users that are registered on the security account database of the currently managed Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task EnumUserAsync(VpnRpcEnumUser input_param) => await CallAsync("EnumUser", input_param); + + /// + /// Get List of Users (Async mode). Use this to get a list of users that are registered on the security account database of the currently managed Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcEnumUser EnumUser(VpnRpcEnumUser input_param) => EnumUserAsync(input_param).Result; + + /// + /// Create Group (Async mode). Use this to create a new group in the security account database of the currently managed Virtual Hub. You can register multiple users in a group. To register users in a group use the SetUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task CreateGroupAsync(VpnRpcSetGroup input_param) => await CallAsync("CreateGroup", input_param); + + /// + /// Create Group (Async mode). Use this to create a new group in the security account database of the currently managed Virtual Hub. You can register multiple users in a group. To register users in a group use the SetUser API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetGroup CreateGroup(VpnRpcSetGroup input_param) => CreateGroupAsync(input_param).Result; + + /// + /// Set group settings (Async mode). Use this to set group settings that is registered on the security account database of the currently managed Virtual Hub. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task SetGroupAsync(VpnRpcSetGroup input_param) => await CallAsync("SetGroup", input_param); + + /// + /// Set group settings (Async mode). Use this to set group settings that is registered on the security account database of the currently managed Virtual Hub. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetGroup SetGroup(VpnRpcSetGroup input_param) => SetGroupAsync(input_param).Result; + + /// + /// Get Group Setting (Sync mode). Use this to get the setting of a group that is registered on the security account database of the currently managed Virtual Hub. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task GetGroupAsync(VpnRpcSetGroup input_param) => await CallAsync("GetGroup", input_param); + + /// + /// Get Group Setting (Sync mode). Use this to get the setting of a group that is registered on the security account database of the currently managed Virtual Hub. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcSetGroup GetGroup(VpnRpcSetGroup input_param) => GetGroupAsync(input_param).Result; + + /// + /// Delete User from Group (Async mode). Use this to delete a specified user from the group that is registered on the security account database of the currently managed Virtual Hub. By deleting a user from the group, that user becomes unassigned. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task DeleteGroupAsync(VpnRpcDeleteUser input_param) => await CallAsync("DeleteGroup", input_param); + + /// + /// Delete User from Group (Async mode). Use this to delete a specified user from the group that is registered on the security account database of the currently managed Virtual Hub. By deleting a user from the group, that user becomes unassigned. To get the list of currently registered groups, use the EnumGroup API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcDeleteUser DeleteGroup(VpnRpcDeleteUser input_param) => DeleteGroupAsync(input_param).Result; + + /// + /// Get List of Groups (Async mode). Use this to get a list of groups that are registered on the security account database of the currently managed Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public async Task EnumGroupAsync(VpnRpcEnumGroup input_param) => await CallAsync("EnumGroup", input_param); + + /// + /// Get List of Groups (Async mode). Use this to get a list of groups that are registered on the security account database of the currently managed Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a member server on a cluster. + /// + public VpnRpcEnumGroup EnumGroup(VpnRpcEnumGroup input_param) => EnumGroupAsync(input_param).Result; + + /// + /// Get List of Connected VPN Sessions (Async mode). Use this to get a list of the sessions connected to the Virtual Hub currently being managed. In the list of sessions, the following information will be obtained for each connection: Session Name, Session Site, User Name, Source Host Name, TCP Connection, Transfer Bytes and Transfer Packets. If the currently connected VPN Server is a cluster controller and the currently managed Virtual Hub is a static Virtual Hub, you can get an all-linked-together list of all sessions connected to that Virtual Hub on all cluster members. In all other cases, only the list of sessions that are actually connected to the currently managed VPN Server will be obtained. + /// + public async Task EnumSessionAsync(VpnRpcEnumSession input_param) => await CallAsync("EnumSession", input_param); + + /// + /// Get List of Connected VPN Sessions (Async mode). Use this to get a list of the sessions connected to the Virtual Hub currently being managed. In the list of sessions, the following information will be obtained for each connection: Session Name, Session Site, User Name, Source Host Name, TCP Connection, Transfer Bytes and Transfer Packets. If the currently connected VPN Server is a cluster controller and the currently managed Virtual Hub is a static Virtual Hub, you can get an all-linked-together list of all sessions connected to that Virtual Hub on all cluster members. In all other cases, only the list of sessions that are actually connected to the currently managed VPN Server will be obtained. + /// + public VpnRpcEnumSession EnumSession(VpnRpcEnumSession input_param) => EnumSessionAsync(input_param).Result; + + /// + /// Get Session Status (Async mode). Use this to specify a session currently connected to the currently managed Virtual Hub and get the session information. The session status includes the following: source host name and user name, version information, time information, number of TCP connections, communication parameters, session key, statistical information on data transferred, and other client and server information. To get the list of currently connected sessions, use the EnumSession API. + /// + public async Task GetSessionStatusAsync(VpnRpcSessionStatus input_param) => await CallAsync("GetSessionStatus", input_param); + + /// + /// Get Session Status (Async mode). Use this to specify a session currently connected to the currently managed Virtual Hub and get the session information. The session status includes the following: source host name and user name, version information, time information, number of TCP connections, communication parameters, session key, statistical information on data transferred, and other client and server information. To get the list of currently connected sessions, use the EnumSession API. + /// + public VpnRpcSessionStatus GetSessionStatus(VpnRpcSessionStatus input_param) => GetSessionStatusAsync(input_param).Result; + + /// + /// Disconnect Session (Async mode). Use this to specify a session currently connected to the currently managed Virtual Hub and forcefully disconnect that session using manager privileges. Note that when communication is disconnected by settings on the source client side and the automatically reconnect option is enabled, it is possible that the client will reconnect. To get the list of currently connected sessions, use the EnumSession API. + /// + public async Task DeleteSessionAsync(VpnRpcDeleteSession input_param) => await CallAsync("DeleteSession", input_param); + + /// + /// Disconnect Session (Async mode). Use this to specify a session currently connected to the currently managed Virtual Hub and forcefully disconnect that session using manager privileges. Note that when communication is disconnected by settings on the source client side and the automatically reconnect option is enabled, it is possible that the client will reconnect. To get the list of currently connected sessions, use the EnumSession API. + /// + public VpnRpcDeleteSession DeleteSession(VpnRpcDeleteSession input_param) => DeleteSessionAsync(input_param).Result; + + /// + /// Get the MAC Address Table Database (Async mode). Use this to get the MAC address table database that is held by the currently managed Virtual Hub. The MAC address table database is a table that the Virtual Hub requires to perform the action of switching Ethernet frames and the Virtual Hub decides the sorting destination session of each Ethernet frame based on the MAC address table database. The MAC address database is built by the Virtual Hub automatically analyzing the contents of the communication. + /// + public async Task EnumMacTableAsync(VpnRpcEnumMacTable input_param) => await CallAsync("EnumMacTable", input_param); + + /// + /// Get the MAC Address Table Database (Async mode). Use this to get the MAC address table database that is held by the currently managed Virtual Hub. The MAC address table database is a table that the Virtual Hub requires to perform the action of switching Ethernet frames and the Virtual Hub decides the sorting destination session of each Ethernet frame based on the MAC address table database. The MAC address database is built by the Virtual Hub automatically analyzing the contents of the communication. + /// + public VpnRpcEnumMacTable EnumMacTable(VpnRpcEnumMacTable input_param) => EnumMacTableAsync(input_param).Result; + + /// + /// Delete MAC Address Table Entry (Async mode). Use this API to operate the MAC address table database held by the currently managed Virtual Hub and delete a specified MAC address table entry from the database. To get the contents of the current MAC address table database use the EnumMacTable API. + /// + public async Task DeleteMacTableAsync(VpnRpcDeleteTable input_param) => await CallAsync("DeleteMacTable", input_param); + + /// + /// Delete MAC Address Table Entry (Async mode). Use this API to operate the MAC address table database held by the currently managed Virtual Hub and delete a specified MAC address table entry from the database. To get the contents of the current MAC address table database use the EnumMacTable API. + /// + public VpnRpcDeleteTable DeleteMacTable(VpnRpcDeleteTable input_param) => DeleteMacTableAsync(input_param).Result; + + /// + /// Get the IP Address Table Database (Async mode). Use this to get the IP address table database that is held by the currently managed Virtual Hub. The IP address table database is a table that is automatically generated by analyzing the contents of communication so that the Virtual Hub can always know which session is using which IP address and it is frequently used by the engine that applies the Virtual Hub security policy. By specifying the session name you can get the IP address table entry that has been associated with that session. + /// + public async Task EnumIpTableAsync(VpnRpcEnumIpTable input_param) => await CallAsync("EnumIpTable", input_param); + + /// + /// Get the IP Address Table Database (Async mode). Use this to get the IP address table database that is held by the currently managed Virtual Hub. The IP address table database is a table that is automatically generated by analyzing the contents of communication so that the Virtual Hub can always know which session is using which IP address and it is frequently used by the engine that applies the Virtual Hub security policy. By specifying the session name you can get the IP address table entry that has been associated with that session. + /// + public VpnRpcEnumIpTable EnumIpTable(VpnRpcEnumIpTable input_param) => EnumIpTableAsync(input_param).Result; + + /// + /// Delete IP Address Table Entry (Async mode). Use this API to operate the IP address table database held by the currently managed Virtual Hub and delete a specified IP address table entry from the database. To get the contents of the current IP address table database use the EnumIpTable API. + /// + public async Task DeleteIpTableAsync(VpnRpcDeleteTable input_param) => await CallAsync("DeleteIpTable", input_param); + + /// + /// Delete IP Address Table Entry (Async mode). Use this API to operate the IP address table database held by the currently managed Virtual Hub and delete a specified IP address table entry from the database. To get the contents of the current IP address table database use the EnumIpTable API. + /// + public VpnRpcDeleteTable DeleteIpTable(VpnRpcDeleteTable input_param) => DeleteIpTableAsync(input_param).Result; + + /// + /// Set the Keep Alive Internet Connection Function (Async mode). Use this to set the destination host name etc. of the Keep Alive Internet Connection Function. For network connection environments where connections will automatically be disconnected where there are periods of no communication that are longer than a set period, by using the Keep Alive Internet Connection Function, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. When using this API, you can specify the following: Host Name, Port Number, Packet Send Interval, and Protocol. Packets sent to keep alive the Internet connection will have random content and personal information that could identify a computer or user is not sent. You can use the SetKeep API to enable/disable the Keep Alive Internet Connection Function. To execute this API on a VPN Server or VPN Bridge, you must have administrator privileges. + /// + public async Task SetKeepAsync(VpnRpcKeep input_param) => await CallAsync("SetKeep", input_param); + + /// + /// Set the Keep Alive Internet Connection Function (Async mode). Use this to set the destination host name etc. of the Keep Alive Internet Connection Function. For network connection environments where connections will automatically be disconnected where there are periods of no communication that are longer than a set period, by using the Keep Alive Internet Connection Function, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. When using this API, you can specify the following: Host Name, Port Number, Packet Send Interval, and Protocol. Packets sent to keep alive the Internet connection will have random content and personal information that could identify a computer or user is not sent. You can use the SetKeep API to enable/disable the Keep Alive Internet Connection Function. To execute this API on a VPN Server or VPN Bridge, you must have administrator privileges. + /// + public VpnRpcKeep SetKeep(VpnRpcKeep input_param) => SetKeepAsync(input_param).Result; + + /// + /// Get the Keep Alive Internet Connection Function (Async mode). Use this to get the current setting contents of the Keep Alive Internet Connection Function. In addition to the destination's Host Name, Port Number, Packet Send Interval and Protocol, you can obtain the current enabled/disabled status of the Keep Alive Internet Connection Function. + /// + public async Task GetKeepAsync(VpnRpcKeep input_param) => await CallAsync("GetKeep", input_param); + + /// + /// Get the Keep Alive Internet Connection Function (Async mode). Use this to get the current setting contents of the Keep Alive Internet Connection Function. In addition to the destination's Host Name, Port Number, Packet Send Interval and Protocol, you can obtain the current enabled/disabled status of the Keep Alive Internet Connection Function. + /// + public VpnRpcKeep GetKeep(VpnRpcKeep input_param) => GetKeepAsync(input_param).Result; + + /// + /// Enable the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to enable the Virtual NAT and DHCP Server function (SecureNAT Function) on the currently managed Virtual Hub and begin its operation. Before executing this API, you must first check the setting contents of the current Virtual NAT function and DHCP Server function using the SetSecureNATOption API and GetSecureNATOption API. By enabling the SecureNAT function, you can virtually operate a NAT router (IP masquerade) and the DHCP Server function on a virtual network on the Virtual Hub. [Warning about SecureNAT Function] The SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. If you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnableSecureNATAsync(VpnRpcHub input_param) => await CallAsync("EnableSecureNAT", input_param); + + /// + /// Enable the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to enable the Virtual NAT and DHCP Server function (SecureNAT Function) on the currently managed Virtual Hub and begin its operation. Before executing this API, you must first check the setting contents of the current Virtual NAT function and DHCP Server function using the SetSecureNATOption API and GetSecureNATOption API. By enabling the SecureNAT function, you can virtually operate a NAT router (IP masquerade) and the DHCP Server function on a virtual network on the Virtual Hub. [Warning about SecureNAT Function] The SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. If you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcHub EnableSecureNAT(VpnRpcHub input_param) => EnableSecureNATAsync(input_param).Result; + + /// + /// Disable the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to disable the Virtual NAT and DHCP Server function (SecureNAT Function) on the currently managed Virtual Hub. By executing this API the Virtual NAT function immediately stops operating and the Virtual DHCP Server function deletes the DHCP lease database and stops the service. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task DisableSecureNATAsync(VpnRpcHub input_param) => await CallAsync("DisableSecureNAT", input_param); + + /// + /// Disable the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to disable the Virtual NAT and DHCP Server function (SecureNAT Function) on the currently managed Virtual Hub. By executing this API the Virtual NAT function immediately stops operating and the Virtual DHCP Server function deletes the DHCP lease database and stops the service. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcHub DisableSecureNAT(VpnRpcHub input_param) => DisableSecureNATAsync(input_param).Result; + + /// + /// Change Settings of SecureNAT Function (Async mode). Use this to change and save the virtual host network interface settings, virtual NAT function settings and virtual DHCP server settings of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. The SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. [Warning about SecureNAT Function] The SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. If you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetSecureNATOptionAsync(VpnVhOption input_param) => await CallAsync("SetSecureNATOption", input_param); + + /// + /// Change Settings of SecureNAT Function (Async mode). Use this to change and save the virtual host network interface settings, virtual NAT function settings and virtual DHCP server settings of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. The SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. [Warning about SecureNAT Function] The SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. If you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnVhOption SetSecureNATOption(VpnVhOption input_param) => SetSecureNATOptionAsync(input_param).Result; + + /// + /// Get Settings of SecureNAT Function (Async mode). This API get the registered settings for the SecureNAT function which is set by the SetSecureNATOption API. + /// + public async Task GetSecureNATOptionAsync(VpnVhOption input_param) => await CallAsync("GetSecureNATOption", input_param); + + /// + /// Get Settings of SecureNAT Function (Async mode). This API get the registered settings for the SecureNAT function which is set by the SetSecureNATOption API. + /// + public VpnVhOption GetSecureNATOption(VpnVhOption input_param) => GetSecureNATOptionAsync(input_param).Result; + + /// + /// Get Virtual NAT Function Session Table of SecureNAT Function (Async mode). Use this to get the table of TCP and UDP sessions currently communicating via the Virtual NAT (NAT table) in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnumNATAsync(VpnRpcEnumNat input_param) => await CallAsync("EnumNAT", input_param); + + /// + /// Get Virtual NAT Function Session Table of SecureNAT Function (Async mode). Use this to get the table of TCP and UDP sessions currently communicating via the Virtual NAT (NAT table) in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcEnumNat EnumNAT(VpnRpcEnumNat input_param) => EnumNATAsync(input_param).Result; + + /// + /// Get Virtual DHCP Server Function Lease Table of SecureNAT Function (Async mode). Use this to get the lease table of IP addresses, held by the Virtual DHCP Server, that are assigned to clients in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnumDHCPAsync(VpnRpcEnumDhcp input_param) => await CallAsync("EnumDHCP", input_param); + + /// + /// Get Virtual DHCP Server Function Lease Table of SecureNAT Function (Async mode). Use this to get the lease table of IP addresses, held by the Virtual DHCP Server, that are assigned to clients in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcEnumDhcp EnumDHCP(VpnRpcEnumDhcp input_param) => EnumDHCPAsync(input_param).Result; + + /// + /// Get the Operating Status of the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to get the operating status of the Virtual NAT and DHCP Server function (SecureNAT Function) when it is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetSecureNATStatusAsync(VpnRpcNatStatus input_param) => await CallAsync("GetSecureNATStatus", input_param); + + /// + /// Get the Operating Status of the Virtual NAT and DHCP Server Function (SecureNAT Function) (Async mode). Use this to get the operating status of the Virtual NAT and DHCP Server function (SecureNAT Function) when it is operating on the currently managed Virtual Hub. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcNatStatus GetSecureNATStatus(VpnRpcNatStatus input_param) => GetSecureNATStatusAsync(input_param).Result; + + /// + /// Get List of Network Adapters Usable as Local Bridge (Async mode). Use this to get a list of Ethernet devices (network adapters) that can be used as a bridge destination device as part of a Local Bridge connection. If possible, network connection name is displayed. You can use a device displayed here by using the AddLocalBridge API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task EnumEthernetAsync() => await CallAsync("EnumEthernet", new VpnRpcEnumEth()); + + /// + /// Get List of Network Adapters Usable as Local Bridge (Async mode). Use this to get a list of Ethernet devices (network adapters) that can be used as a bridge destination device as part of a Local Bridge connection. If possible, network connection name is displayed. You can use a device displayed here by using the AddLocalBridge API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcEnumEth EnumEthernet() => EnumEthernetAsync().Result; + + /// + /// Create Local Bridge Connection (Async mode). Use this to create a new Local Bridge connection on the VPN Server. By using a Local Bridge, you can configure a Layer 2 bridge connection between a Virtual Hub operating on this VPN server and a physical Ethernet Device (Network Adapter). You can create a tap device (virtual network interface) on the system and connect a bridge between Virtual Hubs (the tap device is only supported by Linux versions). It is possible to establish a bridge to an operating network adapter of your choice for the bridge destination Ethernet device (network adapter), but in high load environments, we recommend you prepare a network adapter dedicated to serve as a bridge. To call this API, you must have VPN Server administrator privileges. + /// + public async Task AddLocalBridgeAsync(VpnRpcLocalBridge input_param) => await CallAsync("AddLocalBridge", input_param); + + /// + /// Create Local Bridge Connection (Async mode). Use this to create a new Local Bridge connection on the VPN Server. By using a Local Bridge, you can configure a Layer 2 bridge connection between a Virtual Hub operating on this VPN server and a physical Ethernet Device (Network Adapter). You can create a tap device (virtual network interface) on the system and connect a bridge between Virtual Hubs (the tap device is only supported by Linux versions). It is possible to establish a bridge to an operating network adapter of your choice for the bridge destination Ethernet device (network adapter), but in high load environments, we recommend you prepare a network adapter dedicated to serve as a bridge. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcLocalBridge AddLocalBridge(VpnRpcLocalBridge input_param) => AddLocalBridgeAsync(input_param).Result; + + /// + /// Delete Local Bridge Connection (Async mode). Use this to delete an existing Local Bridge connection. To get a list of current Local Bridge connections use the EnumLocalBridge API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task DeleteLocalBridgeAsync(VpnRpcLocalBridge input_param) => await CallAsync("DeleteLocalBridge", input_param); + + /// + /// Delete Local Bridge Connection (Async mode). Use this to delete an existing Local Bridge connection. To get a list of current Local Bridge connections use the EnumLocalBridge API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcLocalBridge DeleteLocalBridge(VpnRpcLocalBridge input_param) => DeleteLocalBridgeAsync(input_param).Result; + + /// + /// Get List of Local Bridge Connection (Async mode). Use this to get a list of the currently defined Local Bridge connections. You can get the Local Bridge connection Virtual Hub name and the bridge destination Ethernet device (network adapter) name or tap device name, as well as the operating status. + /// + public async Task EnumLocalBridgeAsync() => await CallAsync("EnumLocalBridge", new VpnRpcEnumLocalBridge()); + + /// + /// Get List of Local Bridge Connection (Async mode). Use this to get a list of the currently defined Local Bridge connections. You can get the Local Bridge connection Virtual Hub name and the bridge destination Ethernet device (network adapter) name or tap device name, as well as the operating status. + /// + public VpnRpcEnumLocalBridge EnumLocalBridge() => EnumLocalBridgeAsync().Result; + + /// + /// Get whether the localbridge function is supported on the current system (Async mode). + /// + public async Task GetBridgeSupportAsync() => await CallAsync("GetBridgeSupport", new VpnRpcBridgeSupport()); + + /// + /// Get whether the localbridge function is supported on the current system (Async mode). + /// + public VpnRpcBridgeSupport GetBridgeSupport() => GetBridgeSupportAsync().Result; + + /// + /// Reboot VPN Server Service (Async mode). Use this to restart the VPN Server service. When you restart the VPN Server, all currently connected sessions and TCP connections will be disconnected and no new connections will be accepted until the restart process has completed. By using this API, only the VPN Server service program will be restarted and the physical computer that VPN Server is operating on does not restart. This management session will also be disconnected, so you will need to reconnect to continue management. Also, by specifying the "IntValue" parameter to "1", the contents of the configuration file (.config) held by the current VPN Server will be initialized. To call this API, you must have VPN Server administrator privileges. + /// + public async Task RebootServerAsync(VpnRpcTest input_param) => await CallAsync("RebootServer", input_param); + + /// + /// Reboot VPN Server Service (Async mode). Use this to restart the VPN Server service. When you restart the VPN Server, all currently connected sessions and TCP connections will be disconnected and no new connections will be accepted until the restart process has completed. By using this API, only the VPN Server service program will be restarted and the physical computer that VPN Server is operating on does not restart. This management session will also be disconnected, so you will need to reconnect to continue management. Also, by specifying the "IntValue" parameter to "1", the contents of the configuration file (.config) held by the current VPN Server will be initialized. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcTest RebootServer(VpnRpcTest input_param) => RebootServerAsync(input_param).Result; + + /// + /// Get List of Server Functions / Capability (Async mode). Use this get a list of functions and capability of the VPN Server currently connected and being managed. The function and capability of VPN Servers are different depending on the operating VPN server's edition and version. Using this API, you can find out the capability of the target VPN Server and report it. + /// + public async Task GetCapsAsync() => await CallAsync("GetCaps", new VpnCapslist()); + + /// + /// Get List of Server Functions / Capability (Async mode). Use this get a list of functions and capability of the VPN Server currently connected and being managed. The function and capability of VPN Servers are different depending on the operating VPN server's edition and version. Using this API, you can find out the capability of the target VPN Server and report it. + /// + public VpnCapslist GetCaps() => GetCapsAsync().Result; + + /// + /// Get the current configuration of the VPN Server (Async mode). Use this to get a text file (.config file) that contains the current configuration contents of the VPN server. You can get the status on the VPN Server at the instant this API is executed. You can edit the configuration file by using a regular text editor. To write an edited configuration to the VPN Server, use the SetConfig API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task GetConfigAsync() => await CallAsync("GetConfig", new VpnRpcConfig()); + + /// + /// Get the current configuration of the VPN Server (Async mode). Use this to get a text file (.config file) that contains the current configuration contents of the VPN server. You can get the status on the VPN Server at the instant this API is executed. You can edit the configuration file by using a regular text editor. To write an edited configuration to the VPN Server, use the SetConfig API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcConfig GetConfig() => GetConfigAsync().Result; + + /// + /// Write Configuration File to VPN Server (Async mode). Use this to write the configuration file to the VPN Server. By executing this API, the contents of the specified configuration file will be applied to the VPN Server and the VPN Server program will automatically restart and upon restart, operate according to the new configuration contents. Because it is difficult for an administrator to write all the contents of a configuration file, we recommend you use the GetConfig API to get the current contents of the VPN Server configuration and save it to file. You can then edit these contents in a regular text editor and then use the SetConfig API to rewrite the contents to the VPN Server. This API is for people with a detailed knowledge of the VPN Server and if an incorrectly configured configuration file is written to the VPN Server, it not only could cause errors, it could also result in the lost of the current setting data. Take special care when carrying out this action. To call this API, you must have VPN Server administrator privileges. + /// + public async Task SetConfigAsync(VpnRpcConfig input_param) => await CallAsync("SetConfig", input_param); + + /// + /// Write Configuration File to VPN Server (Async mode). Use this to write the configuration file to the VPN Server. By executing this API, the contents of the specified configuration file will be applied to the VPN Server and the VPN Server program will automatically restart and upon restart, operate according to the new configuration contents. Because it is difficult for an administrator to write all the contents of a configuration file, we recommend you use the GetConfig API to get the current contents of the VPN Server configuration and save it to file. You can then edit these contents in a regular text editor and then use the SetConfig API to rewrite the contents to the VPN Server. This API is for people with a detailed knowledge of the VPN Server and if an incorrectly configured configuration file is written to the VPN Server, it not only could cause errors, it could also result in the lost of the current setting data. Take special care when carrying out this action. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcConfig SetConfig(VpnRpcConfig input_param) => SetConfigAsync(input_param).Result; + + /// + /// Get Virtual Hub Administration Option default values (Async mode). + /// + public async Task GetDefaultHubAdminOptionsAsync(VpnRpcAdminOption input_param) => await CallAsync("GetDefaultHubAdminOptions", input_param); + + /// + /// Get Virtual Hub Administration Option default values (Async mode). + /// + public VpnRpcAdminOption GetDefaultHubAdminOptions(VpnRpcAdminOption input_param) => GetDefaultHubAdminOptionsAsync(input_param).Result; + + /// + /// Get List of Virtual Hub Administration Options (Async mode). Use this to get a list of Virtual Hub administration options that are set on the currently managed Virtual Hub. The purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. Only an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. There is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public async Task GetHubAdminOptionsAsync(VpnRpcAdminOption input_param) => await CallAsync("GetHubAdminOptions", input_param); + + /// + /// Get List of Virtual Hub Administration Options (Async mode). Use this to get a list of Virtual Hub administration options that are set on the currently managed Virtual Hub. The purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. Only an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. There is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public VpnRpcAdminOption GetHubAdminOptions(VpnRpcAdminOption input_param) => GetHubAdminOptionsAsync(input_param).Result; + + /// + /// Set Values of Virtual Hub Administration Options (Async mode). Use this to change the values of Virtual Hub administration options that are set on the currently managed Virtual Hub. The purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. Only an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. There is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public async Task SetHubAdminOptionsAsync(VpnRpcAdminOption input_param) => await CallAsync("SetHubAdminOptions", input_param); + + /// + /// Set Values of Virtual Hub Administration Options (Async mode). Use this to change the values of Virtual Hub administration options that are set on the currently managed Virtual Hub. The purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. Only an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. There is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public VpnRpcAdminOption SetHubAdminOptions(VpnRpcAdminOption input_param) => SetHubAdminOptionsAsync(input_param).Result; + + /// + /// Get List of Virtual Hub Extended Options (Async mode). Use this to get a Virtual Hub Extended Options List that is set on the currently managed Virtual Hub. Virtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub. By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options. However, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public async Task GetHubExtOptionsAsync(VpnRpcAdminOption input_param) => await CallAsync("GetHubExtOptions", input_param); + + /// + /// Get List of Virtual Hub Extended Options (Async mode). Use this to get a Virtual Hub Extended Options List that is set on the currently managed Virtual Hub. Virtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub. By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options. However, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public VpnRpcAdminOption GetHubExtOptions(VpnRpcAdminOption input_param) => GetHubExtOptionsAsync(input_param).Result; + + /// + /// Set a Value of Virtual Hub Extended Options (Async mode). Use this to set a value in the Virtual Hub Extended Options List that is set on the currently managed Virtual Hub. Virtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub. By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options. However, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public async Task SetHubExtOptionsAsync(VpnRpcAdminOption input_param) => await CallAsync("SetHubExtOptions", input_param); + + /// + /// Set a Value of Virtual Hub Extended Options (Async mode). Use this to set a value in the Virtual Hub Extended Options List that is set on the currently managed Virtual Hub. Virtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub. By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options. However, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster member. + /// + public VpnRpcAdminOption SetHubExtOptions(VpnRpcAdminOption input_param) => SetHubExtOptionsAsync(input_param).Result; + + /// + /// Define New Virtual Layer 3 Switch (Async mode). Use this to define a new Virtual Layer 3 Switch on the VPN Server. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public async Task AddL3SwitchAsync(VpnRpcL3Sw input_param) => await CallAsync("AddL3Switch", input_param); + + /// + /// Define New Virtual Layer 3 Switch (Async mode). Use this to define a new Virtual Layer 3 Switch on the VPN Server. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public VpnRpcL3Sw AddL3Switch(VpnRpcL3Sw input_param) => AddL3SwitchAsync(input_param).Result; + + /// + /// Delete Virtual Layer 3 Switch (Async mode). Use this to delete an existing Virtual Layer 3 Switch that is defined on the VPN Server. When the specified Virtual Layer 3 Switch is operating, it will be automatically deleted after operation stops. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public async Task DelL3SwitchAsync(VpnRpcL3Sw input_param) => await CallAsync("DelL3Switch", input_param); + + /// + /// Delete Virtual Layer 3 Switch (Async mode). Use this to delete an existing Virtual Layer 3 Switch that is defined on the VPN Server. When the specified Virtual Layer 3 Switch is operating, it will be automatically deleted after operation stops. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public VpnRpcL3Sw DelL3Switch(VpnRpcL3Sw input_param) => DelL3SwitchAsync(input_param).Result; + + /// + /// Get List of Virtual Layer 3 Switches (Async mode). Use this to define a new Virtual Layer 3 Switch on the VPN Server. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public async Task EnumL3SwitchAsync() => await CallAsync("EnumL3Switch", new VpnRpcEnumL3Sw()); + + /// + /// Get List of Virtual Layer 3 Switches (Async mode). Use this to define a new Virtual Layer 3 Switch on the VPN Server. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public VpnRpcEnumL3Sw EnumL3Switch() => EnumL3SwitchAsync().Result; + + /// + /// Start Virtual Layer 3 Switch Operation (Async mode). Use this to start the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently stopped. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public async Task StartL3SwitchAsync(VpnRpcL3Sw input_param) => await CallAsync("StartL3Switch", input_param); + + /// + /// Start Virtual Layer 3 Switch Operation (Async mode). Use this to start the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently stopped. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. [Explanation on Virtual Layer 3 Switch Function] You can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. [Caution about the Virtual Layer 3 Switch Function] The Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. If the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. + /// + public VpnRpcL3Sw StartL3Switch(VpnRpcL3Sw input_param) => StartL3SwitchAsync(input_param).Result; + + /// + /// Stop Virtual Layer 3 Switch Operation (Async mode). Use this to stop the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently operating. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. + /// + public async Task StopL3SwitchAsync(VpnRpcL3Sw input_param) => await CallAsync("StopL3Switch", input_param); + + /// + /// Stop Virtual Layer 3 Switch Operation (Async mode). Use this to stop the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently operating. To get a list of existing Virtual Layer 3 Switches, use the EnumL3Switch API. To call this API, you must have VPN Server administrator privileges. + /// + public VpnRpcL3Sw StopL3Switch(VpnRpcL3Sw input_param) => StopL3SwitchAsync(input_param).Result; + + /// + /// Add Virtual Interface to Virtual Layer 3 Switch (Async mode). Use this to add to a specified Virtual Layer 3 Switch, a virtual interface that connects to a Virtual Hub operating on the same VPN Server. You can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. A virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. You must define the IP network space that the virtual interface belongs to and the IP address of the interface itself. Also, you must specify the name of the Virtual Hub that the interface will connect to. You can specify a Virtual Hub that currently doesn't exist for the Virtual Hub name. The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. Routing via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public async Task AddL3IfAsync(VpnRpcL3If input_param) => await CallAsync("AddL3If", input_param); + + /// + /// Add Virtual Interface to Virtual Layer 3 Switch (Async mode). Use this to add to a specified Virtual Layer 3 Switch, a virtual interface that connects to a Virtual Hub operating on the same VPN Server. You can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. A virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. You must define the IP network space that the virtual interface belongs to and the IP address of the interface itself. Also, you must specify the name of the Virtual Hub that the interface will connect to. You can specify a Virtual Hub that currently doesn't exist for the Virtual Hub name. The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. Routing via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public VpnRpcL3If AddL3If(VpnRpcL3If input_param) => AddL3IfAsync(input_param).Result; + + /// + /// Delete Virtual Interface of Virtual Layer 3 Switch (Async mode). Use this to delete a virtual interface already defined in the specified Virtual Layer 3 Switch. You can get a list of the virtual interfaces currently defined, by using the EnumL3If API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public async Task DelL3IfAsync(VpnRpcL3If input_param) => await CallAsync("DelL3If", input_param); + + /// + /// Delete Virtual Interface of Virtual Layer 3 Switch (Async mode). Use this to delete a virtual interface already defined in the specified Virtual Layer 3 Switch. You can get a list of the virtual interfaces currently defined, by using the EnumL3If API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public VpnRpcL3If DelL3If(VpnRpcL3If input_param) => DelL3IfAsync(input_param).Result; + + /// + /// Get List of Interfaces Registered on the Virtual Layer 3 Switch (Async mode). Use this to get a list of virtual interfaces when virtual interfaces have been defined on a specified Virtual Layer 3 Switch. You can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. A virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public async Task EnumL3IfAsync(VpnRpcEnumL3If input_param) => await CallAsync("EnumL3If", input_param); + + /// + /// Get List of Interfaces Registered on the Virtual Layer 3 Switch (Async mode). Use this to get a list of virtual interfaces when virtual interfaces have been defined on a specified Virtual Layer 3 Switch. You can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. A virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public VpnRpcEnumL3If EnumL3If(VpnRpcEnumL3If input_param) => EnumL3IfAsync(input_param).Result; + + /// + /// Add Routing Table Entry for Virtual Layer 3 Switch (Async mode). Here you can add a new routing table entry to the routing table of the specified Virtual Layer 3 Switch. If the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute routing. You must specify the contents of the routing table entry to be added to the Virtual Layer 3 Switch. You must specify any IP address that belongs to the same IP network in the virtual interface of this Virtual Layer 3 Switch as the gateway address. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public async Task AddL3TableAsync(VpnRpcL3Table input_param) => await CallAsync("AddL3Table", input_param); + + /// + /// Add Routing Table Entry for Virtual Layer 3 Switch (Async mode). Here you can add a new routing table entry to the routing table of the specified Virtual Layer 3 Switch. If the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute routing. You must specify the contents of the routing table entry to be added to the Virtual Layer 3 Switch. You must specify any IP address that belongs to the same IP network in the virtual interface of this Virtual Layer 3 Switch as the gateway address. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public VpnRpcL3Table AddL3Table(VpnRpcL3Table input_param) => AddL3TableAsync(input_param).Result; + + /// + /// Delete Routing Table Entry of Virtual Layer 3 Switch (Async mode). Use this to delete a routing table entry that is defined in the specified Virtual Layer 3 Switch. You can get a list of the already defined routing table entries by using the EnumL3Table API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public async Task DelL3TableAsync(VpnRpcL3Table input_param) => await CallAsync("DelL3Table", input_param); + + /// + /// Delete Routing Table Entry of Virtual Layer 3 Switch (Async mode). Use this to delete a routing table entry that is defined in the specified Virtual Layer 3 Switch. You can get a list of the already defined routing table entries by using the EnumL3Table API. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. To execute this API, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the StopL3Switch API to stop it and then execute this API. + /// + public VpnRpcL3Table DelL3Table(VpnRpcL3Table input_param) => DelL3TableAsync(input_param).Result; + + /// + /// Get List of Routing Tables of Virtual Layer 3 Switch (Async mode). Use this to get a list of routing tables when routing tables have been defined on a specified Virtual Layer 3 Switch. If the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference this routing table and execute routing. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public async Task EnumL3TableAsync(VpnRpcEnumL3Table input_param) => await CallAsync("EnumL3Table", input_param); + + /// + /// Get List of Routing Tables of Virtual Layer 3 Switch (Async mode). Use this to get a list of routing tables when routing tables have been defined on a specified Virtual Layer 3 Switch. If the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference this routing table and execute routing. To call this API, you must have VPN Server administrator privileges. Also, this API does not operate on VPN Bridge. + /// + public VpnRpcEnumL3Table EnumL3Table(VpnRpcEnumL3Table input_param) => EnumL3TableAsync(input_param).Result; + + /// + /// Get List of Certificates Revocation List (Async mode). Use this to get a Certificates Revocation List that is set on the currently managed Virtual Hub. By registering certificates in the Certificates Revocation List, the clients who provide these certificates will be unable to connect to this Virtual Hub using certificate authentication mode. Normally with this function, in cases where the security of a private key has been compromised or where a person holding a certificate has been stripped of their privileges, by registering that certificate as invalid on the Virtual Hub, it is possible to deny user authentication when that certificate is used by a client to connect to the Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnumCrlAsync(VpnRpcEnumCrl input_param) => await CallAsync("EnumCrl", input_param); + + /// + /// Get List of Certificates Revocation List (Async mode). Use this to get a Certificates Revocation List that is set on the currently managed Virtual Hub. By registering certificates in the Certificates Revocation List, the clients who provide these certificates will be unable to connect to this Virtual Hub using certificate authentication mode. Normally with this function, in cases where the security of a private key has been compromised or where a person holding a certificate has been stripped of their privileges, by registering that certificate as invalid on the Virtual Hub, it is possible to deny user authentication when that certificate is used by a client to connect to the Virtual Hub. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcEnumCrl EnumCrl(VpnRpcEnumCrl input_param) => EnumCrlAsync(input_param).Result; + + /// + /// Add a Revoked Certificate (Async mode). Use this to add a new revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. Specify the contents to be registered in the Certificate Revocation List by using the parameters of this API. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. A certificate that matches all the conditions that are defined by the parameters specified by this API will be judged as invalid. The items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task AddCrlAsync(VpnRpcCrl input_param) => await CallAsync("AddCrl", input_param); + + /// + /// Add a Revoked Certificate (Async mode). Use this to add a new revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. Specify the contents to be registered in the Certificate Revocation List by using the parameters of this API. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. A certificate that matches all the conditions that are defined by the parameters specified by this API will be judged as invalid. The items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCrl AddCrl(VpnRpcCrl input_param) => AddCrlAsync(input_param).Result; + + /// + /// Delete a Revoked Certificate (Async mode). Use this to specify and delete a revoked certificate definition from the certificate revocation list that is set on the currently managed Virtual Hub. To get the list of currently registered revoked certificate definitions, use the EnumCrl API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task DelCrlAsync(VpnRpcCrl input_param) => await CallAsync("DelCrl", input_param); + + /// + /// Delete a Revoked Certificate (Async mode). Use this to specify and delete a revoked certificate definition from the certificate revocation list that is set on the currently managed Virtual Hub. To get the list of currently registered revoked certificate definitions, use the EnumCrl API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCrl DelCrl(VpnRpcCrl input_param) => DelCrlAsync(input_param).Result; + + /// + /// Get a Revoked Certificate (Async mode). Use this to specify and get the contents of a revoked certificate definition from the Certificates Revocation List that is set on the currently managed Virtual Hub. To get the list of currently registered revoked certificate definitions, use the EnumCrl API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetCrlAsync(VpnRpcCrl input_param) => await CallAsync("GetCrl", input_param); + + /// + /// Get a Revoked Certificate (Async mode). Use this to specify and get the contents of a revoked certificate definition from the Certificates Revocation List that is set on the currently managed Virtual Hub. To get the list of currently registered revoked certificate definitions, use the EnumCrl API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCrl GetCrl(VpnRpcCrl input_param) => GetCrlAsync(input_param).Result; + + /// + /// Change Existing CRL (Certificate Revocation List) Entry (Async mode). Use this to alter an existing revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. Specify the contents to be registered in the Certificate Revocation List by using the parameters of this API. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. A certificate that matches all the conditions that are defined by the parameters specified by this API will be judged as invalid. The items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetCrlAsync(VpnRpcCrl input_param) => await CallAsync("SetCrl", input_param); + + /// + /// Change Existing CRL (Certificate Revocation List) Entry (Async mode). Use this to alter an existing revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. Specify the contents to be registered in the Certificate Revocation List by using the parameters of this API. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. A certificate that matches all the conditions that are defined by the parameters specified by this API will be judged as invalid. The items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcCrl SetCrl(VpnRpcCrl input_param) => SetCrlAsync(input_param).Result; + + /// + /// Add Rule to Source IP Address Limit List (Async mode). Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. The items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. You can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. You can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. To get a list of the currently registered Source IP Address Limit List, use the GetAcList API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetAcListAsync(VpnRpcAcList input_param) => await CallAsync("SetAcList", input_param); + + /// + /// Add Rule to Source IP Address Limit List (Async mode). Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. The items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. You can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. You can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. To get a list of the currently registered Source IP Address Limit List, use the GetAcList API. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcAcList SetAcList(VpnRpcAcList input_param) => SetAcListAsync(input_param).Result; + + /// + /// Get List of Rule Items of Source IP Address Limit List (Async mode). Use this to get a list of Source IP Address Limit List rules that is set on the currently managed Virtual Hub. You can allow or deny VPN connections to this Virtual Hub according to the client computer's source IP address. You can define multiple rules and set a priority for each rule. The search proceeds from the rule with the highest order or priority and based on the action of the rule that the IP address first matches, the connection from the client is either allowed or denied. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetAcListAsync(VpnRpcAcList input_param) => await CallAsync("GetAcList", input_param); + + /// + /// Get List of Rule Items of Source IP Address Limit List (Async mode). Use this to get a list of Source IP Address Limit List rules that is set on the currently managed Virtual Hub. You can allow or deny VPN connections to this Virtual Hub according to the client computer's source IP address. You can define multiple rules and set a priority for each rule. The search proceeds from the rule with the highest order or priority and based on the action of the rule that the IP address first matches, the connection from the client is either allowed or denied. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcAcList GetAcList(VpnRpcAcList input_param) => GetAcListAsync(input_param).Result; + + /// + /// Get List of Log Files (Async mode). Use this to display a list of log files outputted by the VPN Server that have been saved on the VPN Server computer. By specifying a log file file name displayed here and calling it using the ReadLogFile API you can download the contents of the log file. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. + /// + public async Task EnumLogFileAsync() => await CallAsync("EnumLogFile", new VpnRpcEnumLogFile()); + + /// + /// Get List of Log Files (Async mode). Use this to display a list of log files outputted by the VPN Server that have been saved on the VPN Server computer. By specifying a log file file name displayed here and calling it using the ReadLogFile API you can download the contents of the log file. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. + /// + public VpnRpcEnumLogFile EnumLogFile() => EnumLogFileAsync().Result; + + /// + /// Download a part of Log File (Async mode). Use this to download the log file that is saved on the VPN Server computer. To download the log file first get the list of log files using the EnumLogFile API and then download the log file using the ReadLogFile API. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. + /// + public async Task ReadLogFileAsync(VpnRpcReadLogFile input_param) => await CallAsync("ReadLogFile", input_param); + + /// + /// Download a part of Log File (Async mode). Use this to download the log file that is saved on the VPN Server computer. To download the log file first get the list of log files using the EnumLogFile API and then download the log file using the ReadLogFile API. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. + /// + public VpnRpcReadLogFile ReadLogFile(VpnRpcReadLogFile input_param) => ReadLogFileAsync(input_param).Result; + + /// + /// Set syslog Send Function (Async mode). Use this to set the usage of syslog send function and which syslog server to use. + /// + public async Task SetSysLogAsync(VpnSyslogSetting input_param) => await CallAsync("SetSysLog", input_param); + + /// + /// Set syslog Send Function (Async mode). Use this to set the usage of syslog send function and which syslog server to use. + /// + public VpnSyslogSetting SetSysLog(VpnSyslogSetting input_param) => SetSysLogAsync(input_param).Result; + + /// + /// Get syslog Send Function (Async mode). This allows you to get the current setting contents of the syslog send function. You can get the usage setting of the syslog function and the host name and port number of the syslog server to use. + /// + public async Task GetSysLogAsync(VpnSyslogSetting input_param) => await CallAsync("GetSysLog", input_param); + + /// + /// Get syslog Send Function (Async mode). This allows you to get the current setting contents of the syslog send function. You can get the usage setting of the syslog function and the host name and port number of the syslog server to use. + /// + public VpnSyslogSetting GetSysLog(VpnSyslogSetting input_param) => GetSysLogAsync(input_param).Result; + + /// + /// Set Today's Message of Virtual Hub (Async mode). The message will be displayed on VPN Client UI when a user will establish a connection to the Virtual Hub. + /// + public async Task SetHubMsgAsync(VpnRpcMsg input_param) => await CallAsync("SetHubMsg", input_param); + + /// + /// Set Today's Message of Virtual Hub (Async mode). The message will be displayed on VPN Client UI when a user will establish a connection to the Virtual Hub. + /// + public VpnRpcMsg SetHubMsg(VpnRpcMsg input_param) => SetHubMsgAsync(input_param).Result; + + /// + /// Get Today's Message of Virtual Hub (Async mode). The message will be displayed on VPN Client UI when a user will establish a connection to the Virtual Hub. + /// + public async Task GetHubMsgAsync(VpnRpcMsg input_param) => await CallAsync("GetHubMsg", input_param); + + /// + /// Get Today's Message of Virtual Hub (Async mode). The message will be displayed on VPN Client UI when a user will establish a connection to the Virtual Hub. + /// + public VpnRpcMsg GetHubMsg(VpnRpcMsg input_param) => GetHubMsgAsync(input_param).Result; + + /// + /// Raise a vital error on the VPN Server / Bridge to terminate the process forcefully (Async mode). This API will raise a fatal error (memory access violation) on the VPN Server / Bridge running process in order to crash the process. As the result, VPN Server / Bridge will be terminated and restarted if it is running as a service mode. If the VPN Server is running as a user mode, the process will not automatically restarted. This API is for a situation when the VPN Server / Bridge is under a non-recoverable error or the process is in an infinite loop. This API will disconnect all VPN Sessions on the VPN Server / Bridge. All unsaved settings in the memory of VPN Server / Bridge will be lost. Before run this API, call the Flush API to try to save volatile data to the configuration file. To execute this API, you must have VPN Server / VPN Bridge administrator privileges. + /// + public async Task CrashAsync(VpnRpcTest input_param) => await CallAsync("Crash", input_param); + + /// + /// Raise a vital error on the VPN Server / Bridge to terminate the process forcefully (Async mode). This API will raise a fatal error (memory access violation) on the VPN Server / Bridge running process in order to crash the process. As the result, VPN Server / Bridge will be terminated and restarted if it is running as a service mode. If the VPN Server is running as a user mode, the process will not automatically restarted. This API is for a situation when the VPN Server / Bridge is under a non-recoverable error or the process is in an infinite loop. This API will disconnect all VPN Sessions on the VPN Server / Bridge. All unsaved settings in the memory of VPN Server / Bridge will be lost. Before run this API, call the Flush API to try to save volatile data to the configuration file. To execute this API, you must have VPN Server / VPN Bridge administrator privileges. + /// + public VpnRpcTest Crash(VpnRpcTest input_param) => CrashAsync(input_param).Result; + + /// + /// Get the message for administrators (Async mode). + /// + public async Task GetAdminMsgAsync() => await CallAsync("GetAdminMsg", new VpnRpcMsg()); + + /// + /// Get message for administrators (Sync mode) + /// + public VpnRpcMsg GetAdminMsg() => GetAdminMsgAsync().Result; + + /// + /// Save All Volatile Data of VPN Server / Bridge to the Configuration File (Async mode). The number of configuration file bytes will be returned as the "IntValue" parameter. Normally, the VPN Server / VPN Bridge retains the volatile configuration data in memory. It is flushed to the disk as vpn_server.config or vpn_bridge.config periodically. The period is 300 seconds (5 minutes) by default. (The period can be altered by modifying the AutoSaveConfigSpan item in the configuration file.) The data will be saved on the timing of shutting down normally of the VPN Server / Bridge. Execute the Flush API to make the VPN Server / Bridge save the settings to the file immediately. The setting data will be stored on the disk drive of the server computer. Use the Flush API in a situation that you do not have an enough time to shut down the server process normally. To call this API, you must have VPN Server administrator privileges. To execute this API, you must have VPN Server / VPN Bridge administrator privileges. + /// + public async Task FlushAsync(VpnRpcTest input_param) => await CallAsync("Flush", input_param); + + /// + /// Save All Volatile Data of VPN Server / Bridge to the Configuration File (Sync mode). The number of configuration file bytes will be returned as the "IntValue" parameter. Normally, the VPN Server / VPN Bridge retains the volatile configuration data in memory. It is flushed to the disk as vpn_server.config or vpn_bridge.config periodically. The period is 300 seconds (5 minutes) by default. (The period can be altered by modifying the AutoSaveConfigSpan item in the configuration file.) The data will be saved on the timing of shutting down normally of the VPN Server / Bridge. Execute the Flush API to make the VPN Server / Bridge save the settings to the file immediately. The setting data will be stored on the disk drive of the server computer. Use the Flush API in a situation that you do not have an enough time to shut down the server process normally. To call this API, you must have VPN Server administrator privileges. To execute this API, you must have VPN Server / VPN Bridge administrator privileges. + /// + public VpnRpcTest Flush(VpnRpcTest input_param) => FlushAsync(input_param).Result; + + /// + /// Enable or Disable IPsec VPN Server Function (Async mode). Enable or Disable IPsec VPN Server Function on the VPN Server. If you enable this function, Virtual Hubs on the VPN Server will be able to accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP Site-to-Site VPN Connection. VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from native VPN Clients on Mac OS X and Windows can be accepted. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetIPsecServicesAsync(VpnIPsecServices input_param) => await CallAsync("SetIPsecServices", input_param); + + /// + /// Enable or Disable IPsec VPN Server Function (Async mode). Enable or Disable IPsec VPN Server Function on the VPN Server. If you enable this function, Virtual Hubs on the VPN Server will be able to accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP Site-to-Site VPN Connection. VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from native VPN Clients on Mac OS X and Windows can be accepted. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnIPsecServices SetIPsecServices(VpnIPsecServices input_param) => SetIPsecServicesAsync(input_param).Result; + + /// + /// Get the Current IPsec VPN Server Settings (Async mode). Get and view the current IPsec VPN Server settings on the VPN Server. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetIPsecServicesAsync() => await CallAsync("GetIPsecServices", new VpnIPsecServices()); + + /// + /// Get the Current IPsec VPN Server Settings (Async mode). Get and view the current IPsec VPN Server settings on the VPN Server. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnIPsecServices GetIPsecServices() => GetIPsecServicesAsync().Result; + + /// + /// Add New EtherIP / L2TPv3 over IPsec Client Setting to Accept EthreIP / L2TPv3 Client Devices (Async mode). Add a new setting entry to enable the EtherIP / L2TPv3 over IPsec Server Function to accept client devices. In order to accept connections from routers by the EtherIP / L2TPv3 over IPsec Server Function, you have to define the relation table between an IPsec Phase 1 string which is presented by client devices of EtherIP / L2TPv3 over IPsec compatible router, and the designation of the destination Virtual Hub. After you add a definition entry by AddEtherIpId API, the defined connection setting to the Virtual Hub will be applied on the login-attepting session from an EtherIP / L2TPv3 over IPsec client device. The username and password in an entry must be registered on the Virtual Hub. An EtherIP / L2TPv3 client will be regarded as it connected the Virtual HUB with the identification of the above user information. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task AddEtherIpIdAsync(VpnEtherIpId input_param) => await CallAsync("AddEtherIpId", input_param); + + /// + /// Add New EtherIP / L2TPv3 over IPsec Client Setting to Accept EthreIP / L2TPv3 Client Devices (Async mode). Add a new setting entry to enable the EtherIP / L2TPv3 over IPsec Server Function to accept client devices. In order to accept connections from routers by the EtherIP / L2TPv3 over IPsec Server Function, you have to define the relation table between an IPsec Phase 1 string which is presented by client devices of EtherIP / L2TPv3 over IPsec compatible router, and the designation of the destination Virtual Hub. After you add a definition entry by AddEtherIpId API, the defined connection setting to the Virtual Hub will be applied on the login-attepting session from an EtherIP / L2TPv3 over IPsec client device. The username and password in an entry must be registered on the Virtual Hub. An EtherIP / L2TPv3 client will be regarded as it connected the Virtual HUB with the identification of the above user information. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnEtherIpId AddEtherIpId(VpnEtherIpId input_param) => AddEtherIpIdAsync(input_param).Result; + + /// + /// Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions (Async mode). This API gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetEtherIpIdAsync(VpnEtherIpId input_param) => await CallAsync("GetEtherIpId", input_param); + + /// + /// Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions (Async mode). This API gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnEtherIpId GetEtherIpId(VpnEtherIpId input_param) => GetEtherIpIdAsync(input_param).Result; + + /// + /// Delete an EtherIP / L2TPv3 over IPsec Client Setting (Async mode). This API deletes an entry to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task DeleteEtherIpIdAsync(VpnEtherIpId input_param) => await CallAsync("DeleteEtherIpId", input_param); + + /// + /// Delete an EtherIP / L2TPv3 over IPsec Client Setting (Async mode). This API deletes an entry to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnEtherIpId DeleteEtherIpId(VpnEtherIpId input_param) => DeleteEtherIpIdAsync(input_param).Result; + + /// + /// Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions (Async mode). This API gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task EnumEtherIpIdAsync() => await CallAsync("EnumEtherIpId", new VpnRpcEnumEtherIpId()); + + /// + /// Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions (Async mode). This API gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcEnumEtherIpId EnumEtherIpId() => EnumEtherIpIdAsync().Result; + + /// + /// Set Settings for OpenVPN Clone Server Function (Async mode). The VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc. Any OpenVPN Clients can connect to this VPN Server. The manner to specify a username to connect to the Virtual Hub, and the selection rule of default Hub by using this clone server functions are same to the IPsec Server functions. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetOpenVpnSstpConfigAsync(VpnOpenVpnSstpConfig input_param) => await CallAsync("SetOpenVpnSstpConfig", input_param); + + /// + /// Set Settings for OpenVPN Clone Server Function (Async mode). The VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc. Any OpenVPN Clients can connect to this VPN Server. The manner to specify a username to connect to the Virtual Hub, and the selection rule of default Hub by using this clone server functions are same to the IPsec Server functions. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnOpenVpnSstpConfig SetOpenVpnSstpConfig(VpnOpenVpnSstpConfig input_param) => SetOpenVpnSstpConfigAsync(input_param).Result; + + /// + /// Get the Current Settings of OpenVPN Clone Server Function (Async mode). Get and show the current settings of OpenVPN Clone Server Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetOpenVpnSstpConfigAsync() => await CallAsync("GetOpenVpnSstpConfig", new VpnOpenVpnSstpConfig()); + + /// + /// Get the Current Settings of OpenVPN Clone Server Function (Async mode). Get and show the current settings of OpenVPN Clone Server Function. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnOpenVpnSstpConfig GetOpenVpnSstpConfig() => GetOpenVpnSstpConfigAsync().Result; + + /// + /// Show the Current Status of Dynamic DNS Function (Async mode). Get and show the current status of the Dynamic DNS function. The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. Also, if your ISP assignes you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address. Therefore, you need not any longer to keep static global IP addresses with expenses monthly costs. [Caution] To disable the Dynamic DNS Function, modify the configuration file of VPN Server. The "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public async Task GetDDnsClientStatusAsync() => await CallAsync("GetDDnsClientStatus", new VpnDDnsClientStatus()); + + /// + /// Show the Current Status of Dynamic DNS Function (Async mode). Get and show the current status of the Dynamic DNS function. The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. Also, if your ISP assignes you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address. Therefore, you need not any longer to keep static global IP addresses with expenses monthly costs. [Caution] To disable the Dynamic DNS Function, modify the configuration file of VPN Server. The "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public VpnDDnsClientStatus GetDDnsClientStatus() => GetDDnsClientStatusAsync().Result; + + /// + /// Set the Dynamic DNS Hostname (Async mode). You must specify the new hostname on the StrValue_str field. You can use this API to change the hostname assigned by the Dynamic DNS function. The currently assigned hostname can be showen by the GetDDnsClientStatus API. The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. Also, if your ISP assignes you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address. Therefore, you need not any longer to keep static global IP addresses with expenses monthly costs. [Caution] To disable the Dynamic DNS Function, modify the configuration file of VPN Server. The "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public async Task ChangeDDnsClientHostnameAsync(VpnRpcTest input_param) => await CallAsync("ChangeDDnsClientHostname", input_param); + + /// + /// Set the Dynamic DNS Hostname (Async mode). You must specify the new hostname on the StrValue_str field. You can use this API to change the hostname assigned by the Dynamic DNS function. The currently assigned hostname can be showen by the GetDDnsClientStatus API. The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. Also, if your ISP assignes you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address. Therefore, you need not any longer to keep static global IP addresses with expenses monthly costs. [Caution] To disable the Dynamic DNS Function, modify the configuration file of VPN Server. The "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcTest ChangeDDnsClientHostname(VpnRpcTest input_param) => ChangeDDnsClientHostnameAsync(input_param).Result; + + /// + /// Generate New Self-Signed Certificate with Specified CN (Common Name) and Register on VPN Server (Async mode). You can specify the new CN (common name) value on the StrValue_str field. You can use this API to replace the current certificate on the VPN Server to a new self-signed certificate which has the CN (Common Name) value in the fields. This API is convenient if you are planning to use Microsoft SSTP VPN Clone Server Function. Because of the value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the SSTP VPN client. This API will delete the existing SSL certificate of the VPN Server. It is recommended to backup the current SSL certificate and private key by using the GetServerCert API beforehand. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task RegenerateServerCertAsync(VpnRpcTest input_param) => await CallAsync("RegenerateServerCert", input_param); + + /// + /// Generate New Self-Signed Certificate with Specified CN (Common Name) and Register on VPN Server (Async mode). You can specify the new CN (common name) value on the StrValue_str field. You can use this API to replace the current certificate on the VPN Server to a new self-signed certificate which has the CN (Common Name) value in the fields. This API is convenient if you are planning to use Microsoft SSTP VPN Clone Server Function. Because of the value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the SSTP VPN client. This API will delete the existing SSL certificate of the VPN Server. It is recommended to backup the current SSL certificate and private key by using the GetServerCert API beforehand. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcTest RegenerateServerCert(VpnRpcTest input_param) => RegenerateServerCertAsync(input_param).Result; + + /// + /// Generate a Sample Setting File for OpenVPN Client (Async mode). Originally, the OpenVPN Client requires a user to write a very difficult configuration file manually. This API helps you to make a useful configuration sample. What you need to generate the configuration file for the OpenVPN Client is to run this API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task MakeOpenVpnConfigFileAsync() => await CallAsync("MakeOpenVpnConfigFile", new VpnRpcReadLogFile()); + + /// + /// Generate a Sample Setting File for OpenVPN Client (Async mode). Originally, the OpenVPN Client requires a user to write a very difficult configuration file manually. This API helps you to make a useful configuration sample. What you need to generate the configuration file for the OpenVPN Client is to run this API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcReadLogFile MakeOpenVpnConfigFile() => MakeOpenVpnConfigFileAsync().Result; + + /// + /// Enable / Disable the VPN over ICMP / VPN over DNS Server Function (Async mode). You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You have to enable the following functions beforehand. Warning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public async Task SetSpecialListenerAsync(VpnRpcSpecialListener input_param) => await CallAsync("SetSpecialListener", input_param); + + /// + /// Enable / Disable the VPN over ICMP / VPN over DNS Server Function (Async mode). You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You have to enable the following functions beforehand. Warning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcSpecialListener SetSpecialListener(VpnRpcSpecialListener input_param) => SetSpecialListenerAsync(input_param).Result; + + /// + /// Get Current Setting of the VPN over ICMP / VPN over DNS Function (Async mode). Get and show the current VPN over ICMP / VPN over DNS Function status. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public async Task GetSpecialListenerAsync() => await CallAsync("GetSpecialListener", new VpnRpcSpecialListener()); + + /// + /// Get Current Setting of the VPN over ICMP / VPN over DNS Function (Async mode). Get and show the current VPN over ICMP / VPN over DNS Function status. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. + /// + public VpnRpcSpecialListener GetSpecialListener() => GetSpecialListenerAsync().Result; + + /// + /// Show the current status of VPN Azure function (Async mode). Get and show the current status of the VPN Azure function. VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. VPN Azure is a cloud VPN service operated by SoftEther Corporation. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions. The VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the ChangeDDnsClientHostname API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task GetAzureStatusAsync() => await CallAsync("GetAzureStatus", new VpnRpcAzureStatus()); + + /// + /// Show the current status of VPN Azure function (Async mode). Get and show the current status of the VPN Azure function. VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. VPN Azure is a cloud VPN service operated by SoftEther Corporation. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions. The VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the ChangeDDnsClientHostname API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcAzureStatus GetAzureStatus() => GetAzureStatusAsync().Result; + + /// + /// Enable / Disable VPN Azure Function (Async mode). Enable or disable the VPN Azure function. VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. VPN Azure is a cloud VPN service operated by SoftEther Corporation. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions. The VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the ChangeDDnsClientHostname API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public async Task SetAzureStatusAsync(VpnRpcAzureStatus input_param) => await CallAsync("SetAzureStatus", input_param); + + /// + /// Enable / Disable VPN Azure Function (Async mode). Enable or disable the VPN Azure function. VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. VPN Azure is a cloud VPN service operated by SoftEther Corporation. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions. The VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the ChangeDDnsClientHostname API. To call this API, you must have VPN Server administrator privileges. This API cannot be invoked on VPN Bridge. You cannot execute this API for Virtual Hubs of VPN Servers operating as a cluster. + /// + public VpnRpcAzureStatus SetAzureStatus(VpnRpcAzureStatus input_param) => SetAzureStatusAsync(input_param).Result; + + /// + /// Get the Proxy Settings for Connecting to the DDNS server (Async mode). + /// + public async Task GetDDnsInternetSettngAsync() => await CallAsync("GetDDnsInternetSettng", new VpnInternetSetting()); + + /// + /// Get the Proxy Settings for Connecting to the DDNS server (Async mode). + /// + public VpnInternetSetting GetDDnsInternetSettng() => GetDDnsInternetSettngAsync().Result; + + /// + /// Set the Proxy Settings for Connecting to the DDNS server (Async mode). + /// + public async Task SetDDnsInternetSettngAsync(VpnInternetSetting input_param) => await CallAsync("SetDDnsInternetSettng", input_param); + + /// + /// Set the Proxy Settings for Connecting to the DDNS server (Sync mode). + /// + public VpnInternetSetting SetDDnsInternetSettng(VpnInternetSetting input_param) => SetDDnsInternetSettngAsync(input_param).Result; + + /// + /// Set the VPN Gate Server Configuration (Async mode). This API is valid for Win32 binary distribution of the Stable Edition of SoftEther VPN Server. + /// + public async Task SetVgsConfigAsync(VpnVgsConfig input_param) => await CallAsync("SetVgsConfig", input_param); + + /// + /// Set the VPN Gate Server Configuration (Sync mode). This API is valid for Win32 binary distribution of the Stable Edition of SoftEther VPN Server. + /// + public VpnVgsConfig SetVgsConfig(VpnVgsConfig input_param) => SetVgsConfigAsync(input_param).Result; + + /// + /// Get the VPN Gate Server Configuration (Async mode). This API is valid for Win32 binary distribution of the Stable Edition of SoftEther VPN Server. + /// + public async Task GetVgsConfigAsync() => await CallAsync("GetVgsConfig", new VpnVgsConfig()); + + /// + /// Get the VPN Gate Server Configuration (Sync mode). This API is valid for Win32 binary distribution of the Stable Edition of SoftEther VPN Server. + /// + public VpnVgsConfig GetVgsConfig() => GetVgsConfigAsync().Result; + + + } +} diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs new file mode 100644 index 00000000..08db87e4 --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs @@ -0,0 +1,5381 @@ +// SoftEther VPN Server JSON-RPC Stub code for C# +// +// VPNServerRpcTypes.cs - Data Type Definition for SoftEther VPN Server JSON-RPC Stubs +// +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +using System; +using Newtonsoft.Json; + +namespace SoftEther.VPNServerRpc +{ + /// + /// IP Protocol Numbers + /// + public enum VpnIpProtocolNumber + { + /// + /// ICMP for IPv4 + /// + ICMPv4 = 1, + + /// + /// TCP + /// + TCP = 6, + + /// + /// UDP + /// + UDP = 17, + + /// + /// ICMP for IPv6 + /// + ICMPv6 = 58, + } + + /// + /// The body of the Access list + /// + public class VpnAccess + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// Specify a description (note) for this rule + /// + public string Note_utf; + + /// + /// Enabled flag (true: enabled, false: disabled) + /// + public bool Active_bool; + + /// + /// Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. + /// + public uint Priority_u32; + + /// + /// The flag if the rule is DISCARD operation or PASS operation. When a packet matches this rule condition, this operation is decided. When the operation of the rule is PASS, the packet is allowed to pass, otherwise the packet will be discarded. + /// + public bool Discard_bool; + + /// + /// The flag if the rule is for IPv6. Specify false for IPv4, or specify true for IPv6. + /// + public bool IsIPv6_bool; + + /// + /// Valid only if the rule is IPv4 mode (IsIPv6_bool == false). Specify a source IPv4 address as a rule condition. You must also specify the SrcSubnetMask_ip field. + /// + public string SrcIpAddress_ip; + + /// + /// Valid only if the rule is IPv4 mode (IsIPv6_bool == false). Specify a source IPv4 subnet mask as a rule condition. "0.0.0.0" means all hosts. "255.255.255.255" means one single host. + /// + public string SrcSubnetMask_ip; + + /// + /// Valid only if the rule is IPv4 mode (IsIPv6_bool == false). Specify a destination IPv4 address as a rule condition. You must also specify the DestSubnetMask_ip field. + /// + public string DestIpAddress_ip; + + /// + /// Valid only if the rule is IPv4 mode (IsIPv6_bool == false). Specify a destination IPv4 subnet mask as a rule condition. "0.0.0.0" means all hosts. "255.255.255.255" means one single host. + /// + public string DestSubnetMask_ip; + + /// + /// Valid only if the rule is IPv6 mode (IsIPv6_bool == true). Specify a source IPv6 address as a rule condition. The field must be a byte array of 16 bytes (128 bits) to contain the IPv6 address in binary form. You must also specify the SrcSubnetMask6_bin field. + /// + public byte[] SrcIpAddress6_bin; + + /// + /// Valid only if the rule is IPv6 mode (IsIPv6_bool == true). Specify a source IPv6 subnet mask as a rule condition. The field must be a byte array of 16 bytes (128 bits) to contain the IPv6 subnet mask in binary form. + /// + public byte[] SrcSubnetMask6_bin; + + /// + /// Valid only if the rule is IPv6 mode (IsIPv6_bool == true). Specify a destination IPv6 address as a rule condition. The field must be a byte array of 16 bytes (128 bits) to contain the IPv6 address in binary form. You must also specify the DestSubnetMask6_bin field. + /// + public byte[] DestIpAddress6_bin; + + /// + /// Valid only if the rule is IPv6 mode (IsIPv6_bool == true). Specify a destination IPv6 subnet mask as a rule condition. The field must be a byte array of 16 bytes (128 bits) to contain the IPv6 subnet mask in binary form. + /// + public byte[] DestSubnetMask6_bin; + + /// + /// The IP protocol number + /// + public VpnIpProtocolNumber Protocol_u32; + + /// + /// The Start Value of the Source Port Number Range. If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. + /// + public uint SrcPortStart_u32; + + /// + /// The End Value of the Source Port Number Range. If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. + /// + public uint SrcPortEnd_u32; + + /// + /// The Start Value of the Destination Port Number Range. If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. + /// + public uint DestPortStart_u32; + + /// + /// The End Value of the Destination Port Number Range. If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. + /// + public uint DestPortEnd_u32; + + /// + /// Source user name. You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. + /// + public string SrcUsername_str; + + /// + /// Destination user name. You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. + /// + public string DestUsername_str; + + /// + /// Specify true if you want to check the source MAC address. + /// + public bool CheckSrcMac_bool; + + /// + /// Source MAC address (6 bytes), valid only if CheckSrcMac_bool == true. + /// + public byte[] SrcMacAddress_bin; + + /// + /// Source MAC address mask (6 bytes), valid only if CheckSrcMac_bool == true. + /// + public byte[] SrcMacMask_bin; + + /// + /// Specify true if you want to check the destination MAC address. + /// + public bool CheckDstMac_bool; + + /// + /// Destination MAC address (6 bytes), valid only if CheckSrcMac_bool == true. + /// + public byte[] DstMacAddress_bin; + + /// + /// Destination MAC address mask (6 bytes), valid only if CheckSrcMac_bool == true. + /// + public byte[] DstMacMask_bin; + + /// + /// Specify true if you want to check the state of the TCP connection. + /// + public bool CheckTcpState_bool; + + /// + /// Valid only if CheckTcpState_bool == true. Set this field true to match only TCP-established packets. Set this field false to match only TCP-non established packets. + /// + public bool Established_bool; + + /// + /// Set this value to generate delays when packets is passing. Specify the delay period in milliseconds. Specify 0 means no delays to generate. The delays must be 10000 milliseconds at most. + /// + public uint Delay_u32; + + /// + /// Set this value to generate jitters when packets is passing. Specify the ratio of fluctuation of jitters within 0% to 100% range. Specify 0 means no jitters to generate. + /// + public uint Jitter_u32; + + /// + /// Set this value to generate packet losses when packets is passing. Specify the ratio of packet losses within 0% to 100% range. Specify 0 means no packet losses to generate. + /// + public uint Loss_u32; + + /// + /// The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. + /// + public string RedirectUrl_str; + } + + /// + /// Add an item to Access List + /// + public class VpnRpcAddAccess + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Access list (Must be a single item) + /// + public VpnAccess[] AccessListSingle; + } + + /// + /// Add CA to HUB + /// + public class VpnRpcHubAddCA + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The body of the X.509 certificate + /// + public byte[] Cert_bin; + } + + /// + /// CRL entry + /// + public class VpnRpcCrl + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Key ID + /// + public uint Key_u32; + + /// + /// CN, optional + /// + public string CommonName_utf; + + /// + /// O, optional + /// + public string Organization_utf; + + /// + /// OU, optional + /// + public string Unit_utf; + + /// + /// C, optional + /// + public string Country_utf; + + /// + /// ST, optional + /// + public string State_utf; + + /// + /// L, optional + /// + public string Local_utf; + + /// + /// Serial, optional + /// + public byte[] Serial_bin; + + /// + /// MD5 Digest, optional + /// + public byte[] DigestMD5_bin; + + /// + /// SHA1 Digest, optional + /// + public byte[] DigestSHA1_bin; + } + + /// + /// EtherIP key list entry + /// + public class VpnEtherIpId + { + /// + /// Specify an ISAKMP Phase 1 ID. The ID must be exactly same as a ID in the configuration of the EtherIP / L2TPv3 Client. You can specify IP address as well as characters as ID, if the EtherIP Client uses IP address as Phase 1 ID. If you specify '*' (asterisk), it will be a wildcard to match any clients which doesn't match other explicit rules. + /// + public string Id_str; + + /// + /// Specify the name of the Virtual Hub to connect. + /// + public string HubName_str; + + /// + /// Specify the username to login to the destination Virtual Hub. + /// + public string UserName_str; + + /// + /// Specify the password to login to the destination Virtual Hub. + /// + public string Password_str; + } + + /// + /// Layer-3 virtual interface + /// + public class VpnRpcL3If + { + /// + /// L3 switch name + /// + public string Name_str; + + /// + /// Virtual HUB name + /// + public string HubName_str; + + /// + /// IP address + /// + public string IpAddress_ip; + + /// + /// Subnet mask + /// + public string SubnetMask_ip; + } + + /// + /// Layer-3 switch + /// + public class VpnRpcL3Sw + { + /// + /// Layer-3 Switch name + /// + public string Name_str; + } + + /// + /// Routing table + /// + public class VpnRpcL3Table + { + /// + /// L3 switch name + /// + public string Name_str; + + /// + /// Network address + /// + public string NetworkAddress_ip; + + /// + /// Subnet mask + /// + public string SubnetMask_ip; + + /// + /// Gateway address + /// + public string GatewayAddress_ip; + + /// + /// Metric + /// + public uint Metric_u32; + } + + /// + /// Generic parameter to contain u32, u64, ascii_string and unicode string + /// + public class VpnRpcTest + { + /// + /// A 32-bit integer field + /// + public uint IntValue_u32; + + /// + /// A 64-bit integer field + /// + public ulong Int64Value_u64; + + /// + /// An Ascii string field + /// + public string StrValue_str; + + /// + /// An UTF-8 string field + /// + public string UniStrValue_utf; + } + + /// + /// Local Bridge list item + /// + public class VpnRpcLocalBridge + { + /// + /// Physical Ethernet device name + /// + public string DeviceName_str; + + /// + /// The Virtual Hub name + /// + public string HubNameLB_str; + + /// + /// Online flag + /// + public bool Online_bool; + + /// + /// Running flag + /// + public bool Active_bool; + + /// + /// Specify true if you are using a tap device rather than a network adapter for the bridge destination (only supported for Linux versions). + /// + public bool TapMode_bool; + } + + /// + /// Create, configure, and get the group + /// + public class VpnRpcSetGroup + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The group name + /// + public string Name_str; + + /// + /// Optional real name (full name) of the group, allow using any Unicode characters + /// + public string Realname_utf; + + /// + /// Optional, specify a description of the group + /// + public string Note_utf; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + + /// + /// The flag whether to use security policy + /// + public bool UsePolicy_bool; + + // ---- Start of Security policy --- + /// + /// Security policy: Allow Access. The users, which this policy value is true, have permission to make VPN connection to VPN Server. + /// + [JsonProperty("policy:Access_bool")] + public bool SecPol_Access_bool; + + /// + /// Security policy: Filter DHCP Packets (IPv4). All IPv4 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPFilter_bool")] + public bool SecPol_DHCPFilter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv4). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv4 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPNoServer_bool")] + public bool SecPol_DHCPNoServer_bool; + + /// + /// Security policy: Enforce DHCP Allocated IP Addresses (IPv4). Computers in sessions that have this policy setting will only be able to use IPv4 addresses allocated by a DHCP server on the virtual network side. + /// + [JsonProperty("policy:DHCPForce_bool")] + public bool SecPol_DHCPForce_bool; + + /// + /// Security policy: Deny Bridge Operation. Bridge-mode connections are denied for user sessions that have this policy setting. Even in cases when the Ethernet Bridge is configured in the client side, communication will not be possible. + /// + [JsonProperty("policy:NoBridge_bool")] + public bool SecPol_NoBridge_bool; + + /// + /// Security policy: Deny Routing Operation (IPv4). IPv4 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. + /// + [JsonProperty("policy:NoRouting_bool")] + public bool SecPol_NoRouting_bool; + + /// + /// Security policy: Deny MAC Addresses Duplication. The use of duplicating MAC addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckMac_bool")] + public bool SecPol_CheckMac_bool; + + /// + /// Security policy: Deny IP Address Duplication (IPv4). The use of duplicating IPv4 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckIP_bool")] + public bool SecPol_CheckIP_bool; + + /// + /// Security policy: Deny Non-ARP / Non-DHCP / Non-ICMPv6 broadcasts. The sending or receiving of broadcast packets that are not ARP protocol, DHCP protocol, nor ICMPv6 on the virtual network will not be allowed for sessions with this policy setting. + /// + [JsonProperty("policy:ArpDhcpOnly_bool")] + public bool SecPol_ArpDhcpOnly_bool; + + /// + /// Security policy: Privacy Filter Mode. All direct communication between sessions with the privacy filter mode policy setting will be filtered. + /// + [JsonProperty("policy:PrivacyFilter_bool")] + public bool SecPol_PrivacyFilter_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv4). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv4. + /// + [JsonProperty("policy:NoServer_bool")] + public bool SecPol_NoServer_bool; + + /// + /// Security policy: Unlimited Number of Broadcasts. If a computer of a session with this policy setting sends broadcast packets of a number unusually larger than what would be considered normal on the virtual network, there will be no automatic limiting. + /// + [JsonProperty("policy:NoBroadcastLimiter_bool")] + public bool SecPol_NoBroadcastLimiter_bool; + + /// + /// Security policy: Allow Monitoring Mode. Users with this policy setting will be granted to connect to the Virtual Hub in Monitoring Mode. Sessions in Monitoring Mode are able to monitor (tap) all packets flowing through the Virtual Hub. + /// + [JsonProperty("policy:MonitorPort_bool")] + public bool SecPol_MonitorPort_bool; + + /// + /// Security policy: Maximum Number of TCP Connections. For sessions with this policy setting, this sets the maximum number of physical TCP connections consists in a physical VPN session. + /// + [JsonProperty("policy:MaxConnection_u32")] + public uint SecPol_MaxConnection_u32; + + /// + /// Security policy: Time-out Period. For sessions with this policy setting, this sets, in seconds, the time-out period to wait before disconnecting a session when communication trouble occurs between the VPN Client / VPN Server. + /// + [JsonProperty("policy:TimeOut_u32")] + public uint SecPol_TimeOut_u32; + + /// + /// Security policy: Maximum Number of MAC Addresses. For sessions with this policy setting, this limits the number of MAC addresses per session. + /// + [JsonProperty("policy:MaxMac_u32")] + public uint SecPol_MaxMac_u32; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv4). For sessions with this policy setting, this specifies the number of IPv4 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIP_u32")] + public uint SecPol_MaxIP_u32; + + /// + /// Security policy: Upload Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the inwards direction from outside to inside the Virtual Hub. + /// + [JsonProperty("policy:MaxUpload_u32")] + public uint SecPol_MaxUpload_u32; + + /// + /// Security policy: Download Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the outwards direction from inside the Virtual Hub to outside the Virtual Hub. + /// + [JsonProperty("policy:MaxDownload_u32")] + public uint SecPol_MaxDownload_u32; + + /// + /// Security policy: Deny Changing Password. The users which use password authentication with this policy setting are not allowed to change their own password from the VPN Client Manager or similar. + /// + [JsonProperty("policy:FixPassword_bool")] + public bool SecPol_FixPassword_bool; + + /// + /// Security policy: Maximum Number of Multiple Logins. Users with this policy setting are unable to have more than this number of concurrent logins. Bridge Mode sessions are not subjects to this policy. + /// + [JsonProperty("policy:MultiLogins_u32")] + public uint SecPol_MultiLogins_u32; + + /// + /// Security policy: Deny VoIP / QoS Function. Users with this security policy are unable to use VoIP / QoS functions in VPN connection sessions. + /// + [JsonProperty("policy:NoQoS_bool")] + public bool SecPol_NoQoS_bool; + + /// + /// Security policy: Filter RS / RA Packets (IPv6). All ICMPv6 packets which the message-type is 133 (Router Solicitation) or 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, an IPv6 client will be unable to use IPv6 address prefix auto detection and IPv6 default gateway auto detection. + /// + [JsonProperty("policy:RSandRAFilter_bool")] + public bool SecPol_RSandRAFilter_bool; + + /// + /// Security policy: Filter RA Packets (IPv6). All ICMPv6 packets which the message-type is 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, a malicious users will be unable to spread illegal IPv6 prefix or default gateway advertisements on the network. + /// + [JsonProperty("policy:RAFilter_bool")] + public bool SecPol_RAFilter_bool; + + /// + /// Security policy: Filter DHCP Packets (IPv6). All IPv6 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPv6Filter_bool")] + public bool SecPol_DHCPv6Filter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv6). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv6 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPv6NoServer_bool")] + public bool SecPol_DHCPv6NoServer_bool; + + /// + /// Security policy: Deny Routing Operation (IPv6). IPv6 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. + /// + [JsonProperty("policy:NoRoutingV6_bool")] + public bool SecPol_NoRoutingV6_bool; + + /// + /// Security policy: Deny IP Address Duplication (IPv6). The use of duplicating IPv6 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckIPv6_bool")] + public bool SecPol_CheckIPv6_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv6). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv6. + /// + [JsonProperty("policy:NoServerV6_bool")] + public bool SecPol_NoServerV6_bool; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv6). For sessions with this policy setting, this specifies the number of IPv6 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIPv6_u32")] + public uint SecPol_MaxIPv6_u32; + + /// + /// Security policy: Disallow Password Save in VPN Client. For users with this policy setting, when the user is using *standard* password authentication, the user will be unable to save the password in VPN Client. The user will be required to input passwords for every time to connect a VPN. This will improve the security. If this policy is enabled, VPN Client Version 2.0 will be denied to access. + /// + [JsonProperty("policy:NoSavePassword_bool")] + public bool SecPol_NoSavePassword_bool; + + /// + /// Security policy: VPN Client Automatic Disconnect. For users with this policy setting, a user's VPN session will be disconnected automatically after the specific period will elapse. In this case no automatic re-connection will be performed. This can prevent a lot of inactive VPN Sessions. If this policy is enabled, VPN Client Version 2.0 will be denied to access. + /// + [JsonProperty("policy:AutoDisconnect_u32")] + public uint SecPol_AutoDisconnect_u32; + + /// + /// Security policy: Filter All IPv4 Packets. All IPv4 and ARP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv4_bool")] + public bool SecPol_FilterIPv4_bool; + + /// + /// Security policy: Filter All IPv6 Packets. All IPv6 packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv6_bool")] + public bool SecPol_FilterIPv6_bool; + + /// + /// Security policy: Filter All Non-IP Packets. All non-IP packets in sessions defined this policy will be filtered. "Non-IP packet" mean a packet which is not IPv4, ARP nor IPv6. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. + /// + [JsonProperty("policy:FilterNonIP_bool")] + public bool SecPol_FilterNonIP_bool; + + /// + /// Security policy: No Default-Router on IPv6 RA. In all VPN Sessions defines this policy, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. + /// + [JsonProperty("policy:NoIPv6DefaultRouterInRA_bool")] + public bool SecPol_NoIPv6DefaultRouterInRA_bool; + + /// + /// Security policy: No Default-Router on IPv6 RA (physical IPv6). In all VPN Sessions defines this policy (only when the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6), any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. + /// + [JsonProperty("policy:NoIPv6DefaultRouterInRAWhenIPv6_bool")] + public bool SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool; + + /// + /// Security policy: VLAN ID (IEEE802.1Q). You can specify the VLAN ID on the security policy. All VPN Sessions defines this policy, all Ethernet packets toward the Virtual Hub from the user will be inserted a VLAN tag (IEEE 802.1Q) with the VLAN ID. The user can also receive only packets with a VLAN tag which has the same VLAN ID. (Receiving process removes the VLAN tag automatically.) Any Ethernet packets with any other VLAN IDs or non-VLAN packets will not be received. All VPN Sessions without this policy definition can send / receive any kinds of Ethernet packets regardless of VLAN tags, and VLAN tags are not inserted or removed automatically. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. Therefore, tagged-VLAN packets are not subjects for IPv4 / IPv6 security policies, access lists nor other IPv4 / IPv6 specific deep processing. + /// + [JsonProperty("policy:VLanId_u32")] + public uint SecPol_VLanId_u32; + + /// + /// Security policy: Whether version 3.0 (must be true) + /// + [JsonProperty("policy:Ver3_bool")] + public bool SecPol_Ver3_bool = true; + // ---- End of Security policy --- + } + + /// + /// Hub types + /// + public enum VpnRpcHubType + { + /// + /// Stand-alone HUB + /// + Standalone = 0, + + /// + /// Static HUB + /// + FarmStatic = 1, + + /// + /// Dynamic HUB + /// + FarmDynamic = 2, + } + + /// + /// Create a HUB + /// + public class VpnRpcCreateHub + { + /// + /// Specify the name of the Virtual Hub to create / update. + /// + public string HubName_str; + + /// + /// Specify an administrator password when the administrator password is going to be set for the Virtual Hub. On the update, leave it to empty string if you don't want to change the password. + /// + public string AdminPasswordPlainText_str; + + /// + /// Online flag + /// + public bool Online_bool; + + /// + /// Maximum number of VPN sessions + /// + public uint MaxSession_u32; + + /// + /// No Enum flag. By enabling this option, the VPN Client user will be unable to enumerate this Virtual Hub even if they send a Virtual Hub enumeration request to the VPN Server. + /// + public bool NoEnum_bool; + + /// + /// Type of the Virtual Hub (Valid only for Clustered VPN Servers) + /// + public VpnRpcHubType HubType_u32; + } + + public enum VpnRpcClientAuthType + { + /// + /// Anonymous authentication + /// + Anonymous = 0, + + /// + /// SHA-0 hashed password authentication + /// + SHA0_Hashed_Password = 1, + + /// + /// Plain password authentication + /// + PlainPassword = 2, + + /// + /// Certificate authentication + /// + Cert = 3, + } + + /// + /// Create and set of link + /// + public class VpnRpcCreateLink + { + /// + /// The Virtual Hub name + /// + public string HubName_Ex_str; + + /// + /// Online flag + /// + public bool Online_bool; + + /// + /// The flag to enable validation for the server certificate + /// + public bool CheckServerCert_bool; + + /// + /// The body of server X.509 certificate to compare. Valid only if the CheckServerCert_bool flag is true. + /// + public byte[] ServerCert_bin; + + // ---- Start of Client Option Parameters --- + /// + /// Client Option Parameters: Specify the name of the Cascade Connection + /// + [JsonProperty("AccountName_utf")] + public string ClientOption_AccountName_utf; + + /// + /// Client Option Parameters: Specify the hostname of the destination VPN Server. You can also specify by IP address. + /// + [JsonProperty("Hostname_str")] + public string ClientOption_Hostname_str; + + /// + /// Client Option Parameters: Specify the port number of the destination VPN Server. + /// + [JsonProperty("Port_u32")] + public uint ClientOption_Port_u32; + + /// + /// Client Option Parameters: The type of the proxy server + /// + [JsonProperty("ProxyType_u32")] + public VpnRpcProxyType ClientOption_ProxyType_u32; + + /// + /// Client Option Parameters: The hostname or IP address of the proxy server name + /// + [JsonProperty("ProxyName_str")] + public string ClientOption_ProxyName_str; + + /// + /// Client Option Parameters: The port number of the proxy server + /// + [JsonProperty("ProxyPort_u32")] + public uint ClientOption_ProxyPort_u32; + + /// + /// Client Option Parameters: The username to connect to the proxy server + /// + [JsonProperty("ProxyUsername_str")] + public string ClientOption_ProxyUsername_str; + + /// + /// Client Option Parameters: The password to connect to the proxy server + /// + [JsonProperty("ProxyPassword_str")] + public string ClientOption_ProxyPassword_str; + + /// + /// Client Option Parameters: The Virtual Hub on the destination VPN Server + /// + [JsonProperty("HubName_str")] + public string ClientOption_HubName_str; + + /// + /// Client Option Parameters: Number of TCP Connections to Use in VPN Communication + /// + [JsonProperty("MaxConnection_u32")] + public uint ClientOption_MaxConnection_u32; + + /// + /// Client Option Parameters: The flag to enable the encryption on the communication + /// + [JsonProperty("UseEncrypt_bool")] + public bool ClientOption_UseEncrypt_bool; + + /// + /// Client Option Parameters: Enable / Disable Data Compression when Communicating by Cascade Connection + /// + [JsonProperty("UseCompress_bool")] + public bool ClientOption_UseCompress_bool; + + /// + /// Client Option Parameters: Specify true when enabling half duplex mode. When using two or more TCP connections for VPN communication, it is possible to use Half Duplex Mode. By enabling half duplex mode it is possible to automatically fix data transmission direction as half and half for each TCP connection. In the case where a VPN using 8 TCP connections is established, for example, when half-duplex is enabled, communication can be fixes so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. + /// + [JsonProperty("HalfConnection_bool")] + public bool ClientOption_HalfConnection_bool; + + /// + /// Client Option Parameters: Connection attempt interval when additional connection will be established + /// + [JsonProperty("AdditionalConnectionInterval_u32")] + public uint ClientOption_AdditionalConnectionInterval_u32; + + /// + /// Client Option Parameters: Connection Life of Each TCP Connection (0 for no keep-alive) + /// + [JsonProperty("ConnectionDisconnectSpan_u32")] + public uint ClientOption_ConnectionDisconnectSpan_u32; + + /// + /// Client Option Parameters: Disable QoS Control Function if the value is true + /// + [JsonProperty("DisableQoS_bool")] + public bool ClientOption_DisableQoS_bool; + + /// + /// Client Option Parameters: Do not use TLS 1.x of the value is true + /// + [JsonProperty("NoTls1_bool")] + public bool ClientOption_NoTls1_bool; + + /// + /// Client Option Parameters: Do not use UDP acceleration mode if the value is true + /// + [JsonProperty("NoUdpAcceleration_bool")] + public bool ClientOption_NoUdpAcceleration_bool; + // ---- End of Client Option --- + + // ---- Start of Client Auth Parameters --- + /// + /// Authentication type + /// + [JsonProperty("AuthType_u32")] + public VpnRpcClientAuthType ClientAuth_AuthType_u32; + + /// + /// User name + /// + [JsonProperty("Username_str")] + public string ClientAuth_Username_str; + + /// + /// SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(UpperCase(username_ascii_string) + password_ascii_string). + /// + [JsonProperty("HashedPassword_bin")] + public byte[] ClientAuth_HashedPassword_bin; + + /// + /// Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2). + /// + [JsonProperty("PlainPassword_str")] + public string ClientAuth_PlainPassword_str; + + /// + /// Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). + /// + [JsonProperty("ClientX_bin")] + public byte[] ClientAuth_ClientX_bin; + + /// + /// Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). + /// + [JsonProperty("ClientK_bin")] + public byte[] ClientAuth_ClientK_bin; + + /// + /// Security policy: Filter DHCP Packets (IPv4). All IPv4 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPFilter_bool")] + public bool SecPol_DHCPFilter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv4). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv4 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPNoServer_bool")] + public bool SecPol_DHCPNoServer_bool; + + /// + /// Security policy: Enforce DHCP Allocated IP Addresses (IPv4). Computers in sessions that have this policy setting will only be able to use IPv4 addresses allocated by a DHCP server on the virtual network side. + /// + [JsonProperty("policy:DHCPForce_bool")] + public bool SecPol_DHCPForce_bool; + + /// + /// Security policy: Prohibit the duplicate MAC address + /// + /// Security policy: Deny MAC Addresses Duplication. The use of duplicating MAC addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + public bool SecPol_CheckMac_bool; + + /// + /// Security policy: Prohibit a duplicate IP address (IPv4) + /// + /// Security policy: Deny IP Address Duplication (IPv4). The use of duplicating IPv4 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + public bool SecPol_CheckIP_bool; + + /// + /// Security policy: Deny Non-ARP / Non-DHCP / Non-ICMPv6 broadcasts. The sending or receiving of broadcast packets that are not ARP protocol, DHCP protocol, nor ICMPv6 on the virtual network will not be allowed for sessions with this policy setting. + /// + [JsonProperty("policy:ArpDhcpOnly_bool")] + public bool SecPol_ArpDhcpOnly_bool; + + /// + /// Security policy: Privacy Filter Mode. All direct communication between sessions with the privacy filter mode policy setting will be filtered. + /// + [JsonProperty("policy:PrivacyFilter_bool")] + public bool SecPol_PrivacyFilter_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv4). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv4. + /// + [JsonProperty("policy:NoServer_bool")] + public bool SecPol_NoServer_bool; + + /// + /// Security policy: Unlimited Number of Broadcasts. If a computer of a session with this policy setting sends broadcast packets of a number unusually larger than what would be considered normal on the virtual network, there will be no automatic limiting. + /// + [JsonProperty("policy:NoBroadcastLimiter_bool")] + public bool SecPol_NoBroadcastLimiter_bool; + + /// + /// Security policy: Maximum Number of MAC Addresses. For sessions with this policy setting, this limits the number of MAC addresses per session. + /// + [JsonProperty("policy:MaxMac_u32")] + public uint SecPol_MaxMac_u32; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv4). For sessions with this policy setting, this specifies the number of IPv4 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIP_u32")] + public uint SecPol_MaxIP_u32; + + /// + /// Security policy: Upload Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the inwards direction from outside to inside the Virtual Hub. + /// + [JsonProperty("policy:MaxUpload_u32")] + public uint SecPol_MaxUpload_u32; + + /// + /// Security policy: Download Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the outwards direction from inside the Virtual Hub to outside the Virtual Hub. + /// + [JsonProperty("policy:MaxDownload_u32")] + public uint SecPol_MaxDownload_u32; + + /// + /// Security policy: Filter RS / RA Packets (IPv6). All ICMPv6 packets which the message-type is 133 (Router Solicitation) or 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, an IPv6 client will be unable to use IPv6 address prefix auto detection and IPv6 default gateway auto detection. + /// + [JsonProperty("policy:RSandRAFilter_bool")] + public bool SecPol_RSandRAFilter_bool; + + /// + /// Security policy: Filter the router advertisement packet (IPv6) + /// + /// Security policy: Filter RA Packets (IPv6). All ICMPv6 packets which the message-type is 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, a malicious users will be unable to spread illegal IPv6 prefix or default gateway advertisements on the network. + public bool SecPol_RAFilter_bool; + + /// + /// Security policy: Filter DHCP Packets (IPv6). All IPv6 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPv6Filter_bool")] + public bool SecPol_DHCPv6Filter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv6). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv6 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPv6NoServer_bool")] + public bool SecPol_DHCPv6NoServer_bool; + + /// + /// Security policy: Prohibit the duplicate IP address (IPv6) + /// + /// Security policy: Deny IP Address Duplication (IPv6). The use of duplicating IPv6 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + public bool SecPol_CheckIPv6_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv6). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv6. + /// + [JsonProperty("policy:NoServerV6_bool")] + public bool SecPol_NoServerV6_bool; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv6). For sessions with this policy setting, this specifies the number of IPv6 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIPv6_u32")] + public uint SecPol_MaxIPv6_u32; + + /// + /// Security policy: Filter All IPv4 Packets. All IPv4 and ARP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv4_bool")] + public bool SecPol_FilterIPv4_bool; + + /// + /// Security policy: Filter All IPv6 Packets. All IPv6 packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv6_bool")] + public bool SecPol_FilterIPv6_bool; + + /// + /// Security policy: Filter All Non-IP Packets. All non-IP packets in sessions defined this policy will be filtered. "Non-IP packet" mean a packet which is not IPv4, ARP nor IPv6. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. + /// + [JsonProperty("policy:FilterNonIP_bool")] + public bool SecPol_FilterNonIP_bool; + + /// + /// Security policy: No Default-Router on IPv6 RA. In all VPN Sessions defines this policy, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. + /// + [JsonProperty("policy:NoIPv6DefaultRouterInRA_bool")] + public bool SecPol_NoIPv6DefaultRouterInRA_bool; + + /// + /// Security policy: VLAN ID (IEEE802.1Q). You can specify the VLAN ID on the security policy. All VPN Sessions defines this policy, all Ethernet packets toward the Virtual Hub from the user will be inserted a VLAN tag (IEEE 802.1Q) with the VLAN ID. The user can also receive only packets with a VLAN tag which has the same VLAN ID. (Receiving process removes the VLAN tag automatically.) Any Ethernet packets with any other VLAN IDs or non-VLAN packets will not be received. All VPN Sessions without this policy definition can send / receive any kinds of Ethernet packets regardless of VLAN tags, and VLAN tags are not inserted or removed automatically. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. Therefore, tagged-VLAN packets are not subjects for IPv4 / IPv6 security policies, access lists nor other IPv4 / IPv6 specific deep processing. + /// + [JsonProperty("policy:VLanId_u32")] + public uint SecPol_VLanId_u32; + + /// + /// Security policy: Whether version 3.0 (must be true) + /// + [JsonProperty("policy:Ver3_bool")] + public bool SecPol_Ver3_bool = true; + // ---- End of Security policy --- + } + + /// + /// Listener + /// + public class VpnRpcListener + { + /// + /// Port number (Range: 1 - 65535) + /// + public uint Port_u32; + + /// + /// Active state + /// + public bool Enable_bool; + } + + /// + /// User authentication type (server side) + /// + public enum VpnRpcUserAuthType + { + /// + /// Anonymous authentication + /// + Anonymous = 0, + + /// + /// Password authentication + /// + Password = 1, + + /// + /// User certificate authentication + /// + UserCert = 2, + + /// + /// Root certificate which is issued by trusted Certificate Authority + /// + RootCert = 3, + + /// + /// Radius authentication + /// + Radius = 4, + + /// + /// Windows NT authentication + /// + NTDomain = 5, + } + + /// + /// Create, configure, and get the user + /// + public class VpnRpcSetUser + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Specify the user name of the user + /// + public string Name_str; + + /// + /// Assigned group name for the user + /// + public string GroupName_str; + + /// + /// Optional real name (full name) of the user, allow using any Unicode characters + /// + public string Realname_utf; + + /// + /// Optional User Description + /// + public string Note_utf; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Last modified date and time + /// + public DateTime UpdatedTime_dt; + + /// + /// Expiration date and time + /// + public DateTime ExpireTime_dt; + + /// + /// Authentication method of the user + /// + public VpnRpcUserAuthType AuthType_u32; + + /// + /// User password, valid only if AuthType_u32 == Password(1). Valid only to create or set operations. + /// + public string Auth_Password_str; + + /// + /// User certificate, valid only if AuthType_u32 == UserCert(2). + /// + [JsonProperty("UserX_bin")] + public byte[] Auth_UserCert_CertData; + + /// + /// Certificate Serial Number, optional, valid only if AuthType_u32 == RootCert(3). + /// + [JsonProperty("Serial_bin")] + public byte[] Auth_RootCert_Serial; + + /// + /// Certificate Common Name, optional, valid only if AuthType_u32 == RootCert(3). + /// + [JsonProperty("CommonName_utf")] + public string Auth_RootCert_CommonName; + + /// + /// Username in RADIUS server, optional, valid only if AuthType_u32 == Radius(4). + /// + [JsonProperty("RadiusUsername_utf")] + public string Auth_Radius_RadiusUsername; + + /// + /// Username in NT Domain server, optional, valid only if AuthType_u32 == NT(5). + /// + [JsonProperty("NtUsername_utf")] + public string Auth_NT_NTUsername; + + /// + /// Number of total logins of the user + /// + public uint NumLogin_u32; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + + /// + /// The flag whether to use security policy + /// + public bool UsePolicy_bool; + + // ---- Start of Security policy --- + /// + /// Security policy: Allow Access. The users, which this policy value is true, have permission to make VPN connection to VPN Server. + /// + [JsonProperty("policy:Access_bool")] + public bool SecPol_Access_bool; + + /// + /// Security policy: Filter DHCP Packets (IPv4). All IPv4 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPFilter_bool")] + public bool SecPol_DHCPFilter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv4). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv4 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPNoServer_bool")] + public bool SecPol_DHCPNoServer_bool; + + /// + /// Security policy: Enforce DHCP Allocated IP Addresses (IPv4). Computers in sessions that have this policy setting will only be able to use IPv4 addresses allocated by a DHCP server on the virtual network side. + /// + [JsonProperty("policy:DHCPForce_bool")] + public bool SecPol_DHCPForce_bool; + + /// + /// Security policy: Deny Bridge Operation. Bridge-mode connections are denied for user sessions that have this policy setting. Even in cases when the Ethernet Bridge is configured in the client side, communication will not be possible. + /// + [JsonProperty("policy:NoBridge_bool")] + public bool SecPol_NoBridge_bool; + + /// + /// Security policy: Deny Routing Operation (IPv4). IPv4 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. + /// + [JsonProperty("policy:NoRouting_bool")] + public bool SecPol_NoRouting_bool; + + /// + /// Security policy: Deny MAC Addresses Duplication. The use of duplicating MAC addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckMac_bool")] + public bool SecPol_CheckMac_bool; + + /// + /// Security policy: Deny IP Address Duplication (IPv4). The use of duplicating IPv4 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckIP_bool")] + public bool SecPol_CheckIP_bool; + + /// + /// Security policy: Deny Non-ARP / Non-DHCP / Non-ICMPv6 broadcasts. The sending or receiving of broadcast packets that are not ARP protocol, DHCP protocol, nor ICMPv6 on the virtual network will not be allowed for sessions with this policy setting. + /// + [JsonProperty("policy:ArpDhcpOnly_bool")] + public bool SecPol_ArpDhcpOnly_bool; + + /// + /// Security policy: Privacy Filter Mode. All direct communication between sessions with the privacy filter mode policy setting will be filtered. + /// + [JsonProperty("policy:PrivacyFilter_bool")] + public bool SecPol_PrivacyFilter_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv4). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv4. + /// + [JsonProperty("policy:NoServer_bool")] + public bool SecPol_NoServer_bool; + + /// + /// Security policy: Unlimited Number of Broadcasts. If a computer of a session with this policy setting sends broadcast packets of a number unusually larger than what would be considered normal on the virtual network, there will be no automatic limiting. + /// + [JsonProperty("policy:NoBroadcastLimiter_bool")] + public bool SecPol_NoBroadcastLimiter_bool; + + /// + /// Security policy: Allow Monitoring Mode. Users with this policy setting will be granted to connect to the Virtual Hub in Monitoring Mode. Sessions in Monitoring Mode are able to monitor (tap) all packets flowing through the Virtual Hub. + /// + [JsonProperty("policy:MonitorPort_bool")] + public bool SecPol_MonitorPort_bool; + + /// + /// Security policy: Maximum Number of TCP Connections. For sessions with this policy setting, this sets the maximum number of physical TCP connections consists in a physical VPN session. + /// + [JsonProperty("policy:MaxConnection_u32")] + public uint SecPol_MaxConnection_u32; + + /// + /// Security policy: Time-out Period. For sessions with this policy setting, this sets, in seconds, the time-out period to wait before disconnecting a session when communication trouble occurs between the VPN Client / VPN Server. + /// + [JsonProperty("policy:TimeOut_u32")] + public uint SecPol_TimeOut_u32; + + /// + /// Security policy: Maximum Number of MAC Addresses. For sessions with this policy setting, this limits the number of MAC addresses per session. + /// + [JsonProperty("policy:MaxMac_u32")] + public uint SecPol_MaxMac_u32; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv4). For sessions with this policy setting, this specifies the number of IPv4 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIP_u32")] + public uint SecPol_MaxIP_u32; + + /// + /// Security policy: Upload Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the inwards direction from outside to inside the Virtual Hub. + /// + [JsonProperty("policy:MaxUpload_u32")] + public uint SecPol_MaxUpload_u32; + + /// + /// Security policy: Download Bandwidth. For sessions with this policy setting, this limits the traffic bandwidth that is in the outwards direction from inside the Virtual Hub to outside the Virtual Hub. + /// + [JsonProperty("policy:MaxDownload_u32")] + public uint SecPol_MaxDownload_u32; + + /// + /// Security policy: Deny Changing Password. The users which use password authentication with this policy setting are not allowed to change their own password from the VPN Client Manager or similar. + /// + [JsonProperty("policy:FixPassword_bool")] + public bool SecPol_FixPassword_bool; + + /// + /// Security policy: Maximum Number of Multiple Logins. Users with this policy setting are unable to have more than this number of concurrent logins. Bridge Mode sessions are not subjects to this policy. + /// + [JsonProperty("policy:MultiLogins_u32")] + public uint SecPol_MultiLogins_u32; + + /// + /// Security policy: Deny VoIP / QoS Function. Users with this security policy are unable to use VoIP / QoS functions in VPN connection sessions. + /// + [JsonProperty("policy:NoQoS_bool")] + public bool SecPol_NoQoS_bool; + + /// + /// Security policy: Filter RS / RA Packets (IPv6). All ICMPv6 packets which the message-type is 133 (Router Solicitation) or 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, an IPv6 client will be unable to use IPv6 address prefix auto detection and IPv6 default gateway auto detection. + /// + [JsonProperty("policy:RSandRAFilter_bool")] + public bool SecPol_RSandRAFilter_bool; + + /// + /// Security policy: Filter RA Packets (IPv6). All ICMPv6 packets which the message-type is 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, a malicious users will be unable to spread illegal IPv6 prefix or default gateway advertisements on the network. + /// + [JsonProperty("policy:RAFilter_bool")] + public bool SecPol_RAFilter_bool; + + /// + /// Security policy: Filter DHCP Packets (IPv6). All IPv6 DHCP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:DHCPv6Filter_bool")] + public bool SecPol_DHCPv6Filter_bool; + + /// + /// Security policy: Disallow DHCP Server Operation (IPv6). Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv6 addresses to DHCP clients. + /// + [JsonProperty("policy:DHCPv6NoServer_bool")] + public bool SecPol_DHCPv6NoServer_bool; + + /// + /// Security policy: Deny Routing Operation (IPv6). IPv6 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. + /// + [JsonProperty("policy:NoRoutingV6_bool")] + public bool SecPol_NoRoutingV6_bool; + + /// + /// Security policy: Deny IP Address Duplication (IPv6). The use of duplicating IPv6 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. + /// + [JsonProperty("policy:CheckIPv6_bool")] + public bool SecPol_CheckIPv6_bool; + + /// + /// Security policy: Deny Operation as TCP/IP Server (IPv6). Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv6. + /// + [JsonProperty("policy:NoServerV6_bool")] + public bool SecPol_NoServerV6_bool; + + /// + /// Security policy: Maximum Number of IP Addresses (IPv6). For sessions with this policy setting, this specifies the number of IPv6 addresses that can be registered for a single session. + /// + [JsonProperty("policy:MaxIPv6_u32")] + public uint SecPol_MaxIPv6_u32; + + /// + /// Security policy: Disallow Password Save in VPN Client. For users with this policy setting, when the user is using *standard* password authentication, the user will be unable to save the password in VPN Client. The user will be required to input passwords for every time to connect a VPN. This will improve the security. If this policy is enabled, VPN Client Version 2.0 will be denied to access. + /// + [JsonProperty("policy:NoSavePassword_bool")] + public bool SecPol_NoSavePassword_bool; + + /// + /// Security policy: VPN Client Automatic Disconnect. For users with this policy setting, a user's VPN session will be disconnected automatically after the specific period will elapse. In this case no automatic re-connection will be performed. This can prevent a lot of inactive VPN Sessions. If this policy is enabled, VPN Client Version 2.0 will be denied to access. + /// + [JsonProperty("policy:AutoDisconnect_u32")] + public uint SecPol_AutoDisconnect_u32; + + /// + /// Security policy: Filter All IPv4 Packets. All IPv4 and ARP packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv4_bool")] + public bool SecPol_FilterIPv4_bool; + + /// + /// Security policy: Filter All IPv6 Packets. All IPv6 packets in sessions defined this policy will be filtered. + /// + [JsonProperty("policy:FilterIPv6_bool")] + public bool SecPol_FilterIPv6_bool; + + /// + /// Security policy: Filter All Non-IP Packets. All non-IP packets in sessions defined this policy will be filtered. "Non-IP packet" mean a packet which is not IPv4, ARP nor IPv6. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. + /// + [JsonProperty("policy:FilterNonIP_bool")] + public bool SecPol_FilterNonIP_bool; + + /// + /// Security policy: No Default-Router on IPv6 RA. In all VPN Sessions defines this policy, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. + /// + [JsonProperty("policy:NoIPv6DefaultRouterInRA_bool")] + public bool SecPol_NoIPv6DefaultRouterInRA_bool; + + /// + /// Security policy: No Default-Router on IPv6 RA (physical IPv6). In all VPN Sessions defines this policy (only when the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6), any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. + /// + [JsonProperty("policy:NoIPv6DefaultRouterInRAWhenIPv6_bool")] + public bool SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool; + + /// + /// Security policy: VLAN ID (IEEE802.1Q). You can specify the VLAN ID on the security policy. All VPN Sessions defines this policy, all Ethernet packets toward the Virtual Hub from the user will be inserted a VLAN tag (IEEE 802.1Q) with the VLAN ID. The user can also receive only packets with a VLAN tag which has the same VLAN ID. (Receiving process removes the VLAN tag automatically.) Any Ethernet packets with any other VLAN IDs or non-VLAN packets will not be received. All VPN Sessions without this policy definition can send / receive any kinds of Ethernet packets regardless of VLAN tags, and VLAN tags are not inserted or removed automatically. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. Therefore, tagged-VLAN packets are not subjects for IPv4 / IPv6 security policies, access lists nor other IPv4 / IPv6 specific deep processing. + /// + [JsonProperty("policy:VLanId_u32")] + public uint SecPol_VLanId_u32; + + /// + /// Security policy: Whether version 3.0 (must be true) + /// + [JsonProperty("policy:Ver3_bool")] + public bool SecPol_Ver3_bool = true; + // ---- End of Security policy --- + } + + /// + /// Delete the access list + /// + public class VpnRpcDeleteAccess + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// ID + /// + public uint Id_u32; + } + + /// + /// Delete the CA of HUB + /// + public class VpnRpcHubDeleteCA + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Certificate key id to be deleted + /// + public uint Key_u32; + } + + /// + /// Deleting a user or group + /// + public class VpnRpcDeleteUser + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// User or group name + /// + public string Name_str; + } + + /// + /// Delete the HUB + /// + public class VpnRpcDeleteHub + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + } + + /// + /// Delete the table + /// + public class VpnRpcDeleteTable + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Key ID + /// + public uint Key_u32; + } + + /// + /// Specify the Link + /// + public class VpnRpcLink + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The name of the cascade connection + /// + public string AccountName_utf; + } + + /// + /// Disconnect the session + /// + public class VpnRpcDeleteSession + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Session name + /// + public string Name_str; + } + + /// + /// Specify the HUB + /// + public class VpnRpcHub + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + } + + /// + /// Disconnect a connection + /// + public class VpnRpcDisconnectConnection + { + /// + /// Connection name + /// + public string Name_str; + } + + /// + /// Enumeration of the access list + /// + public class VpnRpcEnumAccessList + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Access list + /// + public VpnAccess[] AccessList; + } + + /// + /// CA enumeration items of HUB + /// + public class VpnRpcHubEnumCAItem + { + /// + /// The key id of the item + /// + public uint Key_u32; + + /// + /// Subject + /// + public string SubjectName_utf; + + /// + /// Issuer + /// + public string IssuerName_utf; + + /// + /// Expiration date + /// + public DateTime Expires_dt; + } + + /// + /// CA enumeration of HUB + /// + public class VpnRpcHubEnumCA + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The list of CA + /// + public VpnRpcHubEnumCAItem[] CAList; + } + + /// + /// Type of connection + /// + public enum VpnRpcConnectionType + { + /// + /// VPN Client + /// + Client = 0, + + /// + /// During initialization + /// + Init = 1, + + /// + /// Login connection + /// + Login = 2, + + /// + /// Additional connection + /// + Additional = 3, + + /// + /// RPC for server farm + /// + FarmRpc = 4, + + /// + /// RPC for Management + /// + AdminRpc = 5, + + /// + /// HUB enumeration + /// + EnumHub = 6, + + /// + /// Password change + /// + Password = 7, + + /// + /// SSTP + /// + SSTP = 8, + + /// + /// OpenVPN + /// + OpenVPN = 9, + } + + /// + /// Connection enumeration items + /// + public class VpnRpcEnumConnectionItem + { + /// + /// Connection name + /// + public string Name_str; + + /// + /// Host name + /// + public string Hostname_str; + + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Port number + /// + public uint Port_u32; + + /// + /// Connected time + /// + public DateTime ConnectedTime_dt; + + /// + /// Connection type + /// + public VpnRpcConnectionType Type_u32; + } + + /// + /// Connection enumeration + /// + public class VpnRpcEnumConnection + { + /// + /// Number of connections + /// + public uint NumConnection_u32; + + /// + /// Connection list + /// + public VpnRpcEnumConnectionItem[] ConnectionList; + } + + /// + /// Enum CRL Item + /// + public class VpnRpcEnumCrlItem + { + /// + /// Key ID + /// + public uint Key_u32; + + /// + /// The contents of the CRL item + /// + public string CrlInfo_utf; + } + + /// + /// Enum CRL + /// + public class VpnRpcEnumCrl + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// CRL list + /// + public VpnRpcEnumCrlItem[] CRLList; + } + + /// + /// RPC_ENUM_DHCP_ITEM + /// + public class VpnRpcEnumDhcpItem + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// Lease time + /// + public DateTime LeasedTime_dt; + + /// + /// Expiration date + /// + public DateTime ExpireTime_dt; + + /// + /// MAC address + /// + public byte[] MacAddress_bin; + + /// + /// IP address + /// + public string IpAddress_ip; + + /// + /// Subnet mask + /// + public uint Mask_u32; + + /// + /// Host name + /// + public string Hostname_str; + } + + /// + /// RPC_ENUM_DHCP + /// + public class VpnRpcEnumDhcp + { + /// + /// Virtual Hub Name + /// + public string HubName_str; + + /// + /// DHCP Item + /// + public VpnRpcEnumDhcpItem[] DhcpTable; + } + + /// + /// EtherIP setting list + /// + public class VpnRpcEnumEtherIpId + { + /// + /// Setting list + /// + public VpnEtherIpId[] Settings; + } + + /// + /// Ethernet Network Adapters list item + /// + public class VpnRpcEnumEthItem + { + /// + /// Device name + /// + public string DeviceName_str; + + /// + /// Network connection name (description) + /// + public string NetworkConnectionName_utf; + } + + /// + /// Ethernet Network Adapters list + /// + public class VpnRpcEnumEth + { + /// + /// Ethernet Network Adapters list + /// + public VpnRpcEnumEthItem[] EthList; + } + + /// + /// Server farm members enumeration items + /// + public class VpnRpcEnumFarmItem + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// Controller + /// + public bool Controller_bool; + + /// + /// Connection time + /// + public DateTime ConnectedTime_dt; + + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Host name + /// + public string Hostname_str; + + /// + /// Point + /// + public uint Point_u32; + + /// + /// Number of sessions + /// + public uint NumSessions_u32; + + /// + /// Number of TCP connections + /// + public uint NumTcpConnections_u32; + + /// + /// Number of HUBs + /// + public uint NumHubs_u32; + + /// + /// Number of assigned client licenses + /// + public uint AssignedClientLicense_u32; + + /// + /// Number of assigned bridge licenses + /// + public uint AssignedBridgeLicense_u32; + } + + /// + /// Server farm member enumeration + /// + public class VpnRpcEnumFarm + { + /// + /// Number of Cluster Members + /// + public uint NumFarm_u32; + + /// + /// Cluster Members list + /// + public VpnRpcEnumFarmItem[] FarmMemberList; + } + + /// + /// Enumeration items in the group + /// + public class VpnRpcEnumGroupItem + { + /// + /// User name + /// + public string Name_str; + + /// + /// Real name + /// + public string Realname_utf; + + /// + /// Note + /// + public string Note_utf; + + /// + /// Number of users + /// + public uint NumUsers_u32; + + /// + /// Access denied + /// + public bool DenyAccess_bool; + } + + /// + /// Group enumeration + /// + public class VpnRpcEnumGroup + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Group list + /// + public VpnRpcEnumGroupItem[] GroupList; + } + + /// + /// Enumeration items of HUB + /// + public class VpnRpcEnumHubItem + { + /// + /// The name of the Virtual Hub + /// + public string HubName_str; + + /// + /// Online state + /// + public bool Online_bool; + + /// + /// Type of HUB (Valid only for Clustered VPN Servers) + /// + public VpnRpcHubType HubType_u32; + + /// + /// Number of users + /// + public uint NumUsers_u32; + + /// + /// Number of registered groups + /// + public uint NumGroups_u32; + + /// + /// Number of registered sessions + /// + public uint NumSessions_u32; + + /// + /// Number of current MAC table entries + /// + public uint NumMacTables_u32; + + /// + /// Number of current IP table entries + /// + public uint NumIpTables_u32; + + /// + /// Last communication date and time + /// + public DateTime LastCommTime_dt; + + /// + /// Last login date and time + /// + public DateTime LastLoginTime_dt; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Number of accumulated logins + /// + public uint NumLogin_u32; + + /// + /// Whether the traffic information is provided + /// + public bool IsTrafficFilled_bool; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Ex.Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Ex.Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Ex.Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Ex.Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Ex.Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Ex.Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Ex.Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Ex.Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + } + + /// + /// Enumeration of HUB + /// + public class VpnRpcEnumHub + { + /// + /// Number of Virtual Hubs + /// + public uint NumHub_u32; + + /// + /// Virtual Hubs + /// + public VpnRpcEnumHubItem[] HubList; + } + + /// + /// Enumeration items of IP table + /// + public class VpnRpcEnumIpTableItem + { + /// + /// Key ID + /// + public uint Key_u32; + + /// + /// Session name + /// + public string SessionName_str; + + /// + /// IP address + /// + public string IpAddress_ip; + + /// + /// Assigned by the DHCP + /// + public bool DhcpAllocated_bool; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Updating date + /// + public DateTime UpdatedTime_dt; + + /// + /// Remote items + /// + public bool RemoteItem_bool; + + /// + /// Remote host name + /// + public string RemoteHostname_str; + } + + /// + /// Enumeration of IP table + /// + public class VpnRpcEnumIpTable + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// MAC table + /// + public VpnRpcEnumIpTableItem[] IpTable; + } + + /// + /// Layer-3 interface enumeration + /// + public class VpnRpcEnumL3If + { + /// + /// Layer-3 switch name + /// + public string Name_str; + + /// + /// Layer-3 interface list + /// + public VpnRpcL3If[] L3IFList; + } + + /// + /// Layer-3 switch enumeration item + /// + public class VpnRpcEnumL3SwItem + { + /// + /// Name of the layer-3 switch + /// + public string Name_str; + + /// + /// Number of layer-3 switch virtual interfaces + /// + public uint NumInterfaces_u32; + + /// + /// Number of routing tables + /// + public uint NumTables_u32; + + /// + /// Activated flag + /// + public bool Active_bool; + + /// + /// Online flag + /// + public bool Online_bool; + } + + /// + /// Layer-3 switch enumeration + /// + public class VpnRpcEnumL3Sw + { + /// + /// Layer-3 switch list + /// + public VpnRpcEnumL3SwItem[] L3SWList; + } + + /// + /// Routing table enumeration + /// + public class VpnRpcEnumL3Table + { + /// + /// L3 switch name + /// + public string Name_str; + + /// + /// Routing table item list + /// + public VpnRpcL3Table[] L3Table; + } + + /// + /// Cascade Connection Enumeration + /// + public class VpnRpcEnumLinkItem + { + /// + /// The name of cascade connection + /// + public string AccountName_utf; + + /// + /// Online flag + /// + public bool Online_bool; + + /// + /// The flag indicates whether the cascade connection is established + /// + public bool Connected_bool; + + /// + /// The error last occurred if the cascade connection is in the fail state + /// + public uint LastError_u32; + + /// + /// Connection completion time + /// + public DateTime ConnectedTime_dt; + + /// + /// Host name of the destination VPN server + /// + public string Hostname_str; + + /// + /// The Virtual Hub name + /// + public string TargetHubName_str; + } + + /// + /// Enumeration of the link + /// + public class VpnRpcEnumLink + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Number of cascade connections + /// + public uint NumLink_u32; + + /// + /// The list of cascade connections + /// + public VpnRpcEnumLinkItem[] LinkList; + } + + /// + /// List of listeners item + /// + public class VpnRpcListenerListItem + { + /// + /// TCP port number (range: 1 - 65535) + /// + public uint Ports_u32; + + /// + /// Active state + /// + public bool Enables_bool; + + /// + /// The flag to indicate if the error occurred on the listener port + /// + public bool Errors_bool; + } + + /// + /// List of listeners + /// + public class VpnRpcListenerList + { + /// + /// List of listener items + /// + public VpnRpcListenerListItem[] ListenerList; + } + + /// + /// Local Bridge enumeration + /// + public class VpnRpcEnumLocalBridge + { + /// + /// Local Bridge list + /// + public VpnRpcLocalBridge[] LocalBridgeList; + } + + /// + /// Log file enumeration + /// + public class VpnRpcEnumLogFileItem + { + /// + /// Server name + /// + public string ServerName_str; + + /// + /// File path + /// + public string FilePath_str; + + /// + /// File size + /// + public uint FileSize_u32; + + /// + /// Last write date + /// + public DateTime UpdatedTime_dt; + } + + /// + /// Log file enumeration + /// + public class VpnRpcEnumLogFile + { + /// + /// Log file list + /// + public VpnRpcEnumLogFileItem[] LogFiles; + } + + /// + /// Enumeration items of the MAC table + /// + public class VpnRpcEnumMacTableItem + { + /// + /// Key ID + /// + public uint Key_u32; + + /// + /// Session name + /// + public string SessionName_str; + + /// + /// MAC address + /// + public byte[] MacAddress_bin; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Updating date + /// + public DateTime UpdatedTime_dt; + + /// + /// Remote items + /// + public bool RemoteItem_bool; + + /// + /// Remote host name + /// + public string RemoteHostname_str; + + /// + /// VLAN ID + /// + public uint VlanId_u32; + } + + /// + /// Enumeration of the MAC table + /// + public class VpnRpcEnumMacTable + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// MAC table + /// + public VpnRpcEnumMacTableItem[] MacTable; + } + + /// + /// NAT Entry Protocol Number + /// + public enum VpnRpcNatProtocol + { + /// + /// TCP + /// + TCP = 0, + + /// + /// UDP + /// + UDP = 1, + + /// + /// DNS + /// + DNS = 2, + + /// + /// ICMP + /// + ICMP = 3, + } + + /// + /// State of NAT session (TCP) + /// + public enum VpnRpcNatTcpState + { + /// + /// Connecting + /// + Connecting = 0, + + /// + /// Send the RST (Connection failure or disconnected) + /// + SendReset = 1, + + /// + /// Connection complete + /// + Connected = 2, + + /// + /// Connection established + /// + Established = 3, + + /// + /// Wait for socket disconnection + /// + WaitDisconnect = 4, + } + + /// + /// VpnRpcEnumNat List Item + /// + public class VpnRpcEnumNatItem + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// Protocol + /// + public VpnRpcNatProtocol Protocol_u32; + + /// + /// Source IP address + /// + public string SrcIp_ip; + + /// + /// Source host name + /// + public string SrcHost_str; + + /// + /// Source port number + /// + public uint SrcPort_u32; + + /// + /// Destination IP address + /// + public string DestIp_ip; + + /// + /// Destination host name + /// + public string DestHost_str; + + /// + /// Destination port number + /// + public uint DestPort_u32; + + /// + /// Connection time + /// + public DateTime CreatedTime_dt; + + /// + /// Last communication time + /// + public DateTime LastCommTime_dt; + + /// + /// Transmission size + /// + public ulong SendSize_u64; + + /// + /// Receive size + /// + public ulong RecvSize_u64; + + /// + /// TCP state + /// + public VpnRpcNatTcpState TcpStatus_u32; + } + + /// + /// RPC_ENUM_NAT + /// + public class VpnRpcEnumNat + { + /// + /// Virtual Hub Name + /// + public string HubName_str; + + /// + /// NAT item + /// + public VpnRpcEnumNatItem[] NatTable; + } + + /// + /// Enumeration item of VPN session + /// + public class VpnRpcEnumSessionItem + { + /// + /// Session name + /// + public string Name_str; + + /// + /// Remote session + /// + public bool RemoteSession_bool; + + /// + /// Remote server name + /// + public string RemoteHostname_str; + + /// + /// User name + /// + public string Username_str; + + /// + /// IP address + /// + public string ClientIP_ip; + + /// + /// Host name + /// + public string Hostname_str; + + /// + /// Maximum number of underlying TCP connections + /// + public uint MaxNumTcp_u32; + + /// + /// Number of current underlying TCP connections + /// + public uint CurrentNumTcp_u32; + + /// + /// Packet size transmitted + /// + public ulong PacketSize_u64; + + /// + /// Number of packets transmitted + /// + public ulong PacketNum_u64; + + /// + /// Is a Cascade VPN session + /// + public bool LinkMode_bool; + + /// + /// Is a SecureNAT VPN session + /// + public bool SecureNATMode_bool; + + /// + /// Is the VPN session for Local Bridge + /// + public bool BridgeMode_bool; + + /// + /// Is a Layer-3 Switch VPN session + /// + public bool Layer3Mode_bool; + + /// + /// Is in Bridge Mode + /// + public bool Client_BridgeMode_bool; + + /// + /// Is in Monitor Mode + /// + public bool Client_MonitorMode_bool; + + /// + /// VLAN ID + /// + public uint VLanId_u32; + + /// + /// Unique ID of the VPN Session + /// + public byte[] UniqueId_bin; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Last communication date and time + /// + public DateTime LastCommTime_dt; + } + + /// + /// Enumerate VPN sessions + /// + public class VpnRpcEnumSession + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// VPN sessions list + /// + public VpnRpcEnumSessionItem[] SessionList; + } + + /// + /// Enumeration item of user + /// + public class VpnRpcEnumUserItem + { + /// + /// User name + /// + public string Name_str; + + /// + /// Group name + /// + public string GroupName_str; + + /// + /// Real name + /// + public string Realname_utf; + + /// + /// Note + /// + public string Note_utf; + + /// + /// Authentication method + /// + public VpnRpcUserAuthType AuthType_u32; + + /// + /// Number of logins + /// + public uint NumLogin_u32; + + /// + /// Last login date and time + /// + public DateTime LastLoginTime_dt; + + /// + /// Access denied + /// + public bool DenyAccess_bool; + + /// + /// Flag of whether the traffic variable is set + /// + public bool IsTrafficFilled_bool; + + /// + /// Flag of whether expiration date variable is set + /// + public bool IsExpiresFilled_bool; + + /// + /// Expiration date + /// + public DateTime Expires_dt; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Ex.Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Ex.Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Ex.Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Ex.Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Ex.Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Ex.Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Ex.Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Ex.Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + } + + /// + /// Enumeration of user + /// + public class VpnRpcEnumUser + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// User list + /// + public VpnRpcEnumUserItem[] UserList; + } + + /// + /// Source IP Address Limit List Item + /// + public class VpnAc + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// Priority + /// + public uint Priority_u32; + + /// + /// Deny access + /// + public bool Deny_bool; + + /// + /// Set true if you want to specify the SubnetMask_ip item. + /// + public bool Masked_bool; + + /// + /// IP address + /// + public string IpAddress_ip; + + /// + /// Subnet mask, valid only if Masked_bool == true + /// + public string SubnetMask_ip; + } + + /// + /// Source IP Address Limit List + /// + public class VpnRpcAcList + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Source IP Address Limit List + /// + public VpnAc[] ACList; + } + + /// + /// Message + /// + public class VpnRpcMsg + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Message (Unicode strings acceptable) + /// + public byte[] Msg_bin; + } + + /// + /// Get / Set the Azure state + /// + public class VpnRpcAzureStatus + { + /// + /// Whether VPN Azure Function is Enabled + /// + public bool IsEnabled_bool; + + /// + /// Whether connection to VPN Azure Cloud Server is established + /// + public bool IsConnected_bool; + } + + /// + /// Local Bridge support information + /// + public class VpnRpcBridgeSupport + { + /// + /// Whether the OS supports the Local Bridge function + /// + public bool IsBridgeSupportedOs_bool; + + /// + /// Whether WinPcap is necessary to install + /// + public bool IsWinPcapNeeded_bool; + } + + /// + /// Get the CA of HUB + /// + public class VpnRpcHubGetCA + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The key id of the certificate + /// + public uint Key_u32; + + /// + /// The body of the X.509 certificate + /// + public byte[] Cert_bin; + } + + /// + /// Caps item of the VPN Server + /// + public class VpnCaps + { + /// + /// Name + /// + public string CapsName_str; + + /// + /// Value + /// + public uint CapsValue_u32; + + /// + /// Descrption + /// + public string CapsDescrption_utf; + } + + /// + /// Caps list of the VPN Server + /// + public class VpnCapslist + { + /// + /// Caps list of the VPN Server + /// + public VpnCaps[] CapsList; + } + + /// + /// Config operation + /// + public class VpnRpcConfig + { + /// + /// File name (valid only for returning from the server) + /// + public string FileName_str; + + /// + /// File data + /// + public byte[] FileData_bin; + } + + /// + /// Connection information + /// + public class VpnRpcConnectionInfo + { + /// + /// Connection name + /// + public string Name_str; + + /// + /// Type + /// + public VpnRpcConnectionType Type_u32; + + /// + /// Host name + /// + public string Hostname_str; + + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Port number + /// + public uint Port_u32; + + /// + /// Connected time + /// + public DateTime ConnectedTime_dt; + + /// + /// Server string + /// + public string ServerStr_str; + + /// + /// Server version + /// + public uint ServerVer_u32; + + /// + /// Server build number + /// + public uint ServerBuild_u32; + + /// + /// Client string + /// + public string ClientStr_str; + + /// + /// Client version + /// + public uint ClientVer_u32; + + /// + /// Client build number + /// + public uint ClientBuild_u32; + } + + /// + /// Proxy type + /// + public enum VpnRpcProxyType + { + /// + /// Direct TCP connection + /// + Direct = 0, + + /// + /// Connection via HTTP proxy server + /// + HTTP = 1, + + /// + /// Connection via SOCKS proxy server + /// + SOCKS = 2, + } + + /// + /// The current status of the DDNS + /// + public class VpnDDnsClientStatus + { + /// + /// Last error code (IPv4) + /// + public uint Err_IPv4_u32; + + /// + /// Last error string (IPv4) + /// + public string ErrStr_IPv4_utf; + + /// + /// Last error code (IPv6) + /// + public uint Err_IPv6_u32; + + /// + /// Last error string (IPv6) + /// + public string ErrStr_IPv6_utf; + + /// + /// Current DDNS host name + /// + public string CurrentHostName_str; + + /// + /// Current FQDN of the DDNS hostname + /// + public string CurrentFqdn_str; + + /// + /// DDNS suffix + /// + public string DnsSuffix_str; + + /// + /// Current IPv4 address of the VPN Server + /// + public string CurrentIPv4_str; + + /// + /// Current IPv6 address of the VPN Server + /// + public string CurrentIPv6_str; + } + + /// + /// Internet connection settings + /// + public class VpnInternetSetting + { + /// + /// Type of proxy server + /// + public VpnRpcProxyType ProxyType_u32; + + /// + /// Proxy server host name + /// + public string ProxyHostName_str; + + /// + /// Proxy server port number + /// + public uint ProxyPort_u32; + + /// + /// Proxy server user name + /// + public string ProxyUsername_str; + + /// + /// Proxy server password + /// + public string ProxyPassword_str; + } + + /// + /// Administration options + /// + public class VpnAdminOption + { + /// + /// Name + /// + public string Name_str; + + /// + /// Data + /// + public uint Value_u32; + + /// + /// Descrption + /// + public string Descrption_utf; + } + + /// + /// Administration options list + /// + public class VpnRpcAdminOption + { + /// + /// Virtual HUB name + /// + public string HubName_str; + + /// + /// List data + /// + public VpnAdminOption[] AdminOptionList; + } + + /// + /// Connection state to the controller + /// + public class VpnRpcFarmConnectionStatus + { + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Port number + /// + public uint Port_u32; + + /// + /// Online state + /// + public bool Online_bool; + + /// + /// Last error code + /// + public uint LastError_u32; + + /// + /// Connection start time + /// + public DateTime StartedTime_dt; + + /// + /// First connection time + /// + public DateTime FirstConnectedTime_dt; + + /// + /// Connection time of this time + /// + public DateTime CurrentConnectedTime_dt; + + /// + /// Number of retries + /// + public uint NumTry_u32; + + /// + /// Number of connection count + /// + public uint NumConnected_u32; + + /// + /// Connection failure count + /// + public uint NumFailed_u32; + } + + /// + /// HUB item of each farm member + /// + public class VpnRpcFarmHub + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Dynamic HUB + /// + public bool DynamicHub_bool; + } + + + /// + /// Server farm member information acquisition + /// + public class VpnRpcFarmInfo + { + /// + /// ID + /// + public uint Id_u32; + + /// + /// The flag if the server is Cluster Controller (false: Cluster Member servers) + /// + public bool Controller_bool; + + /// + /// Connection Established Time + /// + public DateTime ConnectedTime_dt; + + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Host name + /// + public string Hostname_str; + + /// + /// Point + /// + public uint Point_u32; + + /// + /// Number of Public Ports + /// + public uint NumPort_u32; + + /// + /// Public Ports + /// + public uint[] Ports_u32; + + /// + /// Server certificate + /// + public byte[] ServerCert_bin; + + /// + /// Number of farm HUB + /// + public uint NumFarmHub_u32; + + /// + /// The hosted Virtual Hub list + /// + public VpnRpcFarmHub[] HubsList; + + /// + /// Number of hosted VPN sessions + /// + public uint NumSessions_u32; + + /// + /// Number of TCP connections + /// + public uint NumTcpConnections_u32; + + /// + /// Performance Standard Ratio + /// + public uint Weight_u32; + } + + /// + /// Server farm configuration + /// + public class VpnRpcFarm + { + /// + /// Type of server + /// + public VpnRpcServerType ServerType_u32; + + /// + /// Valid only for Cluster Member servers. Number of the Ports_u32 element. + /// + public uint NumPort_u32; + + /// + /// Valid only for Cluster Member servers. Specify the list of public port numbers on this server. The list must have at least one public port number set, and it is also possible to set multiple public port numbers. + /// + public uint[] Ports_u32; + + /// + /// Valid only for Cluster Member servers. Specify the public IP address of this server. If you wish to leave public IP address unspecified, specify the empty string. When a public IP address is not specified, the IP address of the network interface used when connecting to the cluster controller will be automatically used. + /// + public string PublicIp_ip; + + /// + /// Valid only for Cluster Member servers. Specify the host name or IP address of the destination cluster controller. + /// + public string ControllerName_str; + + /// + /// Valid only for Cluster Member servers. Specify the TCP port number of the destination cluster controller. + /// + public uint ControllerPort_u32; + + /// + /// Valid only for Cluster Member servers. Specify the password required to connect to the destination controller. It needs to be the same as an administrator password on the destination controller. + /// + public string MemberPasswordPlaintext_str; + + /// + /// This sets a value for the performance standard ratio of this VPN Server. This is the standard value for when load balancing is performed in the cluster. For example, making only one machine 200 while the other members have a status of 100, will regulate that machine to receive twice as many connections as the other members. Specify 1 or higher for the value. If this parameter is left unspecified, 100 will be used. + /// + public uint Weight_u32; + + /// + /// Valid only for Cluster Controller server. By specifying true, the VPN Server will operate only as a controller on the cluster and it will always distribute general VPN Client connections to members other than itself. This function is used in high-load environments. + /// + public bool ControllerOnly_bool; + } + + /// + /// Log switch type + /// + public enum VpnRpcLogSwitchType + { + /// + /// No switching + /// + No = 0, + + /// + /// Secondly basis + /// + Second = 1, + + /// + /// Minutely basis + /// + Minute = 2, + + /// + /// Hourly basis + /// + Hour = 3, + + /// + /// Daily basis + /// + Day = 4, + + /// + /// Monthly basis + /// + Month = 5, + } + + /// + /// Packet log settings + /// + public enum VpnRpcPacketLogSetting + { + /// + /// Not save + /// + None = 0, + + /// + /// Only header + /// + Header = 1, + + /// + /// All payloads + /// + All = 2, + } + + /// + /// Packet log settings array index + /// + public enum VpnRpcPacketLogSettingIndex + { + /// + /// TCP connection log + /// + TcpConnection = 0, + + /// + /// TCP packet log + /// + TcpAll = 1, + + /// + /// DHCP Log + /// + Dhcp = 2, + + /// + /// UDP log + /// + Udp = 3, + + /// + /// ICMP log + /// + Icmp = 4, + + /// + /// IP log + /// + Ip = 5, + + /// + /// ARP log + /// + Arp = 6, + + /// + /// Ethernet log + /// + Ethernet = 7, + } + + /// + /// HUB log settings + /// + public class VpnRpcHubLog + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The flag to enable / disable saving the security log + /// + public bool SaveSecurityLog_bool; + + /// + /// The log filename switching setting of the security log + /// + public VpnRpcLogSwitchType SecurityLogSwitchType_u32; + + /// + /// The flag to enable / disable saving the security log + /// + public bool SavePacketLog_bool; + + /// + /// The log filename switching settings of the packet logs + /// + public VpnRpcLogSwitchType PacketLogSwitchType_u32; + + /// + /// Specify the save contents of the packet logs (uint * 16 array). The index numbers: TcpConnection = 0, TcpAll = 1, DHCP = 2, UDP = 3, ICMP = 4, IP = 5, ARP = 6, Ethernet = 7. + /// + public VpnRpcPacketLogSetting[] PacketLogConfig_u32 = new VpnRpcPacketLogSetting[16]; + } + + /// + /// RADIUS server options + /// + public class VpnRpcRadius + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// RADIUS server name + /// + public string RadiusServerName_str; + + /// + /// RADIUS port number + /// + public uint RadiusPort_u32; + + /// + /// Secret key + /// + public string RadiusSecret_str; + + /// + /// Radius retry interval + /// + public uint RadiusRetryInterval_u32; + } + + /// + /// Get the state HUB + /// + public class VpnRpcHubStatus + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Online + /// + public bool Online_bool; + + /// + /// Type of HUB + /// + public VpnRpcHubType HubType_u32; + + /// + /// Number of sessions + /// + public uint NumSessions_u32; + + /// + /// Number of sessions (client mode) + /// + public uint NumSessionsClient_u32; + + /// + /// Number of sessions (bridge mode) + /// + public uint NumSessionsBridge_u32; + + /// + /// Number of Access list entries + /// + public uint NumAccessLists_u32; + + /// + /// Number of users + /// + public uint NumUsers_u32; + + /// + /// Number of groups + /// + public uint NumGroups_u32; + + /// + /// Number of MAC table entries + /// + public uint NumMacTables_u32; + + /// + /// Number of IP table entries + /// + public uint NumIpTables_u32; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + + /// + /// Whether SecureNAT is enabled + /// + public bool SecureNATEnabled_bool; + + /// + /// Last communication date and time + /// + public DateTime LastCommTime_dt; + + /// + /// Last login date and time + /// + public DateTime LastLoginTime_dt; + + /// + /// Creation date and time + /// + public DateTime CreatedTime_dt; + + /// + /// Number of logins + /// + public uint NumLogin_u32; + } + + /// + /// List of services provided by IPsec server + /// + public class VpnIPsecServices + { + /// + /// Enable or Disable the L2TP Server Function (Raw L2TP with No Encryptions). To accept special VPN clients, enable this option. + /// + public bool L2TP_Raw_bool; + + /// + /// Enable or Disable the L2TP over IPsec Server Function. To accept VPN connections from iPhone, iPad, Android, Windows or Mac OS X, enable this option. + /// + public bool L2TP_IPsec_bool; + + /// + /// Enable or Disable the EtherIP / L2TPv3 over IPsec Server Function (for site-to-site VPN Server function). Router Products which are compatible with EtherIP over IPsec can connect to Virtual Hubs on the VPN Server and establish Layer-2 (Ethernet) Bridging. + /// + public bool EtherIP_IPsec_bool; + + /// + /// Specify the IPsec Pre-Shared Key. An IPsec Pre-Shared Key is also called as "PSK" or "secret". Specify it equal or less than 8 letters, and distribute it to every users who will connect to the VPN Server. Please note: Google Android 4.0 has a bug which a Pre-Shared Key with 10 or more letters causes a unexpected behavior. For that reason, the letters of a Pre-Shared Key should be 9 or less characters. + /// + public string IPsec_Secret_str; + + /// + /// Specify the default Virtual HUB in a case of omitting the name of HUB on the Username. Users should specify their username such as "Username@Target Virtual HUB Name" to connect this L2TP Server. If the designation of the Virtual Hub is omitted, the above HUB will be used as the target. + /// + public string L2TP_DefaultHub_str; + } + + /// + /// Keep alive protocol + /// + public enum VpnRpcKeepAliveProtocol + { + /// + /// TCP + /// + TCP = 0, + + /// + /// UDP + /// + UDP = 1, + } + + /// + /// Keep Alive settings + /// + public class VpnRpcKeep + { + /// + /// The flag to enable keep-alive to the Internet + /// + public bool UseKeepConnect_bool; + + /// + /// Specify the host name or IP address of the destination + /// + public string KeepConnectHost_str; + + /// + /// Specify the port number of the destination + /// + public uint KeepConnectPort_u32; + + /// + /// Protocol type + /// + public VpnRpcKeepAliveProtocol KeepConnectProtocol_u32; + + /// + /// Interval Between Packets Sends (Seconds) + /// + public uint KeepConnectInterval_u32; + } + + /// + /// State of the client session + /// + public enum VpnRpcClientSessionStatus + { + /// + /// Connecting + /// + Connecting = 0, + + /// + /// Negotiating + /// + Negotiation = 1, + + /// + /// During user authentication + /// + Auth = 2, + + /// + /// Connection complete + /// + Established = 3, + + /// + /// Wait to retry + /// + Retry = 4, + + /// + /// Idle state + /// + Idle = 5, + } + + /// + /// Get the link state + /// + public class VpnRpcLinkStatus + { + /// + /// The Virtual Hub name + /// + public string HubName_Ex_str; + + /// + /// The name of the cascade connection + /// + public string AccountName_utf; + + /// + /// The flag whether the cascade connection is enabled + /// + public bool Active_bool; + + /// + /// The flag whether the cascade connection is established + /// + public bool Connected_bool; + + /// + /// The session status + /// + public VpnRpcClientSessionStatus SessionStatus_u32; + + /// + /// The destination VPN server name + /// + public string ServerName_str; + + /// + /// The port number of the server + /// + public uint ServerPort_u32; + + /// + /// Server product name + /// + public string ServerProductName_str; + + /// + /// Server product version + /// + public uint ServerProductVer_u32; + + /// + /// Server product build number + /// + public uint ServerProductBuild_u32; + + /// + /// Server's X.509 certificate + /// + public byte[] ServerX_bin; + + /// + /// Client certificate + /// + public byte[] ClientX_bin; + + /// + /// Connection start time + /// + public DateTime StartTime_dt; + + /// + /// Connection completion time of the first connection + /// + public DateTime FirstConnectionEstablisiedTime_dt; + + /// + /// Connection completion time of this connection + /// + public DateTime CurrentConnectionEstablishTime_dt; + + /// + /// Number of connections have been established so far + /// + public uint NumConnectionsEatablished_u32; + + /// + /// Half-connection + /// + public bool HalfConnection_bool; + + /// + /// VoIP / QoS + /// + public bool QoS_bool; + + /// + /// Maximum number of the underlying TCP connections + /// + public uint MaxTcpConnections_u32; + + /// + /// Number of current underlying TCP connections + /// + public uint NumTcpConnections_u32; + + /// + /// Number of underlying inbound TCP connections + /// + public uint NumTcpConnectionsUpload_u32; + + /// + /// Number of underlying outbound TCP connections + /// + public uint NumTcpConnectionsDownload_u32; + + /// + /// Use of encryption + /// + public bool UseEncrypt_bool; + + /// + /// Cipher algorithm name + /// + public string CipherName_str; + + /// + /// Use of compression + /// + public bool UseCompress_bool; + + /// + /// The flag whether this is a R-UDP session + /// + public bool IsRUDPSession_bool; + + /// + /// Underlying physical communication protocol + /// + public string UnderlayProtocol_str; + + /// + /// The UDP acceleration is enabled + /// + public bool IsUdpAccelerationEnabled_bool; + + /// + /// The UDP acceleration is being actually used + /// + public bool IsUsingUdpAcceleration_bool; + + /// + /// Session name + /// + public string SessionName_str; + + /// + /// Connection name + /// + public string ConnectionName_str; + + /// + /// Session key + /// + public byte[] SessionKey_bin; + + /// + /// Total transmitted data size + /// + public ulong TotalSendSize_u64; + + /// + /// Total received data size + /// + public ulong TotalRecvSize_u64; + + /// + /// Total transmitted data size (no compression) + /// + public ulong TotalSendSizeReal_u64; + + /// + /// Total received data size (no compression) + /// + public ulong TotalRecvSizeReal_u64; + + /// + /// The flag whether the VPN session is Bridge Mode + /// + public bool IsBridgeMode_bool; + + /// + /// The flag whether the VPN session is Monitor mode + /// + public bool IsMonitorMode_bool; + + /// + /// VLAN ID + /// + public uint VLanId_u32; + } + + /// + /// Setting of SSTP and OpenVPN + /// + public class VpnOpenVpnSstpConfig + { + /// + /// Specify true to enable the OpenVPN Clone Server Function. Specify false to disable. + /// + public bool EnableOpenVPN_bool; + + /// + /// Specify UDP ports to listen for OpenVPN. Multiple UDP ports can be specified with splitting by space or comma letters, for example: "1194, 2001, 2010, 2012". The default port for OpenVPN is UDP 1194. You can specify any other UDP ports. + /// + public string OpenVPNPortList_str; + + /// + /// pecify true to enable the Microsoft SSTP VPN Clone Server Function. Specify false to disable. + /// + public bool EnableSSTP_bool; + } + + /// + /// Virtual host option + /// + public class VpnVhOption + { + /// + /// Target Virtual HUB name + /// + public string RpcHubName_str; + + /// + /// MAC address + /// + public byte[] MacAddress_bin; + + /// + /// IP address + /// + public string Ip_ip; + + /// + /// Subnet mask + /// + public string Mask_ip; + + /// + /// Use flag of the Virtual NAT function + /// + public bool UseNat_bool; + + /// + /// MTU value (Standard: 1500) + /// + public uint Mtu_u32; + + /// + /// NAT TCP timeout in seconds + /// + public uint NatTcpTimeout_u32; + + /// + /// NAT UDP timeout in seconds + /// + public uint NatUdpTimeout_u32; + + /// + /// Using flag of DHCP function + /// + public bool UseDhcp_bool; + + /// + /// Specify the start point of the address band to be distributed to the client. (Example: 192.168.30.10) + /// + public string DhcpLeaseIPStart_ip; + + /// + /// Specify the end point of the address band to be distributed to the client. (Example: 192.168.30.200) + /// + public string DhcpLeaseIPEnd_ip; + + /// + /// Specify the subnet mask to be specified for the client. (Example: 255.255.255.0) + /// + public string DhcpSubnetMask_ip; + + /// + /// Specify the expiration date in second units for leasing an IP address to a client. + /// + public uint DhcpExpireTimeSpan_u32; + + /// + /// Specify the IP address of the default gateway to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the default gateway. + /// + public string DhcpGatewayAddress_ip; + + /// + /// Specify the IP address of the primary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify empty, then the client will not be notified of the DNS Server address. + /// + public string DhcpDnsServerAddress_ip; + + /// + /// Specify the IP address of the secondary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify empty, then the client will not be notified of the DNS Server address. + /// + public string DhcpDnsServerAddress2_ip; + + /// + /// Specify the domain name to be notified to the client. If you specify none, then the client will not be notified of the domain name. + /// + public string DhcpDomainName_str; + + /// + /// Specify whether or not to save the Virtual DHCP Server operation in the Virtual Hub security log. Specify true to save it. This value is interlinked with the Virtual NAT Function log save setting. + /// + public bool SaveLog_bool; + + /// + /// The flag to enable the DhcpPushRoutes_str field. + /// + public bool ApplyDhcpPushRoutes_bool; + + /// + /// Specify the static routing table to push. Example: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253" Split multiple entries (maximum: 64 entries) by comma or space characters. Each entry must be specified in the "IP network address/subnet mask/gateway IP address" format. This Virtual DHCP Server can push the classless static routes (RFC 3442) with DHCP reply messages to VPN clients. Whether or not a VPN client can recognize the classless static routes (RFC 3442) depends on the target VPN client software. SoftEther VPN Client and OpenVPN Client are supporting the classless static routes. On L2TP/IPsec and MS-SSTP protocols, the compatibility depends on the implementation of the client software. You can realize the split tunneling if you clear the default gateway field on the Virtual DHCP Server options. On the client side, L2TP/IPsec and MS-SSTP clients need to be configured not to set up the default gateway for the split tunneling usage. You can also push the classless static routes (RFC 3442) by your existing external DHCP server. In that case, disable the Virtual DHCP Server function on SecureNAT, and you need not to set up the classless routes on this API. See the RFC 3442 to understand the classless routes. + /// + public string DhcpPushRoutes_str; + } + + /// + /// RPC_NAT_STATUS + /// + public class VpnRpcNatStatus + { + /// + /// Virtual Hub Name + /// + public string HubName_str; + + /// + /// Number of TCP sessions + /// + public uint NumTcpSessions_u32; + + /// + /// Ntmber of UDP sessions + /// + public uint NumUdpSessions_u32; + + /// + /// Nymber of ICMP sessions + /// + public uint NumIcmpSessions_u32; + + /// + /// Number of DNS sessions + /// + public uint NumDnsSessions_u32; + + /// + /// Number of DHCP clients + /// + public uint NumDhcpClients_u32; + + /// + /// Whether the NAT is operating in the Kernel Mode + /// + public bool IsKernelMode_bool; + + /// + /// Whether the NAT is operating in the Raw IP Mode + /// + public bool IsRawIpMode_bool; + } + + /// + /// Key pair + /// + public class VpnRpcKeyPair + { + /// + /// The body of the certificate + /// + public byte[] Cert_bin; + + /// + /// The body of the private key + /// + public byte[] Key_bin; + } + + /// + /// Single string value + /// + public class VpnRpcStr + { + /// + /// A string value + /// + public string String_str; + } + + /// + /// Type of VPN Server + /// + public enum VpnRpcServerType + { + /// + /// Stand-alone server + /// + Standalone = 0, + + /// + /// Farm controller server + /// + FarmController = 1, + + /// + /// Farm member server + /// + FarmMember = 2, + } + + /// + /// Operating system type + /// + public enum VpnRpcOsType + { + /// + /// Windows 95 + /// + WINDOWS_95 = 1100, + + /// + /// Windows 98 + /// + WINDOWS_98 = 1200, + + /// + /// Windows Me + /// + WINDOWS_ME = 1300, + + /// + /// Windows (unknown) + /// + WINDOWS_UNKNOWN = 1400, + + /// + /// Windows NT 4.0 Workstation + /// + WINDOWS_NT_4_WORKSTATION = 2100, + + /// + /// Windows NT 4.0 Server + /// + WINDOWS_NT_4_SERVER = 2110, + + /// + /// Windows NT 4.0 Server, Enterprise Edition + /// + WINDOWS_NT_4_SERVER_ENTERPRISE = 2111, + + /// + /// Windows NT 4.0 Terminal Server + /// + WINDOWS_NT_4_TERMINAL_SERVER = 2112, + + /// + /// BackOffice Server 4.5 + /// + WINDOWS_NT_4_BACKOFFICE = 2113, + + /// + /// Small Business Server 4.5 + /// + WINDOWS_NT_4_SMS = 2114, + + /// + /// Windows 2000 Professional + /// + WINDOWS_2000_PROFESSIONAL = 2200, + + /// + /// Windows 2000 Server + /// + WINDOWS_2000_SERVER = 2211, + + /// + /// Windows 2000 Advanced Server + /// + WINDOWS_2000_ADVANCED_SERVER = 2212, + + /// + /// Windows 2000 Datacenter Server + /// + WINDOWS_2000_DATACENTER_SERVER = 2213, + + /// + /// BackOffice Server 2000 + /// + WINDOWS_2000_BACKOFFICE = 2214, + + /// + /// Small Business Server 2000 + /// + WINDOWS_2000_SBS = 2215, + + /// + /// Windows XP Home Edition + /// + WINDOWS_XP_HOME = 2300, + + /// + /// Windows XP Professional + /// + WINDOWS_XP_PROFESSIONAL = 2301, + + /// + /// Windows Server 2003 Web Edition + /// + WINDOWS_2003_WEB = 2410, + + /// + /// Windows Server 2003 Standard Edition + /// + WINDOWS_2003_STANDARD = 2411, + + /// + /// Windows Server 2003 Enterprise Edition + /// + WINDOWS_2003_ENTERPRISE = 2412, + + /// + /// Windows Server 2003 DataCenter Edition + /// + WINDOWS_2003_DATACENTER = 2413, + + /// + /// BackOffice Server 2003 + /// + WINDOWS_2003_BACKOFFICE = 2414, + + /// + /// Small Business Server 2003 + /// + WINDOWS_2003_SBS = 2415, + + /// + /// Windows Vista + /// + WINDOWS_LONGHORN_PROFESSIONAL = 2500, + + /// + /// Windows Server 2008 + /// + WINDOWS_LONGHORN_SERVER = 2510, + + /// + /// Windows 7 + /// + WINDOWS_7 = 2600, + + /// + /// Windows Server 2008 R2 + /// + WINDOWS_SERVER_2008_R2 = 2610, + + /// + /// Windows 8 + /// + WINDOWS_8 = 2700, + + /// + /// Windows Server 2012 + /// + WINDOWS_SERVER_8 = 2710, + + /// + /// Windows 8.1 + /// + WINDOWS_81 = 2701, + + /// + /// Windows Server 2012 R2 + /// + WINDOWS_SERVER_81 = 2711, + + /// + /// Windows 10 + /// + WINDOWS_10 = 2702, + + /// + /// Windows Server 10 + /// + WINDOWS_SERVER_10 = 2712, + + /// + /// Windows 11 or later + /// + WINDOWS_11 = 2800, + + /// + /// Windows Server 11 or later + /// + WINDOWS_SERVER_11 = 2810, + + /// + /// Unknown UNIX + /// + UNIX_UNKNOWN = 3000, + + /// + /// Linux + /// + LINUX = 3100, + + /// + /// Solaris + /// + SOLARIS = 3200, + + /// + /// Cygwin + /// + CYGWIN = 3300, + + /// + /// BSD + /// + BSD = 3400, + + /// + /// MacOS X + /// + MACOS_X = 3500, + } + + /// + /// VPN Server Information + /// + public class VpnRpcServerInfo + { + /// + /// Server product name + /// + public string ServerProductName_str; + + /// + /// Server version string + /// + public string ServerVersionString_str; + + /// + /// Server build information string + /// + public string ServerBuildInfoString_str; + + /// + /// Server version integer value + /// + public uint ServerVerInt_u32; + + /// + /// Server build number integer value + /// + public uint ServerBuildInt_u32; + + /// + /// Server host name + /// + public string ServerHostName_str; + + /// + /// Type of server + /// + public VpnRpcServerType ServerType_u32; + + /// + /// Build date and time of the server + /// + public DateTime ServerBuildDate_dt; + + /// + /// Family name + /// + public string ServerFamilyName_str; + + /// + /// OS type + /// + public VpnRpcOsType OsType_u32; + + /// + /// Service pack number + /// + public uint OsServicePack_u32; + + /// + /// OS system name + /// + public string OsSystemName_str; + + /// + /// OS product name + /// + public string OsProductName_str; + + /// + /// OS vendor name + /// + public string OsVendorName_str; + + /// + /// OS version + /// + public string OsVersion_str; + + /// + /// Kernel name + /// + public string KernelName_str; + + /// + /// Kernel version + /// + public string KernelVersion_str; + } + + /// + /// Server status + /// + public class VpnRpcServerStatus + { + /// + /// Type of server + /// + public VpnRpcServerType ServerType_u32; + + /// + /// Total number of TCP connections + /// + public uint NumTcpConnections_u32; + + /// + /// Number of Local TCP connections + /// + public uint NumTcpConnectionsLocal_u32; + + /// + /// Number of remote TCP connections + /// + public uint NumTcpConnectionsRemote_u32; + + /// + /// Total number of HUBs + /// + public uint NumHubTotal_u32; + + /// + /// Nymber of stand-alone HUB + /// + public uint NumHubStandalone_u32; + + /// + /// Number of static HUBs + /// + public uint NumHubStatic_u32; + + /// + /// Number of Dynamic HUBs + /// + public uint NumHubDynamic_u32; + + /// + /// Total number of sessions + /// + public uint NumSessionsTotal_u32; + + /// + /// Number of local VPN sessions + /// + public uint NumSessionsLocal_u32; + + /// + /// The number of remote sessions + /// + public uint NumSessionsRemote_u32; + + /// + /// Number of MAC table entries (total sum of all Virtual Hubs) + /// + public uint NumMacTables_u32; + + /// + /// Number of IP table entries (total sum of all Virtual Hubs) + /// + public uint NumIpTables_u32; + + /// + /// Number of users (total sum of all Virtual Hubs) + /// + public uint NumUsers_u32; + + /// + /// Number of groups (total sum of all Virtual Hubs) + /// + public uint NumGroups_u32; + + /// + /// Number of assigned bridge licenses (Useful to make a commercial version) + /// + public uint AssignedBridgeLicenses_u32; + + /// + /// Number of assigned client licenses (Useful to make a commercial version) + /// + public uint AssignedClientLicenses_u32; + + /// + /// Number of Assigned bridge license (cluster-wide), useful to make a commercial version + /// + public uint AssignedBridgeLicensesTotal_u32; + + /// + /// Number of assigned client licenses (cluster-wide), useful to make a commercial version + /// + public uint AssignedClientLicensesTotal_u32; + + /// + /// Number of broadcast packets (Recv) + /// + [JsonProperty("Recv.BroadcastBytes_u64")] + public ulong Recv_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Recv) + /// + [JsonProperty("Recv.BroadcastCount_u64")] + public ulong Recv_BroadcastCount_u64; + + /// + /// Unicast count (Recv) + /// + [JsonProperty("Recv.UnicastBytes_u64")] + public ulong Recv_UnicastBytes_u64; + + /// + /// Unicast bytes (Recv) + /// + [JsonProperty("Recv.UnicastCount_u64")] + public ulong Recv_UnicastCount_u64; + + /// + /// Number of broadcast packets (Send) + /// + [JsonProperty("Send.BroadcastBytes_u64")] + public ulong Send_BroadcastBytes_u64; + + /// + /// Broadcast bytes (Send) + /// + [JsonProperty("Send.BroadcastCount_u64")] + public ulong Send_BroadcastCount_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastBytes_u64")] + public ulong Send_UnicastBytes_u64; + + /// + /// Unicast bytes (Send) + /// + [JsonProperty("Send.UnicastCount_u64")] + public ulong Send_UnicastCount_u64; + + /// + /// Current time + /// + public DateTime CurrentTime_dt; + + /// + /// 64 bit High-Precision Logical System Clock + /// + public ulong CurrentTick_u64; + + /// + /// VPN Server Start-up time + /// + public DateTime StartTime_dt; + + /// + /// Memory information: Total Memory + /// + public ulong TotalMemory_u64; + + /// + /// Memory information: Used Memory + /// + public ulong UsedMemory_u64; + + /// + /// Memory information: Free Memory + /// + public ulong FreeMemory_u64; + + /// + /// Memory information: Total Phys + /// + public ulong TotalPhys_u64; + + /// + /// Memory information: Used Phys + /// + public ulong UsedPhys_u64; + + /// + /// Memory information: Free Phys + /// + public ulong FreePhys_u64; + } + + /// + /// VPN Session status + /// + public class VpnRpcSessionStatus + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// VPN session name + /// + public string Name_str; + + /// + /// User name + /// + public string Username_str; + + /// + /// Real user name which was used for the authentication + /// + public string RealUsername_str; + + /// + /// Group name + /// + public string GroupName_str; + + /// + /// Is Cascade Session + /// + public bool LinkMode_bool; + + /// + /// Client IP address + /// + public string Client_Ip_Address_ip; + + /// + /// Client host name + /// + [JsonProperty("SessionStatus_ClientHostName_str")] + public string ClientHostName_str; + + /// + /// Operation flag + /// + public bool Active_bool; + + /// + /// Connected flag + /// + public bool Connected_bool; + + /// + /// State of the client session + /// + public VpnRpcClientSessionStatus SessionStatus_u32; + + /// + /// Server name + /// + public string ServerName_str; + + /// + /// Port number of the server + /// + public uint ServerPort_u32; + + /// + /// Server product name + /// + public string ServerProductName_str; + + /// + /// Server product version + /// + public uint ServerProductVer_u32; + + /// + /// Server product build number + /// + public uint ServerProductBuild_u32; + + /// + /// Connection start time + /// + public DateTime StartTime_dt; + + /// + /// Connection completion time of the first connection + /// + public DateTime FirstConnectionEstablisiedTime_dt; + + /// + /// Connection completion time of this connection + /// + public DateTime CurrentConnectionEstablishTime_dt; + + /// + /// Number of connections have been established so far + /// + public uint NumConnectionsEatablished_u32; + + /// + /// Half-connection + /// + public bool HalfConnection_bool; + + /// + /// VoIP / QoS + /// + public bool QoS_bool; + + /// + /// Maximum number of the underlying TCP connections + /// + public uint MaxTcpConnections_u32; + + /// + /// Number of current underlying TCP connections + /// + public uint NumTcpConnections_u32; + + /// + /// Number of inbound underlying connections + /// + public uint NumTcpConnectionsUpload_u32; + + /// + /// Number of outbound underlying connections + /// + public uint NumTcpConnectionsDownload_u32; + + /// + /// Use of encryption + /// + public bool UseEncrypt_bool; + + /// + /// Cipher algorithm name + /// + public string CipherName_str; + + /// + /// Use of compression + /// + public bool UseCompress_bool; + + /// + /// Is R-UDP session + /// + public bool IsRUDPSession_bool; + + /// + /// Physical underlying communication protocol + /// + public string UnderlayProtocol_str; + + /// + /// The UDP acceleration is enabled + /// + public bool IsUdpAccelerationEnabled_bool; + + /// + /// Using the UDP acceleration function + /// + public bool IsUsingUdpAcceleration_bool; + + /// + /// VPN session name + /// + public string SessionName_str; + + /// + /// Connection name + /// + public string ConnectionName_str; + + /// + /// Session key + /// + public byte[] SessionKey_bin; + + /// + /// Total transmitted data size + /// + public ulong TotalSendSize_u64; + + /// + /// Total received data size + /// + public ulong TotalRecvSize_u64; + + /// + /// Total transmitted data size (no compression) + /// + public ulong TotalSendSizeReal_u64; + + /// + /// Total received data size (no compression) + /// + public ulong TotalRecvSizeReal_u64; + + /// + /// Is Bridge Mode + /// + public bool IsBridgeMode_bool; + + /// + /// Is Monitor mode + /// + public bool IsMonitorMode_bool; + + /// + /// VLAN ID + /// + public uint VLanId_u32; + + /// + /// Client product name + /// + public string ClientProductName_str; + + /// + /// Client version + /// + public uint ClientProductVer_u32; + + /// + /// Client build number + /// + public uint ClientProductBuild_u32; + + /// + /// Client OS name + /// + public string ClientOsName_str; + + /// + /// Client OS version + /// + public string ClientOsVer_str; + + /// + /// Client OS Product ID + /// + public string ClientOsProductId_str; + + /// + /// Client host name + /// + public string ClientHostname_str; + + /// + /// Unique ID + /// + public byte[] UniqueId_bin; + } + + /// + /// Set the special listener + /// + public class VpnRpcSpecialListener + { + /// + /// The flag to activate the VPN over ICMP server function + /// + public bool VpnOverIcmpListener_bool; + + /// + /// The flag to activate the VPN over DNS function + /// + public bool VpnOverDnsListener_bool; + } + + /// + /// Syslog configuration + /// + public enum VpnSyslogSaveType + { + /// + /// Do not use syslog + /// + None = 0, + + /// + /// Only server log + /// + ServerLog = 1, + + /// + /// Server and Virtual HUB security log + /// + ServerAndHubSecurityLog = 2, + + /// + /// Server, Virtual HUB security, and packet log + /// + ServerAndHubAllLog = 3, + } + + /// + /// Syslog configuration + /// + public class VpnSyslogSetting + { + /// + /// The behavior of the syslog function + /// + public VpnSyslogSaveType SaveType_u32; + + /// + /// Specify the host name or IP address of the syslog server + /// + public string Hostname_str; + + /// + /// Specify the port number of the syslog server + /// + public uint Port_u32; + } + + /// + /// VPN Gate Server Config + /// + public class VpnVgsConfig + { + /// + /// Active flag + /// + public bool IsEnabled_bool; + + /// + /// Message + /// + public string Message_utf; + + /// + /// Owner name + /// + public string Owner_utf; + + /// + /// Abuse email + /// + public string Abuse_utf; + + /// + /// Log save flag + /// + public bool NoLog_bool; + + /// + /// Save log permanently + /// + public bool LogPermanent_bool; + + /// + /// Enable the L2TP VPN function + /// + public bool EnableL2TP_bool; + } + + /// + /// Read a Log file + /// + public class VpnRpcReadLogFile + { + /// + /// Server name + /// + public string ServerName_str; + + /// + /// File Path + /// + public string FilePath_str; + + /// + /// Offset to download. You have to call the ReadLogFile API multiple times to download the entire log file with requesting a part of the file by specifying the Offset_u32 field. + /// + public uint Offset_u32; + + /// + /// Received buffer + /// + public byte[] Buffer_bin; + } + + /// + /// Rename link + /// + public class VpnRpcRenameLink + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// The old name of the cascade connection + /// + public string OldAccountName_utf; + + /// + /// The new name of the cascade connection + /// + public string NewAccountName_utf; + } + + /// + /// Online or offline the HUB + /// + public class VpnRpcSetHubOnline + { + /// + /// The Virtual Hub name + /// + public string HubName_str; + + /// + /// Online / offline flag + /// + public bool Online_bool; + } + + /// + /// Set Password + /// + public class VpnRpcSetPassword + { + /// + /// The plaintext password + /// + public string PlainTextPassword_str; + } + +} diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs new file mode 100644 index 00000000..b407750f --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs @@ -0,0 +1,3736 @@ +// SoftEther VPN Server JSON-RPC Stub code for C# +// +// VpnServerRpcTest.cs - Test sample code for SoftEther VPN Server JSON-RPC Stub +// +// This sample code shows how to call all available RPC functions. +// You can copy and paste test code to write your own C# codes. +// +// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen +// +// Licensed under the Apache License 2.0 +// Copyright (c) 2014-__YEAR__ SoftEther VPN Project + +using System; +using SoftEther.VPNServerRpc; + +class VPNRPCTest +{ + VpnServerRpc api; + + Random rand = new Random(); + + string hub_name = "TEST"; + + public VPNRPCTest() + { + api = new VpnServerRpc("127.0.0.1", 443, "PASSWORD_HERE", ""); // Speficy your VPN Server's password here. + } + + /// + /// Tests all VPN APIs + /// + public void Test_All() + { + hub_name = "TEST"; + + Test_Test(); + + Test_GetServerInfo(); + Test_GetServerStatus(); + + uint new_listener_port = Test_CreateListener(); + Test_EnableListener(new_listener_port, false); + Test_EnumListener(); + Test_EnableListener(new_listener_port, true); + Test_EnumListener(); + Test_DeleteListener(new_listener_port); + + Test_SetServerPassword(); + + Test_GetFarmSetting(); + + if (false) + { + + Test_SetFarmSetting(); + + VpnRpcEnumFarm farm_members = Test_EnumFarmMember(); + + foreach (VpnRpcEnumFarmItem farm_member in farm_members.FarmMemberList) + { + Test_GetFarmInfo(farm_member.Id_u32); + } + + Test_GetFarmConnectionStatus(); + } + else if (false) + { + Console.WriteLine("abc"); + } + else + { + Console.WriteLine("def"); + } + + Test_GetServerCert(); + + Test_SetServerCert(); + + Test_GetServerCipher(); + + Test_SetServerCipher(); + + VpnRpcEnumConnection enum_connection = Test_EnumConnection(); + + foreach (VpnRpcEnumConnectionItem connecton in enum_connection.ConnectionList) + { + Test_GetConnectionInfo(connecton.Name_str); + //Test_DisconnectConnection(connecton.Name_str); + } + + hub_name = Test_CreateHub(); + + Test_SetHub(); + Test_GetHub(); + Test_EnumHub(); + Test_SetHubRadius(); + Test_GetHubRadius(); + + Test_SetHubOnline(); + Test_GetHubStatus(); + + VpnRpcHubLog hub_log_settings = Test_GetHubLog(); + Test_SetHubLog(hub_log_settings); + + Test_AddCa(); + VpnRpcHubEnumCA enum_ca = Test_EnumCa(); + foreach (VpnRpcHubEnumCAItem ca in enum_ca.CAList) + { + Test_GetCa(ca.Key_u32); + Test_DeleteCa(ca.Key_u32); + } + + Test_CreateLink(); + Test_GetLink(); + Test_SetLink(); + Test_SetLinkOffline(); + Test_SetLinkOnline(); + VpnRpcEnumLink enum_link = Test_EnumLink(); + foreach (var link in enum_link.LinkList) + { + Test_GetLinkStatus(link.AccountName_utf); + } + System.Threading.Thread.Sleep(3000); + Test_RenameLink(); + Test_DeleteLink(); + + Test_AddAccess(); + Test_EnumAccess(); + Test_DeleteAccess(); + Test_SetAccessList(); + + Test_CreateGroup(); + Test_SetGroup(); + Test_GetGroup(); + + Test_CreateUser(); + Test_SetUser(); + Test_GetUser(); + Test_EnumUser(); + Test_EnumGroup(); + + Test_DeleteUser(); + Test_DeleteGroup(); + + VpnRpcEnumSession enum_session = Test_EnumSession(); + + foreach (VpnRpcEnumSessionItem session in enum_session.SessionList) + { + Test_GetSessionStatus(session.Name_str); + + Test_DeleteSession(session.Name_str); + } + + VpnRpcEnumMacTable enum_mac = Test_EnumMacTable(); + + foreach (VpnRpcEnumMacTableItem mac in enum_mac.MacTable) + { + Test_DeleteMacTable(mac.Key_u32); + } + + VpnRpcEnumIpTable enum_ip = Test_EnumIpTable(); + + foreach (VpnRpcEnumIpTableItem ip in enum_ip.IpTable) + { + Test_DeleteIpTable(ip.Key_u32); + } + + Test_SetKeep(); + Test_GetKeep(); + + Test_EnableSecureNAT(); + Test_GetSecureNATOption(); + Test_SetSecureNATOption(); + Test_EnumNAT(); + Test_EnumDHCP(); + Test_GetSecureNATStatus(); + Test_DisableSecureNAT(); + + Test_EnumEthernet(); + //Test_AddLocalBridge(); + Test_EnumLocalBridge(); + //Test_DeleteLocalBridge(); + Test_GetBridgeSupport(); + + Test_GetCaps(); + Test_GetConfig(); + //Test_SetConfig(); + + Test_GetDefaultHubAdminOptions(); + Test_GetHubAdminOptions(); + Test_SetHubAdminOptions(); + Test_GetHubExtOptions(); + Test_SetHubExtOptions(); + + Test_AddL3Switch(); + Test_AddL3If(); + Test_EnumL3Switch(); + Test_EnumL3If(); + Test_AddL3Table(); + Test_EnumL3Table(); + Test_DelL3Table(); + Test_StartL3Switch(); + Test_StopL3Switch(); + Test_DelL3If(); + Test_DelL3Switch(); + + Test_AddCrl(); + VpnRpcEnumCrl enum_crl = Test_EnumCrl(); + foreach (VpnRpcEnumCrlItem crl in enum_crl.CRLList) + { + VpnRpcCrl got_crl = Test_GetCrl(crl.Key_u32); + + got_crl.CommonName_utf = got_crl.CommonName_utf + "_a"; + Test_SetCrl(got_crl); + } + + enum_crl = Test_EnumCrl(); + foreach (VpnRpcEnumCrlItem crl in enum_crl.CRLList) + { + Test_DelCrl(crl.Key_u32); + } + + Test_SetAcList(); + Test_GetAcList(); + + VpnRpcEnumLogFile enum_log_file = Test_EnumLogFile(); + foreach (VpnRpcEnumLogFileItem log in enum_log_file.LogFiles) + { + Test_ReadLogFile(log.FilePath_str); + + break; + } + + Test_SetSysLog(true); + Test_GetSysLog(); + Test_SetSysLog(false); + + Test_SetHubMsg(); + Test_GetHubMsg(); + Test_GetAdminMsg(); + Test_Flush(); + + Test_SetIPsecServices(); + Test_GetIPsecServices(); + + Test_AddEtherIpId(); + VpnRpcEnumEtherIpId enum_etherip_id = Test_EnumEtherIpId(); + foreach (VpnEtherIpId etherip_id in enum_etherip_id.Settings) + { + Test_GetEtherIpId(etherip_id.Id_str); + Test_DeleteEtherIpId(etherip_id.Id_str); + } + + Test_SetOpenVpnSstpConfig(); + Test_GetOpenVpnSstpConfig(); + + Test_GetDDnsClientStatus(); + Test_SetDDnsInternetSettng(); + Test_GetDDnsInternetSettng(); + + Test_ChangeDDnsClientHostname(); + Test_RegenerateServerCert(); + Test_MakeOpenVpnConfigFile(); + Test_SetSpecialListener(); + Test_GetSpecialListener(); + + Test_GetAzureStatus(); + Test_SetAzureStatus(); + Test_SetVgsConfig(); + Test_GetVgsConfig(); + + Test_DeleteHub(); + //Test_RebootServer(); + + return; + } + + + /// + /// API test for 'Test', test RPC function + /// + public void Test_Test() + { + Console.WriteLine("Begin: Test_Test"); + + VpnRpcTest a = new VpnRpcTest() { IntValue_u32 = 12345 }; + + VpnRpcTest b = api.Test(a); + + print_object(b); + + Console.WriteLine("End: Test_Test"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetServerInfo', Get server information + /// + public void Test_GetServerInfo() + { + Console.WriteLine("Begin: Test_GetServerInfo"); + + VpnRpcServerInfo info = api.GetServerInfo(); + + print_object(info); + + Console.WriteLine("End: Test_GetServerInfo"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetServerStatus', Get server status + /// + public void Test_GetServerStatus() + { + Console.WriteLine("Begin: Test_GetServerStatus"); + + VpnRpcServerStatus out_rpc_server_status = api.GetServerStatus(); + + print_object(out_rpc_server_status); + + Console.WriteLine("End: Test_GetServerStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'CreateListener', Create a listener + /// + public uint Test_CreateListener() + { + Console.WriteLine("Begin: Test_CreateListener"); + + uint port = (uint)rand.Next(1025, 65534); + + Console.WriteLine("Creating a new listener port: Port " + port); + VpnRpcListener in_rpc_listener = new VpnRpcListener() { Enable_bool = true, Port_u32 = port, }; + VpnRpcListener out_rpc_listener = api.CreateListener(in_rpc_listener); + + Console.WriteLine("Done."); + Console.WriteLine("End: Test_CreateListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return port; + } + + /// + /// API test for 'EnumListener', Enumerating listeners + /// + public void Test_EnumListener() + { + Console.WriteLine("Begin: Test_EnumListener"); + + VpnRpcListenerList out_rpc_listener_list = api.EnumListener(); + + print_object(out_rpc_listener_list); + + Console.WriteLine("End: Test_EnumListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteListener', Delete a listener + /// + public void Test_DeleteListener(uint port) + { + Console.WriteLine("Begin: Test_DeleteListener"); + + Console.WriteLine("Deleting a new listener port: Port" + port); + VpnRpcListener in_rpc_listener = new VpnRpcListener() { Port_u32 = port }; + VpnRpcListener out_rpc_listener = api.DeleteListener(in_rpc_listener); + + Console.WriteLine("Done."); + Console.WriteLine("End: Test_DeleteListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnableListener', Enable / Disable listener + /// + public void Test_EnableListener(uint port, bool enabled) + { + Console.WriteLine("Begin: Test_EnableListener"); + + if (enabled) + { + Console.WriteLine("Enabling listener port = " + port); + } + else + { + Console.WriteLine("Disabling listener port = " + port); + } + + VpnRpcListener in_rpc_listener = new VpnRpcListener() { Port_u32 = port, Enable_bool = enabled }; + VpnRpcListener out_rpc_listener = api.EnableListener(in_rpc_listener); + + Console.WriteLine("Done."); + + Console.WriteLine("End: Test_EnableListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetServerPassword', Set server password + /// + public void Test_SetServerPassword() + { + string password = "microsoft"; + + Console.WriteLine("Begin: Test_SetServerPassword"); + + Console.WriteLine("Set the server administrator password to '" + password + "'."); + + VpnRpcSetPassword in_rpc_set_password = new VpnRpcSetPassword() { PlainTextPassword_str = password }; + VpnRpcSetPassword out_rpc_set_password = api.SetServerPassword(in_rpc_set_password); + + Console.WriteLine("Done."); + + Console.WriteLine("End: Test_SetServerPassword"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetFarmSetting', Set clustering configuration + /// + public void Test_SetFarmSetting() + { + Console.WriteLine("Begin: Test_SetFarmSetting"); + + VpnRpcFarm in_rpc_farm = new VpnRpcFarm() + { + ServerType_u32 = VpnRpcServerType.FarmController, + NumPort_u32 = 2, + Ports_u32 = new uint[] { 443, 444, 445 }, + PublicIp_ip = "1.2.3.4", + ControllerName_str = "controller", + MemberPasswordPlaintext_str = "microsoft", + ControllerPort_u32 = 443, + Weight_u32 = 100, + ControllerOnly_bool = false, + }; + + VpnRpcFarm out_rpc_farm = api.SetFarmSetting(in_rpc_farm); + + Console.WriteLine("End: Test_SetFarmSetting"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetFarmSetting', Get clustering configuration + /// + public void Test_GetFarmSetting() + { + Console.WriteLine("Begin: Test_GetFarmSetting"); + + // VpnRpcFarm in_rpc_farm = new VpnRpcFarm(); + VpnRpcFarm out_rpc_farm = api.GetFarmSetting(); + + print_object(out_rpc_farm); + + Console.WriteLine("End: Test_GetFarmSetting"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetFarmInfo', Get cluster member information + /// + public void Test_GetFarmInfo(uint id) + { + Console.WriteLine("Begin: Test_GetFarmInfo"); + + VpnRpcFarmInfo in_rpc_farm_info = new VpnRpcFarmInfo() { Id_u32 = id }; + VpnRpcFarmInfo out_rpc_farm_info = api.GetFarmInfo(in_rpc_farm_info); + + print_object(out_rpc_farm_info); + + Console.WriteLine("End: Test_GetFarmInfo"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumFarmMember', Enumerate cluster members + /// + public VpnRpcEnumFarm Test_EnumFarmMember() + { + Console.WriteLine("Begin: Test_EnumFarmMember"); + + VpnRpcEnumFarm out_rpc_enum_farm = api.EnumFarmMember(); + + print_object(out_rpc_enum_farm); + + Console.WriteLine("End: Test_EnumFarmMember"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_farm; + } + + /// + /// API test for 'GetFarmConnectionStatus', Get status of connection to cluster controller + /// + public void Test_GetFarmConnectionStatus() + { + Console.WriteLine("Begin: Test_GetFarmConnectionStatus"); + + VpnRpcFarmConnectionStatus out_rpc_farm_connection_status = api.GetFarmConnectionStatus(); + + print_object(out_rpc_farm_connection_status); + + Console.WriteLine("End: Test_GetFarmConnectionStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetServerCert', Set the server certification + /// + public void Test_SetServerCert() + { + Console.WriteLine("Begin: Test_SetServerCert"); + + VpnRpcKeyPair in_rpc_key_pair = new VpnRpcKeyPair() + { + Cert_bin = new byte[] + { +0x2d,0x2d,0x2d,0x2d,0x2d,0x42,0x45,0x47,0x49,0x4e,0x20,0x43,0x45,0x52,0x54,0x49, +0x46,0x49,0x43,0x41,0x54,0x45,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a,0x4d,0x49,0x49,0x44, +0x72,0x6a,0x43,0x43,0x41,0x70,0x61,0x67,0x41,0x77,0x49,0x42,0x41,0x67,0x49,0x42, +0x41,0x44,0x41,0x4e,0x42,0x67,0x6b,0x71,0x68,0x6b,0x69,0x47,0x39,0x77,0x30,0x42, +0x41,0x51,0x73,0x46,0x41,0x44,0x42,0x57,0x4d,0x51,0x77,0x77,0x43,0x67,0x59,0x44, +0x56,0x51,0x51,0x44,0x44,0x41,0x4e,0x68,0x59,0x57,0x45,0x78,0x0a,0x46,0x54,0x41, +0x54,0x42,0x67,0x4e,0x56,0x42,0x41,0x6f,0x4d,0x44,0x4f,0x4f,0x42,0x72,0x2b,0x4f, +0x42,0x71,0x75,0x4f,0x42,0x6a,0x2b,0x4f,0x42,0x6e,0x54,0x45,0x4c,0x4d,0x41,0x6b, +0x47,0x41,0x31,0x55,0x45,0x42,0x68,0x4d,0x43,0x53,0x6c,0x41,0x78,0x45,0x44,0x41, +0x4f,0x42,0x67,0x4e,0x56,0x42,0x41,0x67,0x4d,0x42,0x30,0x6c,0x69,0x0a,0x59,0x58, +0x4a,0x68,0x61,0x32,0x6b,0x78,0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56,0x42,0x41, +0x63,0x4d,0x42,0x31,0x52,0x7a,0x64,0x57,0x74,0x31,0x59,0x6d,0x45,0x77,0x48,0x68, +0x63,0x4e,0x4d,0x54,0x67,0x78,0x4d,0x44,0x45,0x78,0x4d,0x6a,0x4d,0x7a,0x4e,0x54, +0x41,0x78,0x57,0x68,0x63,0x4e,0x4e,0x44,0x49,0x78,0x4d,0x44,0x41,0x31,0x0a,0x4d, +0x6a,0x4d,0x7a,0x4e,0x54,0x41,0x78,0x57,0x6a,0x42,0x57,0x4d,0x51,0x77,0x77,0x43, +0x67,0x59,0x44,0x56,0x51,0x51,0x44,0x44,0x41,0x4e,0x68,0x59,0x57,0x45,0x78,0x46, +0x54,0x41,0x54,0x42,0x67,0x4e,0x56,0x42,0x41,0x6f,0x4d,0x44,0x4f,0x4f,0x42,0x72, +0x2b,0x4f,0x42,0x71,0x75,0x4f,0x42,0x6a,0x2b,0x4f,0x42,0x6e,0x54,0x45,0x4c,0x0a, +0x4d,0x41,0x6b,0x47,0x41,0x31,0x55,0x45,0x42,0x68,0x4d,0x43,0x53,0x6c,0x41,0x78, +0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56,0x42,0x41,0x67,0x4d,0x42,0x30,0x6c,0x69, +0x59,0x58,0x4a,0x68,0x61,0x32,0x6b,0x78,0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56, +0x42,0x41,0x63,0x4d,0x42,0x31,0x52,0x7a,0x64,0x57,0x74,0x31,0x59,0x6d,0x45,0x77, +0x0a,0x67,0x67,0x45,0x69,0x4d,0x41,0x30,0x47,0x43,0x53,0x71,0x47,0x53,0x49,0x62, +0x33,0x44,0x51,0x45,0x42,0x41,0x51,0x55,0x41,0x41,0x34,0x49,0x42,0x44,0x77,0x41, +0x77,0x67,0x67,0x45,0x4b,0x41,0x6f,0x49,0x42,0x41,0x51,0x44,0x58,0x45,0x63,0x76, +0x72,0x59,0x37,0x56,0x2b,0x7a,0x64,0x42,0x79,0x72,0x64,0x4e,0x78,0x4a,0x59,0x45, +0x6d,0x0a,0x61,0x41,0x4e,0x59,0x55,0x4f,0x37,0x76,0x57,0x34,0x68,0x64,0x41,0x35, +0x49,0x42,0x49,0x46,0x6d,0x4d,0x70,0x6e,0x62,0x79,0x69,0x4e,0x6e,0x5a,0x77,0x36, +0x57,0x39,0x6f,0x61,0x67,0x78,0x33,0x5a,0x49,0x65,0x65,0x48,0x56,0x59,0x62,0x52, +0x69,0x4b,0x36,0x41,0x66,0x46,0x74,0x53,0x31,0x32,0x2b,0x45,0x31,0x4d,0x59,0x31, +0x64,0x32,0x0a,0x61,0x71,0x51,0x31,0x53,0x72,0x49,0x43,0x39,0x51,0x35,0x55,0x6e, +0x5a,0x61,0x42,0x72,0x62,0x57,0x32,0x32,0x6d,0x4e,0x75,0x6c,0x4d,0x34,0x2f,0x6c, +0x49,0x4a,0x72,0x48,0x70,0x51,0x55,0x68,0x50,0x78,0x6f,0x62,0x79,0x34,0x2f,0x36, +0x4e,0x41,0x37,0x71,0x4b,0x67,0x55,0x48,0x69,0x79,0x4f,0x64,0x33,0x4a,0x42,0x70, +0x4f,0x66,0x77,0x0a,0x38,0x54,0x76,0x53,0x74,0x51,0x78,0x34,0x4c,0x38,0x59,0x64, +0x4b,0x51,0x35,0x68,0x74,0x7a,0x6b,0x32,0x68,0x70,0x52,0x4a,0x4c,0x30,0x6c,0x4b, +0x67,0x47,0x31,0x57,0x34,0x75,0x4b,0x32,0x39,0x39,0x42,0x74,0x7a,0x64,0x41,0x67, +0x66,0x42,0x76,0x43,0x54,0x33,0x41,0x31,0x61,0x53,0x70,0x6a,0x49,0x47,0x74,0x6e, +0x69,0x72,0x49,0x31,0x0a,0x46,0x4c,0x52,0x58,0x47,0x79,0x38,0x31,0x31,0x57,0x4a, +0x39,0x4a,0x68,0x68,0x34,0x41,0x4b,0x4c,0x66,0x79,0x56,0x70,0x42,0x4a,0x67,0x65, +0x34,0x73,0x56,0x72,0x36,0x4e,0x75,0x75,0x49,0x66,0x32,0x71,0x47,0x31,0x6f,0x79, +0x31,0x30,0x70,0x61,0x51,0x4e,0x65,0x71,0x32,0x33,0x55,0x47,0x61,0x59,0x74,0x2f, +0x7a,0x55,0x56,0x4a,0x77,0x0a,0x55,0x74,0x30,0x57,0x45,0x6b,0x58,0x38,0x48,0x4f, +0x63,0x62,0x33,0x75,0x49,0x6f,0x54,0x6d,0x61,0x4f,0x34,0x72,0x48,0x42,0x55,0x4a, +0x71,0x45,0x79,0x39,0x51,0x58,0x7a,0x53,0x57,0x77,0x43,0x35,0x78,0x45,0x43,0x64, +0x37,0x43,0x4a,0x53,0x53,0x68,0x31,0x30,0x4f,0x75,0x6e,0x6c,0x75,0x4c,0x32,0x4d, +0x47,0x65,0x5a,0x47,0x6e,0x76,0x0a,0x41,0x67,0x4d,0x42,0x41,0x41,0x47,0x6a,0x67, +0x59,0x59,0x77,0x67,0x59,0x4d,0x77,0x44,0x77,0x59,0x44,0x56,0x52,0x30,0x54,0x41, +0x51,0x48,0x2f,0x42,0x41,0x55,0x77,0x41,0x77,0x45,0x42,0x2f,0x7a,0x41,0x4c,0x42, +0x67,0x4e,0x56,0x48,0x51,0x38,0x45,0x42,0x41,0x4d,0x43,0x41,0x66,0x59,0x77,0x59, +0x77,0x59,0x44,0x56,0x52,0x30,0x6c,0x0a,0x42,0x46,0x77,0x77,0x57,0x67,0x59,0x49, +0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48,0x41,0x77,0x45,0x47,0x43,0x43,0x73,0x47, +0x41,0x51,0x55,0x46,0x42,0x77,0x4d,0x43,0x42,0x67,0x67,0x72,0x42,0x67,0x45,0x46, +0x42,0x51,0x63,0x44,0x41,0x77,0x59,0x49,0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48, +0x41,0x77,0x51,0x47,0x43,0x43,0x73,0x47,0x0a,0x41,0x51,0x55,0x46,0x42,0x77,0x4d, +0x46,0x42,0x67,0x67,0x72,0x42,0x67,0x45,0x46,0x42,0x51,0x63,0x44,0x42,0x67,0x59, +0x49,0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48,0x41,0x77,0x63,0x47,0x43,0x43,0x73, +0x47,0x41,0x51,0x55,0x46,0x42,0x77,0x4d,0x49,0x42,0x67,0x67,0x72,0x42,0x67,0x45, +0x46,0x42,0x51,0x63,0x44,0x43,0x54,0x41,0x4e,0x0a,0x42,0x67,0x6b,0x71,0x68,0x6b, +0x69,0x47,0x39,0x77,0x30,0x42,0x41,0x51,0x73,0x46,0x41,0x41,0x4f,0x43,0x41,0x51, +0x45,0x41,0x46,0x6d,0x34,0x37,0x47,0x55,0x70,0x50,0x57,0x35,0x2b,0x37,0x69,0x46, +0x74,0x69,0x6c,0x6f,0x6b,0x35,0x32,0x49,0x6f,0x54,0x57,0x72,0x74,0x46,0x67,0x32, +0x79,0x69,0x36,0x6b,0x49,0x32,0x69,0x52,0x4e,0x51,0x0a,0x4b,0x75,0x67,0x48,0x55, +0x49,0x4f,0x34,0x4b,0x53,0x71,0x4a,0x56,0x42,0x50,0x38,0x61,0x4b,0x4f,0x61,0x54, +0x5a,0x47,0x45,0x31,0x4b,0x4d,0x68,0x2f,0x59,0x6a,0x68,0x36,0x71,0x2f,0x67,0x50, +0x61,0x6c,0x67,0x64,0x2f,0x38,0x44,0x6d,0x72,0x78,0x53,0x4a,0x6d,0x55,0x78,0x33, +0x62,0x4e,0x62,0x38,0x52,0x59,0x36,0x70,0x4b,0x7a,0x74,0x0a,0x5a,0x64,0x75,0x53, +0x61,0x53,0x2b,0x57,0x55,0x30,0x59,0x74,0x2b,0x6c,0x47,0x35,0x76,0x56,0x67,0x61, +0x70,0x48,0x45,0x71,0x36,0x79,0x71,0x4c,0x62,0x65,0x56,0x78,0x51,0x4c,0x75,0x62, +0x54,0x69,0x6e,0x4f,0x66,0x56,0x56,0x5a,0x58,0x79,0x45,0x43,0x59,0x47,0x4d,0x73, +0x59,0x71,0x65,0x6e,0x4a,0x6a,0x4e,0x63,0x62,0x49,0x5a,0x4e,0x0a,0x79,0x4d,0x75, +0x72,0x46,0x63,0x67,0x30,0x34,0x36,0x4f,0x34,0x59,0x79,0x68,0x56,0x79,0x71,0x53, +0x69,0x74,0x43,0x59,0x37,0x68,0x2f,0x65,0x71,0x67,0x6b,0x50,0x4a,0x51,0x30,0x68, +0x6b,0x70,0x39,0x45,0x64,0x51,0x77,0x62,0x6e,0x38,0x56,0x6c,0x66,0x78,0x64,0x42, +0x58,0x77,0x51,0x34,0x4e,0x48,0x4b,0x30,0x4a,0x56,0x46,0x2f,0x33,0x0a,0x71,0x48, +0x61,0x68,0x4e,0x48,0x4f,0x35,0x64,0x62,0x4a,0x5a,0x57,0x59,0x41,0x62,0x42,0x44, +0x70,0x32,0x51,0x45,0x53,0x70,0x76,0x6f,0x2b,0x38,0x33,0x6c,0x68,0x34,0x64,0x6e, +0x58,0x6a,0x46,0x58,0x4d,0x43,0x48,0x76,0x52,0x68,0x35,0x31,0x79,0x2f,0x54,0x71, +0x79,0x42,0x34,0x56,0x76,0x72,0x52,0x4b,0x49,0x4b,0x74,0x54,0x6f,0x7a,0x0a,0x5a, +0x6a,0x48,0x59,0x49,0x63,0x62,0x6a,0x76,0x53,0x58,0x4d,0x7a,0x61,0x44,0x50,0x6a, +0x50,0x63,0x5a,0x47,0x6a,0x42,0x4a,0x6c,0x47,0x36,0x43,0x76,0x44,0x34,0x4c,0x6d, +0x59,0x7a,0x72,0x6b,0x48,0x34,0x31,0x63,0x7a,0x72,0x34,0x57,0x41,0x3d,0x3d,0x0a, +0x2d,0x2d,0x2d,0x2d,0x2d,0x45,0x4e,0x44,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49, +0x43,0x41,0x54,0x45,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a + }, + Key_bin = new byte[] + { +0x2d,0x2d,0x2d,0x2d,0x2d,0x42,0x45,0x47,0x49,0x4e,0x20,0x50,0x52,0x49,0x56,0x41, +0x54,0x45,0x20,0x4b,0x45,0x59,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a,0x4d,0x49,0x49,0x45, +0x76,0x67,0x49,0x42,0x41,0x44,0x41,0x4e,0x42,0x67,0x6b,0x71,0x68,0x6b,0x69,0x47, +0x39,0x77,0x30,0x42,0x41,0x51,0x45,0x46,0x41,0x41,0x53,0x43,0x42,0x4b,0x67,0x77, +0x67,0x67,0x53,0x6b,0x41,0x67,0x45,0x41,0x41,0x6f,0x49,0x42,0x41,0x51,0x44,0x58, +0x45,0x63,0x76,0x72,0x59,0x37,0x56,0x2b,0x7a,0x64,0x42,0x79,0x0a,0x72,0x64,0x4e, +0x78,0x4a,0x59,0x45,0x6d,0x61,0x41,0x4e,0x59,0x55,0x4f,0x37,0x76,0x57,0x34,0x68, +0x64,0x41,0x35,0x49,0x42,0x49,0x46,0x6d,0x4d,0x70,0x6e,0x62,0x79,0x69,0x4e,0x6e, +0x5a,0x77,0x36,0x57,0x39,0x6f,0x61,0x67,0x78,0x33,0x5a,0x49,0x65,0x65,0x48,0x56, +0x59,0x62,0x52,0x69,0x4b,0x36,0x41,0x66,0x46,0x74,0x53,0x31,0x32,0x0a,0x2b,0x45, +0x31,0x4d,0x59,0x31,0x64,0x32,0x61,0x71,0x51,0x31,0x53,0x72,0x49,0x43,0x39,0x51, +0x35,0x55,0x6e,0x5a,0x61,0x42,0x72,0x62,0x57,0x32,0x32,0x6d,0x4e,0x75,0x6c,0x4d, +0x34,0x2f,0x6c,0x49,0x4a,0x72,0x48,0x70,0x51,0x55,0x68,0x50,0x78,0x6f,0x62,0x79, +0x34,0x2f,0x36,0x4e,0x41,0x37,0x71,0x4b,0x67,0x55,0x48,0x69,0x79,0x4f,0x0a,0x64, +0x33,0x4a,0x42,0x70,0x4f,0x66,0x77,0x38,0x54,0x76,0x53,0x74,0x51,0x78,0x34,0x4c, +0x38,0x59,0x64,0x4b,0x51,0x35,0x68,0x74,0x7a,0x6b,0x32,0x68,0x70,0x52,0x4a,0x4c, +0x30,0x6c,0x4b,0x67,0x47,0x31,0x57,0x34,0x75,0x4b,0x32,0x39,0x39,0x42,0x74,0x7a, +0x64,0x41,0x67,0x66,0x42,0x76,0x43,0x54,0x33,0x41,0x31,0x61,0x53,0x70,0x6a,0x0a, +0x49,0x47,0x74,0x6e,0x69,0x72,0x49,0x31,0x46,0x4c,0x52,0x58,0x47,0x79,0x38,0x31, +0x31,0x57,0x4a,0x39,0x4a,0x68,0x68,0x34,0x41,0x4b,0x4c,0x66,0x79,0x56,0x70,0x42, +0x4a,0x67,0x65,0x34,0x73,0x56,0x72,0x36,0x4e,0x75,0x75,0x49,0x66,0x32,0x71,0x47, +0x31,0x6f,0x79,0x31,0x30,0x70,0x61,0x51,0x4e,0x65,0x71,0x32,0x33,0x55,0x47,0x61, +0x0a,0x59,0x74,0x2f,0x7a,0x55,0x56,0x4a,0x77,0x55,0x74,0x30,0x57,0x45,0x6b,0x58, +0x38,0x48,0x4f,0x63,0x62,0x33,0x75,0x49,0x6f,0x54,0x6d,0x61,0x4f,0x34,0x72,0x48, +0x42,0x55,0x4a,0x71,0x45,0x79,0x39,0x51,0x58,0x7a,0x53,0x57,0x77,0x43,0x35,0x78, +0x45,0x43,0x64,0x37,0x43,0x4a,0x53,0x53,0x68,0x31,0x30,0x4f,0x75,0x6e,0x6c,0x75, +0x4c,0x0a,0x32,0x4d,0x47,0x65,0x5a,0x47,0x6e,0x76,0x41,0x67,0x4d,0x42,0x41,0x41, +0x45,0x43,0x67,0x67,0x45,0x41,0x54,0x77,0x34,0x52,0x6f,0x52,0x4c,0x6a,0x73,0x68, +0x72,0x42,0x56,0x6f,0x59,0x69,0x78,0x4f,0x4a,0x2b,0x57,0x4c,0x6d,0x2f,0x45,0x51, +0x57,0x65,0x37,0x6f,0x6a,0x38,0x31,0x51,0x50,0x73,0x39,0x56,0x45,0x49,0x32,0x62, +0x53,0x4f,0x0a,0x34,0x4a,0x51,0x42,0x55,0x42,0x53,0x6b,0x70,0x64,0x48,0x34,0x57, +0x32,0x77,0x51,0x75,0x2f,0x61,0x58,0x57,0x38,0x75,0x75,0x53,0x39,0x45,0x43,0x6d, +0x6d,0x41,0x41,0x75,0x45,0x79,0x4a,0x54,0x56,0x7a,0x75,0x31,0x32,0x35,0x58,0x73, +0x65,0x63,0x6c,0x44,0x41,0x55,0x38,0x49,0x55,0x70,0x54,0x2b,0x70,0x4c,0x35,0x79, +0x70,0x37,0x34,0x0a,0x45,0x62,0x76,0x4e,0x48,0x48,0x33,0x67,0x65,0x72,0x4f,0x67, +0x78,0x76,0x49,0x6a,0x50,0x64,0x67,0x77,0x62,0x66,0x6d,0x4d,0x49,0x59,0x48,0x62, +0x56,0x70,0x6e,0x49,0x30,0x77,0x32,0x42,0x43,0x44,0x51,0x76,0x74,0x64,0x64,0x57, +0x6f,0x42,0x74,0x41,0x33,0x43,0x54,0x6a,0x63,0x2f,0x43,0x56,0x67,0x73,0x47,0x77, +0x33,0x43,0x4e,0x72,0x0a,0x46,0x78,0x41,0x46,0x35,0x73,0x4a,0x34,0x63,0x5a,0x4c, +0x6e,0x5a,0x31,0x45,0x36,0x69,0x74,0x4c,0x54,0x50,0x69,0x6f,0x6a,0x74,0x76,0x48, +0x48,0x34,0x61,0x64,0x6d,0x68,0x68,0x43,0x61,0x42,0x49,0x78,0x76,0x47,0x2f,0x53, +0x6e,0x59,0x77,0x4e,0x35,0x38,0x37,0x55,0x5a,0x6d,0x37,0x4c,0x57,0x50,0x61,0x67, +0x4c,0x41,0x33,0x67,0x69,0x0a,0x48,0x4b,0x4f,0x2b,0x4b,0x79,0x42,0x51,0x39,0x33, +0x31,0x4e,0x4d,0x61,0x65,0x6a,0x36,0x6d,0x75,0x75,0x46,0x32,0x30,0x32,0x76,0x34, +0x37,0x6c,0x57,0x6b,0x64,0x50,0x4f,0x6e,0x52,0x43,0x69,0x6f,0x4d,0x58,0x30,0x63, +0x31,0x6a,0x36,0x76,0x32,0x61,0x59,0x34,0x34,0x77,0x55,0x4b,0x71,0x39,0x4d,0x52, +0x67,0x6f,0x52,0x76,0x4a,0x37,0x0a,0x41,0x39,0x77,0x65,0x72,0x4c,0x6b,0x68,0x35, +0x78,0x78,0x35,0x35,0x32,0x4f,0x74,0x71,0x50,0x36,0x73,0x61,0x6d,0x75,0x47,0x44, +0x52,0x78,0x31,0x42,0x70,0x36,0x53,0x4f,0x70,0x68,0x43,0x45,0x50,0x48,0x59,0x67, +0x51,0x4b,0x42,0x67,0x51,0x44,0x36,0x33,0x65,0x2b,0x52,0x75,0x6c,0x36,0x46,0x78, +0x47,0x43,0x76,0x67,0x70,0x6b,0x33,0x0a,0x57,0x67,0x2f,0x54,0x31,0x77,0x2f,0x59, +0x4b,0x6b,0x79,0x4f,0x49,0x46,0x4c,0x63,0x46,0x4c,0x57,0x71,0x42,0x44,0x71,0x6c, +0x6e,0x58,0x65,0x63,0x6c,0x6b,0x50,0x4b,0x6a,0x57,0x4e,0x2f,0x32,0x70,0x4a,0x6d, +0x4f,0x31,0x63,0x46,0x63,0x44,0x4a,0x46,0x59,0x64,0x32,0x45,0x49,0x45,0x72,0x76, +0x42,0x57,0x54,0x34,0x51,0x39,0x4d,0x42,0x0a,0x4e,0x35,0x6c,0x44,0x6b,0x47,0x75, +0x6a,0x34,0x2f,0x6b,0x68,0x56,0x6c,0x79,0x6e,0x77,0x62,0x64,0x42,0x6e,0x47,0x43, +0x34,0x61,0x34,0x48,0x4a,0x49,0x4a,0x76,0x61,0x35,0x63,0x70,0x49,0x63,0x57,0x65, +0x4a,0x72,0x35,0x61,0x57,0x33,0x69,0x44,0x36,0x68,0x53,0x73,0x61,0x6c,0x79,0x55, +0x76,0x4a,0x4d,0x6d,0x64,0x4d,0x42,0x6e,0x47,0x0a,0x37,0x2b,0x50,0x65,0x53,0x2b, +0x4e,0x73,0x4b,0x30,0x61,0x63,0x31,0x67,0x33,0x4d,0x6c,0x56,0x35,0x42,0x41,0x32, +0x70,0x55,0x54,0x77,0x4b,0x42,0x67,0x51,0x44,0x62,0x65,0x46,0x6d,0x2b,0x46,0x46, +0x35,0x62,0x76,0x6f,0x4b,0x7a,0x49,0x4c,0x6c,0x31,0x62,0x79,0x6b,0x6c,0x52,0x6b, +0x69,0x76,0x7a,0x6b,0x62,0x7a,0x49,0x6b,0x41,0x78,0x0a,0x35,0x56,0x6b,0x74,0x67, +0x36,0x4a,0x35,0x63,0x76,0x38,0x44,0x35,0x2b,0x72,0x71,0x50,0x75,0x6a,0x4f,0x66, +0x39,0x67,0x42,0x6a,0x4e,0x37,0x70,0x64,0x78,0x39,0x39,0x35,0x6b,0x47,0x49,0x78, +0x5a,0x39,0x6d,0x31,0x68,0x57,0x69,0x78,0x55,0x55,0x31,0x55,0x6f,0x38,0x72,0x70, +0x39,0x4a,0x69,0x47,0x4f,0x36,0x72,0x65,0x31,0x77,0x69,0x0a,0x6a,0x56,0x2f,0x4c, +0x31,0x64,0x37,0x55,0x66,0x39,0x48,0x6a,0x65,0x61,0x70,0x4f,0x46,0x62,0x34,0x6b, +0x72,0x71,0x52,0x58,0x54,0x65,0x75,0x4d,0x6e,0x35,0x35,0x44,0x33,0x64,0x70,0x79, +0x6a,0x51,0x4e,0x43,0x30,0x5a,0x50,0x72,0x61,0x6d,0x58,0x64,0x38,0x31,0x57,0x6f, +0x6f,0x56,0x77,0x58,0x59,0x41,0x66,0x69,0x46,0x76,0x4c,0x49,0x0a,0x6f,0x66,0x31, +0x37,0x51,0x67,0x67,0x49,0x59,0x51,0x4b,0x42,0x67,0x51,0x44,0x59,0x55,0x67,0x67, +0x43,0x34,0x58,0x49,0x67,0x5a,0x76,0x58,0x34,0x59,0x65,0x55,0x38,0x6c,0x61,0x79, +0x51,0x50,0x79,0x4b,0x71,0x67,0x38,0x37,0x2f,0x76,0x31,0x2b,0x7a,0x35,0x79,0x65, +0x2f,0x4d,0x32,0x5a,0x65,0x36,0x53,0x6e,0x37,0x48,0x4a,0x66,0x59,0x0a,0x55,0x5a, +0x4d,0x36,0x37,0x48,0x37,0x52,0x4b,0x4e,0x6f,0x68,0x46,0x6c,0x35,0x43,0x39,0x65, +0x44,0x4e,0x7a,0x67,0x72,0x50,0x6b,0x52,0x63,0x2f,0x2f,0x54,0x77,0x32,0x45,0x48, +0x74,0x59,0x68,0x33,0x42,0x4b,0x49,0x6f,0x72,0x77,0x39,0x45,0x64,0x78,0x59,0x4e, +0x6c,0x6b,0x2b,0x6a,0x4e,0x73,0x30,0x30,0x64,0x57,0x35,0x34,0x64,0x39,0x0a,0x65, +0x69,0x69,0x7a,0x7a,0x78,0x59,0x34,0x34,0x2f,0x41,0x32,0x70,0x39,0x52,0x49,0x4d, +0x67,0x79,0x35,0x49,0x52,0x77,0x76,0x53,0x73,0x6d,0x50,0x67,0x61,0x71,0x34,0x6f, +0x4b,0x4d,0x64,0x54,0x4e,0x4d,0x4f,0x73,0x30,0x4a,0x77,0x65,0x79,0x50,0x72,0x42, +0x65,0x49,0x41,0x72,0x62,0x46,0x43,0x67,0x51,0x4b,0x42,0x67,0x51,0x43,0x71,0x0a, +0x57,0x30,0x34,0x56,0x33,0x49,0x75,0x74,0x33,0x55,0x42,0x6f,0x75,0x50,0x4d,0x63, +0x63,0x38,0x2f,0x56,0x62,0x69,0x77,0x48,0x77,0x79,0x2b,0x52,0x6c,0x4c,0x6d,0x4e, +0x77,0x59,0x41,0x71,0x63,0x79,0x35,0x50,0x35,0x58,0x4b,0x4c,0x33,0x70,0x36,0x62, +0x65,0x33,0x2b,0x4d,0x6f,0x76,0x48,0x52,0x71,0x6a,0x35,0x78,0x72,0x4a,0x54,0x57, +0x0a,0x54,0x6a,0x2f,0x36,0x59,0x61,0x51,0x73,0x31,0x2b,0x72,0x74,0x63,0x51,0x45, +0x61,0x74,0x64,0x34,0x4b,0x50,0x66,0x64,0x78,0x53,0x2f,0x63,0x66,0x52,0x74,0x38, +0x71,0x74,0x75,0x42,0x77,0x51,0x61,0x2f,0x34,0x39,0x4d,0x72,0x41,0x4c,0x76,0x57, +0x43,0x4c,0x53,0x42,0x75,0x4b,0x74,0x33,0x49,0x49,0x75,0x53,0x2f,0x51,0x44,0x74, +0x43,0x0a,0x5a,0x4e,0x67,0x6d,0x36,0x4d,0x78,0x71,0x4e,0x6e,0x49,0x43,0x58,0x35, +0x46,0x34,0x36,0x6d,0x52,0x49,0x52,0x42,0x42,0x4f,0x32,0x4b,0x7a,0x6c,0x30,0x33, +0x68,0x62,0x51,0x6c,0x71,0x58,0x4c,0x5a,0x63,0x38,0x6f,0x51,0x4b,0x42,0x67,0x43, +0x53,0x77,0x66,0x46,0x7a,0x68,0x48,0x76,0x78,0x36,0x68,0x69,0x64,0x57,0x67,0x48, +0x4a,0x63,0x0a,0x77,0x79,0x76,0x64,0x6e,0x70,0x58,0x78,0x36,0x5a,0x4c,0x6e,0x6f, +0x61,0x7a,0x61,0x6f,0x48,0x47,0x74,0x4d,0x47,0x43,0x45,0x5a,0x49,0x50,0x66,0x6a, +0x4c,0x42,0x63,0x30,0x4d,0x74,0x79,0x45,0x64,0x53,0x4c,0x78,0x54,0x6c,0x35,0x59, +0x70,0x78,0x6f,0x6d,0x43,0x46,0x55,0x4d,0x33,0x55,0x63,0x59,0x4e,0x2f,0x50,0x5a, +0x66,0x58,0x41,0x0a,0x6d,0x36,0x31,0x45,0x6d,0x71,0x53,0x53,0x4d,0x56,0x63,0x47, +0x50,0x67,0x65,0x2f,0x43,0x34,0x44,0x42,0x5a,0x59,0x6a,0x53,0x45,0x71,0x62,0x67, +0x37,0x6d,0x73,0x52,0x30,0x33,0x37,0x42,0x58,0x54,0x48,0x6b,0x78,0x44,0x62,0x33, +0x71,0x48,0x46,0x54,0x6f,0x30,0x6b,0x48,0x57,0x4a,0x66,0x34,0x39,0x59,0x77,0x32, +0x73,0x77,0x6a,0x54,0x0a,0x72,0x4f,0x38,0x46,0x46,0x44,0x52,0x56,0x50,0x44,0x4c, +0x5a,0x61,0x37,0x36,0x47,0x67,0x79,0x41,0x55,0x4a,0x38,0x55,0x63,0x0a,0x2d,0x2d, +0x2d,0x2d,0x2d,0x45,0x4e,0x44,0x20,0x50,0x52,0x49,0x56,0x41,0x54,0x45,0x20,0x4b, +0x45,0x59,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a + }, + }; + + VpnRpcKeyPair out_rpc_key_pair = api.SetServerCert(in_rpc_key_pair); + + print_object(out_rpc_key_pair); + + Console.WriteLine("End: Test_SetServerCert"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetServerCert', Get the server certification + /// + public void Test_GetServerCert() + { + Console.WriteLine("Begin: Test_GetServerCert"); + + VpnRpcKeyPair out_rpc_key_pair = api.GetServerCert(); + + print_object(out_rpc_key_pair); + + Console.WriteLine("End: Test_GetServerCert"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetServerCipher', Get cipher for SSL + /// + public void Test_GetServerCipher() + { + Console.WriteLine("Begin: Test_GetServerCipher"); + + VpnRpcStr out_rpc_str = api.GetServerCipher(); + + print_object(out_rpc_str); + + Console.WriteLine("End: Test_GetServerCipher"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetServerCipher', Set cipher for SSL to the server + /// + public void Test_SetServerCipher() + { + Console.WriteLine("Begin: Test_SetServerCipher"); + + VpnRpcStr in_rpc_str = new VpnRpcStr() { String_str = "RC4-MD5" }; + VpnRpcStr out_rpc_str = api.SetServerCipher(in_rpc_str); + + print_object(out_rpc_str); + + Console.WriteLine("End: Test_SetServerCipher"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'CreateHub', Create a hub + /// + public string Test_CreateHub() + { + string hub_name = "Test_" + rand.Next(100000, 999999); + Console.WriteLine("Begin: Test_CreateHub"); + + VpnRpcCreateHub in_rpc_create_hub = new VpnRpcCreateHub() + { + HubName_str = hub_name, + HubType_u32 = VpnRpcHubType.Standalone, + Online_bool = true, + AdminPasswordPlainText_str = "microsoft", + MaxSession_u32 = 123, + NoEnum_bool = false, + }; + + VpnRpcCreateHub out_rpc_create_hub = api.CreateHub(in_rpc_create_hub); + + print_object(out_rpc_create_hub); + + Console.WriteLine("End: Test_CreateHub"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return hub_name; + } + + /// + /// API test for 'SetHub', Set hub configuration + /// + public void Test_SetHub() + { + Console.WriteLine("Begin: Test_SetHub"); + + VpnRpcCreateHub in_rpc_create_hub = new VpnRpcCreateHub() + { + HubName_str = hub_name, + AdminPasswordPlainText_str = "aho", + HubType_u32 = VpnRpcHubType.Standalone, + NoEnum_bool = false, + MaxSession_u32 = 128, + Online_bool = true, + }; + + VpnRpcCreateHub out_rpc_create_hub = api.SetHub(in_rpc_create_hub); + + print_object(out_rpc_create_hub); + + Console.WriteLine("End: Test_SetHub"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHub', Get hub configuration + /// + public void Test_GetHub() + { + Console.WriteLine("Begin: Test_GetHub"); + + VpnRpcCreateHub in_rpc_create_hub = new VpnRpcCreateHub() + { + HubName_str = hub_name, + }; + + VpnRpcCreateHub out_rpc_create_hub = api.GetHub(in_rpc_create_hub); + + print_object(out_rpc_create_hub); + + Console.WriteLine("End: Test_GetHub"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumHub', Enumerate hubs + /// + public void Test_EnumHub() + { + Console.WriteLine("Begin: Test_EnumHub"); + + VpnRpcEnumHub out_rpc_enum_hub = api.EnumHub(); + + print_object(out_rpc_enum_hub); + + Console.WriteLine("End: Test_EnumHub"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteHub', Delete a hub + /// + public void Test_DeleteHub() + { + Console.WriteLine("Begin: Test_DeleteHub"); + + VpnRpcDeleteHub in_rpc_delete_hub = new VpnRpcDeleteHub() + { + HubName_str = hub_name, + }; + VpnRpcDeleteHub out_rpc_delete_hub = api.DeleteHub(in_rpc_delete_hub); + + print_object(out_rpc_delete_hub); + + Console.WriteLine("End: Test_DeleteHub"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubRadius', Get Radius options of the hub + /// + public void Test_GetHubRadius() + { + Console.WriteLine("Begin: Test_GetHubRadius"); + + VpnRpcRadius in_rpc_radius = new VpnRpcRadius() + { + HubName_str = hub_name, + }; + VpnRpcRadius out_rpc_radius = api.GetHubRadius(in_rpc_radius); + + print_object(out_rpc_radius); + + Console.WriteLine("End: Test_GetHubRadius"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubRadius', Set Radius options of the hub + /// + public void Test_SetHubRadius() + { + Console.WriteLine("Begin: Test_SetHubRadius"); + + VpnRpcRadius in_rpc_radius = new VpnRpcRadius() + { + HubName_str = hub_name, + RadiusServerName_str = "1.2.3.4", + RadiusPort_u32 = 1234, + RadiusSecret_str = "microsoft", + RadiusRetryInterval_u32 = 1000, + }; + VpnRpcRadius out_rpc_radius = api.SetHubRadius(in_rpc_radius); + + print_object(out_rpc_radius); + + Console.WriteLine("End: Test_SetHubRadius"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumConnection', Enumerate connections + /// + public VpnRpcEnumConnection Test_EnumConnection() + { + Console.WriteLine("Begin: Test_EnumConnection"); + + VpnRpcEnumConnection out_rpc_enum_connection = api.EnumConnection(); + + print_object(out_rpc_enum_connection); + + Console.WriteLine("End: Test_EnumConnection"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_connection; + } + + /// + /// API test for 'DisconnectConnection', Disconnect a connection + /// + public void Test_DisconnectConnection(string connection_id) + { + Console.WriteLine("Begin: Test_DisconnectConnection"); + + VpnRpcDisconnectConnection in_rpc_disconnect_connection = new VpnRpcDisconnectConnection() + { + Name_str = connection_id, + }; + VpnRpcDisconnectConnection out_rpc_disconnect_connection = api.DisconnectConnection(in_rpc_disconnect_connection); + + print_object(out_rpc_disconnect_connection); + + Console.WriteLine("End: Test_DisconnectConnection"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetConnectionInfo', Get connection information + /// + public void Test_GetConnectionInfo(string name) + { + Console.WriteLine("Begin: Test_GetConnectionInfo"); + + VpnRpcConnectionInfo in_rpc_connection_info = new VpnRpcConnectionInfo() + { + Name_str = name, + }; + VpnRpcConnectionInfo out_rpc_connection_info = api.GetConnectionInfo(in_rpc_connection_info); + + print_object(out_rpc_connection_info); + + Console.WriteLine("End: Test_GetConnectionInfo"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubOnline', Make a hub on-line or off-line + /// + public void Test_SetHubOnline() + { + Console.WriteLine("Begin: Test_SetHubOnline"); + + VpnRpcSetHubOnline in_rpc_set_hub_online = new VpnRpcSetHubOnline() + { + HubName_str = hub_name, + Online_bool = true, + }; + VpnRpcSetHubOnline out_rpc_set_hub_online = api.SetHubOnline(in_rpc_set_hub_online); + + print_object(out_rpc_set_hub_online); + + Console.WriteLine("End: Test_SetHubOnline"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubStatus', Get hub status + /// + public void Test_GetHubStatus() + { + Console.WriteLine("Begin: Test_GetHubStatus"); + + VpnRpcHubStatus in_rpc_hub_status = new VpnRpcHubStatus() + { + HubName_str = hub_name, + }; + VpnRpcHubStatus out_rpc_hub_status = api.GetHubStatus(in_rpc_hub_status); + + print_object(out_rpc_hub_status); + + Console.WriteLine("End: Test_GetHubStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubLog', Set logging configuration into the hub + /// + public void Test_SetHubLog(VpnRpcHubLog in_rpc_hub_log) + { + Console.WriteLine("Begin: Test_SetHubLog"); + + VpnRpcHubLog out_rpc_hub_log = api.SetHubLog(in_rpc_hub_log); + + print_object(out_rpc_hub_log); + + Console.WriteLine("End: Test_SetHubLog"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubLog', Get logging configuration of the hub + /// + public VpnRpcHubLog Test_GetHubLog() + { + Console.WriteLine("Begin: Test_GetHubLog"); + + VpnRpcHubLog in_rpc_hub_log = new VpnRpcHubLog() + { + HubName_str = hub_name, + }; + VpnRpcHubLog out_rpc_hub_log = api.GetHubLog(in_rpc_hub_log); + + print_object(out_rpc_hub_log); + + Console.WriteLine("End: Test_GetHubLog"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_hub_log; + } + + /// + /// API test for 'AddCa', Add CA(Certificate Authority) into the hub + /// + public void Test_AddCa() + { + Console.WriteLine("Begin: Test_AddCa"); + + VpnRpcHubAddCA in_rpc_hub_add_ca = new VpnRpcHubAddCA() + { + HubName_str = hub_name, + Cert_bin = new byte[] + { +0x2d,0x2d,0x2d,0x2d,0x2d,0x42,0x45,0x47,0x49,0x4e,0x20,0x43,0x45,0x52,0x54,0x49, +0x46,0x49,0x43,0x41,0x54,0x45,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a,0x4d,0x49,0x49,0x44, +0x72,0x6a,0x43,0x43,0x41,0x70,0x61,0x67,0x41,0x77,0x49,0x42,0x41,0x67,0x49,0x42, +0x41,0x44,0x41,0x4e,0x42,0x67,0x6b,0x71,0x68,0x6b,0x69,0x47,0x39,0x77,0x30,0x42, +0x41,0x51,0x73,0x46,0x41,0x44,0x42,0x57,0x4d,0x51,0x77,0x77,0x43,0x67,0x59,0x44, +0x56,0x51,0x51,0x44,0x44,0x41,0x4e,0x68,0x59,0x57,0x45,0x78,0x0a,0x46,0x54,0x41, +0x54,0x42,0x67,0x4e,0x56,0x42,0x41,0x6f,0x4d,0x44,0x4f,0x4f,0x42,0x72,0x2b,0x4f, +0x42,0x71,0x75,0x4f,0x42,0x6a,0x2b,0x4f,0x42,0x6e,0x54,0x45,0x4c,0x4d,0x41,0x6b, +0x47,0x41,0x31,0x55,0x45,0x42,0x68,0x4d,0x43,0x53,0x6c,0x41,0x78,0x45,0x44,0x41, +0x4f,0x42,0x67,0x4e,0x56,0x42,0x41,0x67,0x4d,0x42,0x30,0x6c,0x69,0x0a,0x59,0x58, +0x4a,0x68,0x61,0x32,0x6b,0x78,0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56,0x42,0x41, +0x63,0x4d,0x42,0x31,0x52,0x7a,0x64,0x57,0x74,0x31,0x59,0x6d,0x45,0x77,0x48,0x68, +0x63,0x4e,0x4d,0x54,0x67,0x78,0x4d,0x44,0x45,0x78,0x4d,0x6a,0x4d,0x7a,0x4e,0x54, +0x41,0x78,0x57,0x68,0x63,0x4e,0x4e,0x44,0x49,0x78,0x4d,0x44,0x41,0x31,0x0a,0x4d, +0x6a,0x4d,0x7a,0x4e,0x54,0x41,0x78,0x57,0x6a,0x42,0x57,0x4d,0x51,0x77,0x77,0x43, +0x67,0x59,0x44,0x56,0x51,0x51,0x44,0x44,0x41,0x4e,0x68,0x59,0x57,0x45,0x78,0x46, +0x54,0x41,0x54,0x42,0x67,0x4e,0x56,0x42,0x41,0x6f,0x4d,0x44,0x4f,0x4f,0x42,0x72, +0x2b,0x4f,0x42,0x71,0x75,0x4f,0x42,0x6a,0x2b,0x4f,0x42,0x6e,0x54,0x45,0x4c,0x0a, +0x4d,0x41,0x6b,0x47,0x41,0x31,0x55,0x45,0x42,0x68,0x4d,0x43,0x53,0x6c,0x41,0x78, +0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56,0x42,0x41,0x67,0x4d,0x42,0x30,0x6c,0x69, +0x59,0x58,0x4a,0x68,0x61,0x32,0x6b,0x78,0x45,0x44,0x41,0x4f,0x42,0x67,0x4e,0x56, +0x42,0x41,0x63,0x4d,0x42,0x31,0x52,0x7a,0x64,0x57,0x74,0x31,0x59,0x6d,0x45,0x77, +0x0a,0x67,0x67,0x45,0x69,0x4d,0x41,0x30,0x47,0x43,0x53,0x71,0x47,0x53,0x49,0x62, +0x33,0x44,0x51,0x45,0x42,0x41,0x51,0x55,0x41,0x41,0x34,0x49,0x42,0x44,0x77,0x41, +0x77,0x67,0x67,0x45,0x4b,0x41,0x6f,0x49,0x42,0x41,0x51,0x44,0x58,0x45,0x63,0x76, +0x72,0x59,0x37,0x56,0x2b,0x7a,0x64,0x42,0x79,0x72,0x64,0x4e,0x78,0x4a,0x59,0x45, +0x6d,0x0a,0x61,0x41,0x4e,0x59,0x55,0x4f,0x37,0x76,0x57,0x34,0x68,0x64,0x41,0x35, +0x49,0x42,0x49,0x46,0x6d,0x4d,0x70,0x6e,0x62,0x79,0x69,0x4e,0x6e,0x5a,0x77,0x36, +0x57,0x39,0x6f,0x61,0x67,0x78,0x33,0x5a,0x49,0x65,0x65,0x48,0x56,0x59,0x62,0x52, +0x69,0x4b,0x36,0x41,0x66,0x46,0x74,0x53,0x31,0x32,0x2b,0x45,0x31,0x4d,0x59,0x31, +0x64,0x32,0x0a,0x61,0x71,0x51,0x31,0x53,0x72,0x49,0x43,0x39,0x51,0x35,0x55,0x6e, +0x5a,0x61,0x42,0x72,0x62,0x57,0x32,0x32,0x6d,0x4e,0x75,0x6c,0x4d,0x34,0x2f,0x6c, +0x49,0x4a,0x72,0x48,0x70,0x51,0x55,0x68,0x50,0x78,0x6f,0x62,0x79,0x34,0x2f,0x36, +0x4e,0x41,0x37,0x71,0x4b,0x67,0x55,0x48,0x69,0x79,0x4f,0x64,0x33,0x4a,0x42,0x70, +0x4f,0x66,0x77,0x0a,0x38,0x54,0x76,0x53,0x74,0x51,0x78,0x34,0x4c,0x38,0x59,0x64, +0x4b,0x51,0x35,0x68,0x74,0x7a,0x6b,0x32,0x68,0x70,0x52,0x4a,0x4c,0x30,0x6c,0x4b, +0x67,0x47,0x31,0x57,0x34,0x75,0x4b,0x32,0x39,0x39,0x42,0x74,0x7a,0x64,0x41,0x67, +0x66,0x42,0x76,0x43,0x54,0x33,0x41,0x31,0x61,0x53,0x70,0x6a,0x49,0x47,0x74,0x6e, +0x69,0x72,0x49,0x31,0x0a,0x46,0x4c,0x52,0x58,0x47,0x79,0x38,0x31,0x31,0x57,0x4a, +0x39,0x4a,0x68,0x68,0x34,0x41,0x4b,0x4c,0x66,0x79,0x56,0x70,0x42,0x4a,0x67,0x65, +0x34,0x73,0x56,0x72,0x36,0x4e,0x75,0x75,0x49,0x66,0x32,0x71,0x47,0x31,0x6f,0x79, +0x31,0x30,0x70,0x61,0x51,0x4e,0x65,0x71,0x32,0x33,0x55,0x47,0x61,0x59,0x74,0x2f, +0x7a,0x55,0x56,0x4a,0x77,0x0a,0x55,0x74,0x30,0x57,0x45,0x6b,0x58,0x38,0x48,0x4f, +0x63,0x62,0x33,0x75,0x49,0x6f,0x54,0x6d,0x61,0x4f,0x34,0x72,0x48,0x42,0x55,0x4a, +0x71,0x45,0x79,0x39,0x51,0x58,0x7a,0x53,0x57,0x77,0x43,0x35,0x78,0x45,0x43,0x64, +0x37,0x43,0x4a,0x53,0x53,0x68,0x31,0x30,0x4f,0x75,0x6e,0x6c,0x75,0x4c,0x32,0x4d, +0x47,0x65,0x5a,0x47,0x6e,0x76,0x0a,0x41,0x67,0x4d,0x42,0x41,0x41,0x47,0x6a,0x67, +0x59,0x59,0x77,0x67,0x59,0x4d,0x77,0x44,0x77,0x59,0x44,0x56,0x52,0x30,0x54,0x41, +0x51,0x48,0x2f,0x42,0x41,0x55,0x77,0x41,0x77,0x45,0x42,0x2f,0x7a,0x41,0x4c,0x42, +0x67,0x4e,0x56,0x48,0x51,0x38,0x45,0x42,0x41,0x4d,0x43,0x41,0x66,0x59,0x77,0x59, +0x77,0x59,0x44,0x56,0x52,0x30,0x6c,0x0a,0x42,0x46,0x77,0x77,0x57,0x67,0x59,0x49, +0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48,0x41,0x77,0x45,0x47,0x43,0x43,0x73,0x47, +0x41,0x51,0x55,0x46,0x42,0x77,0x4d,0x43,0x42,0x67,0x67,0x72,0x42,0x67,0x45,0x46, +0x42,0x51,0x63,0x44,0x41,0x77,0x59,0x49,0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48, +0x41,0x77,0x51,0x47,0x43,0x43,0x73,0x47,0x0a,0x41,0x51,0x55,0x46,0x42,0x77,0x4d, +0x46,0x42,0x67,0x67,0x72,0x42,0x67,0x45,0x46,0x42,0x51,0x63,0x44,0x42,0x67,0x59, +0x49,0x4b,0x77,0x59,0x42,0x42,0x51,0x55,0x48,0x41,0x77,0x63,0x47,0x43,0x43,0x73, +0x47,0x41,0x51,0x55,0x46,0x42,0x77,0x4d,0x49,0x42,0x67,0x67,0x72,0x42,0x67,0x45, +0x46,0x42,0x51,0x63,0x44,0x43,0x54,0x41,0x4e,0x0a,0x42,0x67,0x6b,0x71,0x68,0x6b, +0x69,0x47,0x39,0x77,0x30,0x42,0x41,0x51,0x73,0x46,0x41,0x41,0x4f,0x43,0x41,0x51, +0x45,0x41,0x46,0x6d,0x34,0x37,0x47,0x55,0x70,0x50,0x57,0x35,0x2b,0x37,0x69,0x46, +0x74,0x69,0x6c,0x6f,0x6b,0x35,0x32,0x49,0x6f,0x54,0x57,0x72,0x74,0x46,0x67,0x32, +0x79,0x69,0x36,0x6b,0x49,0x32,0x69,0x52,0x4e,0x51,0x0a,0x4b,0x75,0x67,0x48,0x55, +0x49,0x4f,0x34,0x4b,0x53,0x71,0x4a,0x56,0x42,0x50,0x38,0x61,0x4b,0x4f,0x61,0x54, +0x5a,0x47,0x45,0x31,0x4b,0x4d,0x68,0x2f,0x59,0x6a,0x68,0x36,0x71,0x2f,0x67,0x50, +0x61,0x6c,0x67,0x64,0x2f,0x38,0x44,0x6d,0x72,0x78,0x53,0x4a,0x6d,0x55,0x78,0x33, +0x62,0x4e,0x62,0x38,0x52,0x59,0x36,0x70,0x4b,0x7a,0x74,0x0a,0x5a,0x64,0x75,0x53, +0x61,0x53,0x2b,0x57,0x55,0x30,0x59,0x74,0x2b,0x6c,0x47,0x35,0x76,0x56,0x67,0x61, +0x70,0x48,0x45,0x71,0x36,0x79,0x71,0x4c,0x62,0x65,0x56,0x78,0x51,0x4c,0x75,0x62, +0x54,0x69,0x6e,0x4f,0x66,0x56,0x56,0x5a,0x58,0x79,0x45,0x43,0x59,0x47,0x4d,0x73, +0x59,0x71,0x65,0x6e,0x4a,0x6a,0x4e,0x63,0x62,0x49,0x5a,0x4e,0x0a,0x79,0x4d,0x75, +0x72,0x46,0x63,0x67,0x30,0x34,0x36,0x4f,0x34,0x59,0x79,0x68,0x56,0x79,0x71,0x53, +0x69,0x74,0x43,0x59,0x37,0x68,0x2f,0x65,0x71,0x67,0x6b,0x50,0x4a,0x51,0x30,0x68, +0x6b,0x70,0x39,0x45,0x64,0x51,0x77,0x62,0x6e,0x38,0x56,0x6c,0x66,0x78,0x64,0x42, +0x58,0x77,0x51,0x34,0x4e,0x48,0x4b,0x30,0x4a,0x56,0x46,0x2f,0x33,0x0a,0x71,0x48, +0x61,0x68,0x4e,0x48,0x4f,0x35,0x64,0x62,0x4a,0x5a,0x57,0x59,0x41,0x62,0x42,0x44, +0x70,0x32,0x51,0x45,0x53,0x70,0x76,0x6f,0x2b,0x38,0x33,0x6c,0x68,0x34,0x64,0x6e, +0x58,0x6a,0x46,0x58,0x4d,0x43,0x48,0x76,0x52,0x68,0x35,0x31,0x79,0x2f,0x54,0x71, +0x79,0x42,0x34,0x56,0x76,0x72,0x52,0x4b,0x49,0x4b,0x74,0x54,0x6f,0x7a,0x0a,0x5a, +0x6a,0x48,0x59,0x49,0x63,0x62,0x6a,0x76,0x53,0x58,0x4d,0x7a,0x61,0x44,0x50,0x6a, +0x50,0x63,0x5a,0x47,0x6a,0x42,0x4a,0x6c,0x47,0x36,0x43,0x76,0x44,0x34,0x4c,0x6d, +0x59,0x7a,0x72,0x6b,0x48,0x34,0x31,0x63,0x7a,0x72,0x34,0x57,0x41,0x3d,0x3d,0x0a, +0x2d,0x2d,0x2d,0x2d,0x2d,0x45,0x4e,0x44,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49, +0x43,0x41,0x54,0x45,0x2d,0x2d,0x2d,0x2d,0x2d,0x0a + }, + }; + VpnRpcHubAddCA out_rpc_hub_add_ca = api.AddCa(in_rpc_hub_add_ca); + + print_object(out_rpc_hub_add_ca); + + Console.WriteLine("End: Test_AddCa"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumCa', Enumerate CA(Certificate Authority) in the hub + /// + public VpnRpcHubEnumCA Test_EnumCa() + { + Console.WriteLine("Begin: Test_EnumCa"); + + VpnRpcHubEnumCA in_rpc_hub_enum_ca = new VpnRpcHubEnumCA() + { + HubName_str = hub_name, + }; + VpnRpcHubEnumCA out_rpc_hub_enum_ca = api.EnumCa(in_rpc_hub_enum_ca); + + print_object(out_rpc_hub_enum_ca); + + Console.WriteLine("End: Test_EnumCa"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_hub_enum_ca; + } + + /// + /// API test for 'GetCa', Get CA(Certificate Authority) setting from the hub + /// + public void Test_GetCa(uint key) + { + Console.WriteLine("Begin: Test_GetCa"); + + VpnRpcHubGetCA in_rpc_hub_get_ca = new VpnRpcHubGetCA() + { + HubName_str = hub_name, + Key_u32 = key, + }; + VpnRpcHubGetCA out_rpc_hub_get_ca = api.GetCa(in_rpc_hub_get_ca); + + print_object(out_rpc_hub_get_ca); + + Console.WriteLine("End: Test_GetCa"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteCa', Delete a CA(Certificate Authority) setting from the hub + /// + public void Test_DeleteCa(uint key) + { + Console.WriteLine("Begin: Test_DeleteCa"); + + VpnRpcHubDeleteCA in_rpc_hub_delete_ca = new VpnRpcHubDeleteCA() + { + HubName_str = hub_name, + Key_u32 = key, + }; + VpnRpcHubDeleteCA out_rpc_hub_delete_ca = api.DeleteCa(in_rpc_hub_delete_ca); + + print_object(out_rpc_hub_delete_ca); + + Console.WriteLine("End: Test_DeleteCa"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetLinkOnline', Make a link into on-line + /// + public void Test_SetLinkOnline() + { + Console.WriteLine("Begin: Test_SetLinkOnline"); + + VpnRpcLink in_rpc_link = new VpnRpcLink() + { + HubName_str = hub_name, + AccountName_utf = "linktest", + }; + VpnRpcLink out_rpc_link = api.SetLinkOnline(in_rpc_link); + + print_object(out_rpc_link); + + Console.WriteLine("End: Test_SetLinkOnline"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetLinkOffline', Make a link into off-line + /// + public void Test_SetLinkOffline() + { + Console.WriteLine("Begin: Test_SetLinkOffline"); + + VpnRpcLink in_rpc_link = new VpnRpcLink() + { + HubName_str = hub_name, + AccountName_utf = "linktest", + }; + VpnRpcLink out_rpc_link = api.SetLinkOffline(in_rpc_link); + + print_object(out_rpc_link); + + Console.WriteLine("End: Test_SetLinkOffline"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteLink', Delete a link + /// + public void Test_DeleteLink() + { + Console.WriteLine("Begin: Test_DeleteLink"); + + VpnRpcLink in_rpc_link = new VpnRpcLink() + { + HubName_str = hub_name, + AccountName_utf = "linktest2", + }; + VpnRpcLink out_rpc_link = api.DeleteLink(in_rpc_link); + + print_object(out_rpc_link); + + Console.WriteLine("End: Test_DeleteLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'RenameLink', Rename link (cascade connection) + /// + public void Test_RenameLink() + { + Console.WriteLine("Begin: Test_RenameLink"); + + VpnRpcRenameLink in_rpc_rename_link = new VpnRpcRenameLink() + { + HubName_str = hub_name, + OldAccountName_utf = "linktest", + NewAccountName_utf = "linktest2", + }; + VpnRpcRenameLink out_rpc_rename_link = api.RenameLink(in_rpc_rename_link); + + print_object(out_rpc_rename_link); + + Console.WriteLine("End: Test_RenameLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'CreateLink', Create a new link(cascade) + /// + public void Test_CreateLink() + { + Console.WriteLine("Begin: Test_CreateLink"); + + VpnRpcCreateLink in_rpc_create_link = new VpnRpcCreateLink() + { + HubName_Ex_str = hub_name, + CheckServerCert_bool = false, + + ClientOption_AccountName_utf = "linktest", + ClientOption_Hostname_str = "1.2.3.4", + ClientOption_Port_u32 = 443, + ClientOption_ProxyType_u32 = 0, + ClientOption_HubName_str = "ABC", + ClientOption_MaxConnection_u32 = 16, + ClientOption_UseEncrypt_bool = true, + ClientOption_UseCompress_bool = false, + ClientOption_HalfConnection_bool = true, + ClientOption_AdditionalConnectionInterval_u32 = 2, + ClientOption_ConnectionDisconnectSpan_u32 = 24, + + ClientAuth_AuthType_u32 = VpnRpcClientAuthType.PlainPassword, + ClientAuth_Username_str = "181012", + ClientAuth_PlainPassword_str = "microsoft", + ClientAuth_HashedPassword_bin = new byte[0] { }, + ClientAuth_ClientX_bin = new byte[0] { }, + ClientAuth_ClientK_bin = new byte[0] { }, + + SecPol_DHCPFilter_bool = true, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = true, + SecPol_CheckMac_bool = true, + SecPol_CheckIP_bool = true, + SecPol_ArpDhcpOnly_bool = true, + SecPol_PrivacyFilter_bool = true, + SecPol_NoServer_bool = true, + SecPol_NoBroadcastLimiter_bool = true, + SecPol_MaxMac_u32 = 32, + SecPol_MaxIP_u32 = 64, + SecPol_MaxUpload_u32 = 960000, + SecPol_MaxDownload_u32 = 1280000, + SecPol_RSandRAFilter_bool = true, + SecPol_RAFilter_bool = true, + SecPol_DHCPv6Filter_bool = true, + SecPol_DHCPv6NoServer_bool = true, + SecPol_CheckIPv6_bool = true, + SecPol_NoServerV6_bool = true, + SecPol_MaxIPv6_u32 = 127, + SecPol_FilterIPv4_bool = true, + SecPol_FilterIPv6_bool = true, + SecPol_FilterNonIP_bool = true, + SecPol_NoIPv6DefaultRouterInRA_bool = true, + SecPol_VLanId_u32 = 123, + SecPol_Ver3_bool = true, + }; + VpnRpcCreateLink out_rpc_create_link = api.CreateLink(in_rpc_create_link); + + print_object(out_rpc_create_link); + + Console.WriteLine("End: Test_CreateLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetLink', Get link configuration + /// + public void Test_GetLink() + { + Console.WriteLine("Begin: Test_GetLink"); + + VpnRpcCreateLink in_rpc_create_link = new VpnRpcCreateLink() + { + HubName_Ex_str = hub_name, + ClientOption_AccountName_utf = "linktest", + }; + VpnRpcCreateLink out_rpc_create_link = api.GetLink(in_rpc_create_link); + + print_object(out_rpc_create_link); + + Console.WriteLine("End: Test_GetLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetLink', Set link configuration + /// + public void Test_SetLink() + { + Console.WriteLine("Begin: Test_SetLink"); + + VpnRpcCreateLink in_rpc_create_link = new VpnRpcCreateLink() + { + HubName_Ex_str = hub_name, + CheckServerCert_bool = false, + + ClientOption_AccountName_utf = "linktest", + ClientOption_Hostname_str = "1.2.3.4", + ClientOption_Port_u32 = 443, + ClientOption_ProxyType_u32 = 0, + ClientOption_HubName_str = "ABC", + ClientOption_MaxConnection_u32 = 16, + ClientOption_UseEncrypt_bool = true, + ClientOption_UseCompress_bool = false, + ClientOption_HalfConnection_bool = true, + ClientOption_AdditionalConnectionInterval_u32 = 2, + ClientOption_ConnectionDisconnectSpan_u32 = 24, + + ClientAuth_AuthType_u32 = VpnRpcClientAuthType.PlainPassword, + ClientAuth_Username_str = "181012", + ClientAuth_PlainPassword_str = "microsoft", + ClientAuth_HashedPassword_bin = new byte[0] { }, + ClientAuth_ClientX_bin = new byte[0] { }, + ClientAuth_ClientK_bin = new byte[0] { }, + + SecPol_DHCPFilter_bool = true, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = true, + SecPol_CheckMac_bool = true, + SecPol_CheckIP_bool = true, + SecPol_ArpDhcpOnly_bool = true, + SecPol_PrivacyFilter_bool = true, + SecPol_NoServer_bool = true, + SecPol_NoBroadcastLimiter_bool = true, + SecPol_MaxMac_u32 = 32, + SecPol_MaxIP_u32 = 64, + SecPol_MaxUpload_u32 = 960000, + SecPol_MaxDownload_u32 = 1280000, + SecPol_RSandRAFilter_bool = true, + SecPol_RAFilter_bool = true, + SecPol_DHCPv6Filter_bool = true, + SecPol_DHCPv6NoServer_bool = true, + SecPol_CheckIPv6_bool = true, + SecPol_NoServerV6_bool = true, + SecPol_MaxIPv6_u32 = 127, + SecPol_FilterIPv4_bool = true, + SecPol_FilterIPv6_bool = true, + SecPol_FilterNonIP_bool = true, + SecPol_NoIPv6DefaultRouterInRA_bool = true, + SecPol_VLanId_u32 = 123, + SecPol_Ver3_bool = true, + }; + VpnRpcCreateLink out_rpc_create_link = api.SetLink(in_rpc_create_link); + + print_object(out_rpc_create_link); + + Console.WriteLine("End: Test_SetLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumLink', Enumerate links + /// + public VpnRpcEnumLink Test_EnumLink() + { + Console.WriteLine("Begin: Test_EnumLink"); + + VpnRpcEnumLink in_rpc_enum_link = new VpnRpcEnumLink() + { + HubName_str = hub_name, + }; + VpnRpcEnumLink out_rpc_enum_link = api.EnumLink(in_rpc_enum_link); + + print_object(out_rpc_enum_link); + + Console.WriteLine("End: Test_EnumLink"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_link; + } + + /// + /// API test for 'GetLinkStatus', Get link status + /// + public void Test_GetLinkStatus(string name) + { + Console.WriteLine("Begin: Test_GetLinkStatus"); + + VpnRpcLinkStatus in_rpc_link_status = new VpnRpcLinkStatus() + { + HubName_Ex_str = hub_name, + AccountName_utf = name, + }; + VpnRpcLinkStatus out_rpc_link_status = api.GetLinkStatus(in_rpc_link_status); + + print_object(out_rpc_link_status); + + Console.WriteLine("End: Test_GetLinkStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddAccess', Add access list entry + /// + public void Test_AddAccess() + { + Console.WriteLine("Begin: Test_AddAccess"); + + VpnRpcAddAccess in_rpc_add_access_ipv4 = new VpnRpcAddAccess() + { + HubName_str = hub_name, + + AccessListSingle = new VpnAccess[1] + { + new VpnAccess() + { + Note_utf = "IPv4 Test", + Active_bool = true, + Priority_u32 = 100, + Discard_bool = true, + IsIPv6_bool = false, + SrcIpAddress_ip = "192.168.0.0", + SrcSubnetMask_ip = "255.255.255.0", + DestIpAddress_ip = "10.0.0.0", + DestSubnetMask_ip = "255.255.0.0", + Protocol_u32 = VpnIpProtocolNumber.TCP, + SrcPortStart_u32 = 123, + SrcPortEnd_u32 = 456, + DestPortStart_u32 = 555, + DestPortEnd_u32 = 666, + SrcUsername_str = "dnobori", + DestUsername_str = "nekosan", + CheckSrcMac_bool = true, + SrcMacAddress_bin = new byte[] { 1, 2, 3, 0, 0, 0 }, + SrcMacMask_bin = new byte[] { 255, 255, 255, 0, 0, 0 }, + CheckTcpState_bool = true, + Established_bool = true, + Delay_u32 = 10, + Jitter_u32 = 20, + Loss_u32 = 30, + RedirectUrl_str = "aho", + }, + }, + }; + VpnRpcAddAccess out_rpc_add_access_ipv4 = api.AddAccess(in_rpc_add_access_ipv4); + + VpnRpcAddAccess in_rpc_add_access_ipv6 = new VpnRpcAddAccess() + { + HubName_str = hub_name, + + AccessListSingle = new VpnAccess[1] + { + new VpnAccess() + { + Note_utf = "IPv6 Test", + Active_bool = true, + Priority_u32 = 100, + Discard_bool = true, + IsIPv6_bool = true, + SrcIpAddress6_bin = new byte[] { 0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + SrcSubnetMask6_bin = new byte[] { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + Protocol_u32 = VpnIpProtocolNumber.UDP, + SrcPortStart_u32 = 123, + SrcPortEnd_u32 = 456, + DestPortStart_u32 = 555, + DestPortEnd_u32 = 666, + SrcUsername_str = "dnobori", + DestUsername_str = "nekosan", + CheckSrcMac_bool = true, + SrcMacAddress_bin = new byte[] { 1, 2, 3, 0, 0, 0 }, + SrcMacMask_bin = new byte[] { 255, 255, 255, 0, 0, 0 }, + CheckTcpState_bool = true, + Established_bool = true, + Delay_u32 = 10, + Jitter_u32 = 20, + Loss_u32 = 30, + RedirectUrl_str = "aho", + }, + }, + }; + VpnRpcAddAccess out_rpc_add_access_ipv6 = api.AddAccess(in_rpc_add_access_ipv6); + + Console.WriteLine("End: Test_AddAccess"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteAccess', Delete access list entry + /// + public void Test_DeleteAccess() + { + Console.WriteLine("Begin: Test_DeleteAccess"); + + VpnRpcDeleteAccess in_rpc_delete_access = new VpnRpcDeleteAccess() + { + HubName_str = hub_name, + Id_u32 = 1, + }; + VpnRpcDeleteAccess out_rpc_delete_access = api.DeleteAccess(in_rpc_delete_access); + + print_object(out_rpc_delete_access); + + Console.WriteLine("End: Test_DeleteAccess"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumAccess', Get access list + /// + public void Test_EnumAccess() + { + Console.WriteLine("Begin: Test_EnumAccess"); + + VpnRpcEnumAccessList in_rpc_enum_access_list = new VpnRpcEnumAccessList() + { + HubName_str = hub_name, + }; + VpnRpcEnumAccessList out_rpc_enum_access_list = api.EnumAccess(in_rpc_enum_access_list); + + print_object(out_rpc_enum_access_list); + + Console.WriteLine("End: Test_EnumAccess"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetAccessList', Set access list + /// + public void Test_SetAccessList() + { + Console.WriteLine("Begin: Test_SetAccessList"); + + VpnRpcEnumAccessList in_rpc_enum_access_list = new VpnRpcEnumAccessList() + { + HubName_str = hub_name, + AccessList = new VpnAccess[] + { + new VpnAccess() + { + Note_utf = "IPv4 Test 2", + Active_bool = true, + Priority_u32 = 100, + Discard_bool = true, + IsIPv6_bool = false, + SrcIpAddress_ip = "192.168.0.0", + SrcSubnetMask_ip = "255.255.255.0", + DestIpAddress_ip = "10.0.0.0", + DestSubnetMask_ip = "255.255.0.0", + Protocol_u32 = VpnIpProtocolNumber.TCP, + SrcPortStart_u32 = 123, + SrcPortEnd_u32 = 456, + DestPortStart_u32 = 555, + DestPortEnd_u32 = 666, + SrcUsername_str = "dnobori", + DestUsername_str = "nekosan", + CheckSrcMac_bool = true, + SrcMacAddress_bin = new byte[] { 1, 2, 3, 0, 0, 0 }, + SrcMacMask_bin = new byte[] { 255, 255, 255, 0, 0, 0 }, + CheckTcpState_bool = true, + Established_bool = true, + Delay_u32 = 10, + Jitter_u32 = 20, + Loss_u32 = 30, + RedirectUrl_str = "aho", + }, + new VpnAccess() + { + Note_utf = "IPv6 Test 2", + Active_bool = true, + Priority_u32 = 100, + Discard_bool = true, + IsIPv6_bool = true, + SrcIpAddress6_bin = new byte[] { 0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + SrcSubnetMask6_bin = new byte[] { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + Protocol_u32 = VpnIpProtocolNumber.UDP, + SrcPortStart_u32 = 123, + SrcPortEnd_u32 = 456, + DestPortStart_u32 = 555, + DestPortEnd_u32 = 666, + SrcUsername_str = "dnobori", + DestUsername_str = "nekosan", + CheckSrcMac_bool = true, + SrcMacAddress_bin = new byte[] { 1, 2, 3, 0, 0, 0 }, + SrcMacMask_bin = new byte[] { 255, 255, 255, 0, 0, 0 }, + CheckTcpState_bool = true, + Established_bool = true, + Delay_u32 = 10, + Jitter_u32 = 20, + Loss_u32 = 30, + RedirectUrl_str = "aho", + }, + } + }; + VpnRpcEnumAccessList out_rpc_enum_access_list = api.SetAccessList(in_rpc_enum_access_list); + + print_object(out_rpc_enum_access_list); + + Console.WriteLine("End: Test_SetAccessList"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'CreateUser', Create a user + /// + public void Test_CreateUser() + { + Console.WriteLine("Begin: Test_CreateUser"); + + VpnRpcSetUser in_rpc_set_user = new VpnRpcSetUser() + { + HubName_str = hub_name, + Name_str = "test1", + Realname_utf = "Cat man", + Note_utf = "Hey!!!", + AuthType_u32 = VpnRpcUserAuthType.Password, + Auth_Password_str = "microsoft", + Auth_UserCert_CertData = new byte[0] { }, + Auth_RootCert_Serial = new byte[0] { }, + Auth_RootCert_CommonName = "", + Auth_Radius_RadiusUsername = "", + Auth_NT_NTUsername = "", + ExpireTime_dt = new DateTime(2019, 1, 1), + UsePolicy_bool = true, + SecPol_Access_bool = true, + SecPol_DHCPFilter_bool = false, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = false, + SecPol_NoBridge_bool = false, + SecPol_NoRouting_bool = false, + SecPol_CheckMac_bool = false, + SecPol_CheckIP_bool = false, + SecPol_ArpDhcpOnly_bool = false, + SecPol_PrivacyFilter_bool = false, + SecPol_NoServer_bool = false, + SecPol_NoBroadcastLimiter_bool = false, + SecPol_MonitorPort_bool = false, + SecPol_MaxConnection_u32 = 32, + SecPol_TimeOut_u32 = 15, + SecPol_MaxMac_u32 = 1000, + SecPol_MaxIP_u32 = 1000, + SecPol_MaxUpload_u32 = 1000000000, + SecPol_MaxDownload_u32 = 1000000000, + SecPol_FixPassword_bool = false, + SecPol_MultiLogins_u32 = 1000, + SecPol_NoQoS_bool = false, + SecPol_RSandRAFilter_bool = false, + SecPol_RAFilter_bool = false, + SecPol_DHCPv6Filter_bool = false, + SecPol_DHCPv6NoServer_bool = false, + SecPol_NoRoutingV6_bool = false, + SecPol_CheckIPv6_bool = false, + SecPol_NoServerV6_bool = false, + SecPol_MaxIPv6_u32 = 1234, + SecPol_NoSavePassword_bool = false, + SecPol_AutoDisconnect_u32 = 0, + SecPol_FilterIPv4_bool = false, + SecPol_FilterIPv6_bool = false, + SecPol_FilterNonIP_bool = false, + SecPol_NoIPv6DefaultRouterInRA_bool = false, + SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool = false, + SecPol_VLanId_u32 = 0, + SecPol_Ver3_bool = true, + }; + VpnRpcSetUser out_rpc_set_user = api.CreateUser(in_rpc_set_user); + + Console.WriteLine("End: Test_CreateUser"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetUser', Set user setting + /// + public void Test_SetUser() + { + Console.WriteLine("Begin: Test_SetUser"); + + VpnRpcSetUser in_rpc_set_user = new VpnRpcSetUser() + { + HubName_str = hub_name, + Name_str = "test1", + Realname_utf = "Cat man", + Note_utf = "Hey!!!", + GroupName_str = "group1", + AuthType_u32 = VpnRpcUserAuthType.Anonymous, + Auth_Password_str = "", + Auth_UserCert_CertData = new byte[0] { }, + Auth_RootCert_Serial = new byte[0] { }, + Auth_RootCert_CommonName = "", + Auth_Radius_RadiusUsername = "", + Auth_NT_NTUsername = "", + ExpireTime_dt = new DateTime(2019, 1, 1), + UsePolicy_bool = true, + SecPol_Access_bool = true, + SecPol_DHCPFilter_bool = false, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = false, + SecPol_NoBridge_bool = false, + SecPol_NoRouting_bool = false, + SecPol_CheckMac_bool = false, + SecPol_CheckIP_bool = false, + SecPol_ArpDhcpOnly_bool = false, + SecPol_PrivacyFilter_bool = false, + SecPol_NoServer_bool = false, + SecPol_NoBroadcastLimiter_bool = false, + SecPol_MonitorPort_bool = false, + SecPol_MaxConnection_u32 = 32, + SecPol_TimeOut_u32 = 15, + SecPol_MaxMac_u32 = 1000, + SecPol_MaxIP_u32 = 1000, + SecPol_MaxUpload_u32 = 1000000000, + SecPol_MaxDownload_u32 = 1000000000, + SecPol_FixPassword_bool = false, + SecPol_MultiLogins_u32 = 1000, + SecPol_NoQoS_bool = false, + SecPol_RSandRAFilter_bool = false, + SecPol_RAFilter_bool = false, + SecPol_DHCPv6Filter_bool = false, + SecPol_DHCPv6NoServer_bool = false, + SecPol_NoRoutingV6_bool = false, + SecPol_CheckIPv6_bool = false, + SecPol_NoServerV6_bool = false, + SecPol_MaxIPv6_u32 = 1234, + SecPol_NoSavePassword_bool = false, + SecPol_AutoDisconnect_u32 = 0, + SecPol_FilterIPv4_bool = false, + SecPol_FilterIPv6_bool = false, + SecPol_FilterNonIP_bool = false, + SecPol_NoIPv6DefaultRouterInRA_bool = false, + SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool = false, + SecPol_VLanId_u32 = 0, + SecPol_Ver3_bool = true, + }; + VpnRpcSetUser out_rpc_set_user = api.SetUser(in_rpc_set_user); + + Console.WriteLine("End: Test_SetUser"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetUser', Get user setting + /// + public void Test_GetUser() + { + Console.WriteLine("Begin: Test_GetUser"); + + VpnRpcSetUser in_rpc_set_user = new VpnRpcSetUser() + { + HubName_str = hub_name, + Name_str = "test1", + }; + VpnRpcSetUser out_rpc_set_user = api.GetUser(in_rpc_set_user); + + print_object(out_rpc_set_user); + + Console.WriteLine("End: Test_GetUser"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteUser', Delete a user + /// + public void Test_DeleteUser() + { + Console.WriteLine("Begin: Test_DeleteUser"); + + VpnRpcDeleteUser in_rpc_delete_user = new VpnRpcDeleteUser() + { + HubName_str = hub_name, + Name_str = "test1", + }; + VpnRpcDeleteUser out_rpc_delete_user = api.DeleteUser(in_rpc_delete_user); + + Console.WriteLine("End: Test_DeleteUser"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumUser', Enumerate users + /// + public void Test_EnumUser() + { + Console.WriteLine("Begin: Test_EnumUser"); + + VpnRpcEnumUser in_rpc_enum_user = new VpnRpcEnumUser() + { + HubName_str = hub_name, + }; + VpnRpcEnumUser out_rpc_enum_user = api.EnumUser(in_rpc_enum_user); + + print_object(out_rpc_enum_user); + + Console.WriteLine("End: Test_EnumUser"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'CreateGroup', Create a group + /// + public void Test_CreateGroup() + { + Console.WriteLine("Begin: Test_CreateGroup"); + + VpnRpcSetGroup in_rpc_set_group = new VpnRpcSetGroup() + { + HubName_str = hub_name, + Name_str = "group1", + Realname_utf = "Cat group", + Note_utf = "This is it! This is it!!", + UsePolicy_bool = true, + SecPol_Access_bool = true, + SecPol_DHCPFilter_bool = false, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = false, + SecPol_NoBridge_bool = false, + SecPol_NoRouting_bool = false, + SecPol_CheckMac_bool = false, + SecPol_CheckIP_bool = false, + SecPol_ArpDhcpOnly_bool = false, + SecPol_PrivacyFilter_bool = false, + SecPol_NoServer_bool = false, + SecPol_NoBroadcastLimiter_bool = false, + SecPol_MonitorPort_bool = false, + SecPol_MaxConnection_u32 = 32, + SecPol_TimeOut_u32 = 15, + SecPol_MaxMac_u32 = 1000, + SecPol_MaxIP_u32 = 1000, + SecPol_MaxUpload_u32 = 1000000000, + SecPol_MaxDownload_u32 = 1000000000, + SecPol_FixPassword_bool = false, + SecPol_MultiLogins_u32 = 1000, + SecPol_NoQoS_bool = false, + SecPol_RSandRAFilter_bool = false, + SecPol_RAFilter_bool = false, + SecPol_DHCPv6Filter_bool = false, + SecPol_DHCPv6NoServer_bool = false, + SecPol_NoRoutingV6_bool = false, + SecPol_CheckIPv6_bool = false, + SecPol_NoServerV6_bool = false, + SecPol_MaxIPv6_u32 = 1234, + SecPol_NoSavePassword_bool = false, + SecPol_AutoDisconnect_u32 = 0, + SecPol_FilterIPv4_bool = false, + SecPol_FilterIPv6_bool = false, + SecPol_FilterNonIP_bool = false, + SecPol_NoIPv6DefaultRouterInRA_bool = false, + SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool = false, + SecPol_VLanId_u32 = 0, + SecPol_Ver3_bool = true, + }; + VpnRpcSetGroup out_rpc_set_group = api.CreateGroup(in_rpc_set_group); + + print_object(out_rpc_set_group); + + Console.WriteLine("End: Test_CreateGroup"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetGroup', Set group setting + /// + public void Test_SetGroup() + { + Console.WriteLine("Begin: Test_SetGroup"); + + VpnRpcSetGroup in_rpc_set_group = new VpnRpcSetGroup() + { + HubName_str = hub_name, + Name_str = "group1", + Realname_utf = "Cat group 2", + Note_utf = "This is it! This is it!! 2", + UsePolicy_bool = true, + SecPol_Access_bool = true, + SecPol_DHCPFilter_bool = false, + SecPol_DHCPNoServer_bool = true, + SecPol_DHCPForce_bool = false, + SecPol_NoBridge_bool = false, + SecPol_NoRouting_bool = false, + SecPol_CheckMac_bool = false, + SecPol_CheckIP_bool = false, + SecPol_ArpDhcpOnly_bool = false, + SecPol_PrivacyFilter_bool = false, + SecPol_NoServer_bool = false, + SecPol_NoBroadcastLimiter_bool = false, + SecPol_MonitorPort_bool = false, + SecPol_MaxConnection_u32 = 32, + SecPol_TimeOut_u32 = 15, + SecPol_MaxMac_u32 = 1000, + SecPol_MaxIP_u32 = 1000, + SecPol_MaxUpload_u32 = 1000000000, + SecPol_MaxDownload_u32 = 1000000000, + SecPol_FixPassword_bool = false, + SecPol_MultiLogins_u32 = 1000, + SecPol_NoQoS_bool = false, + SecPol_RSandRAFilter_bool = false, + SecPol_RAFilter_bool = false, + SecPol_DHCPv6Filter_bool = false, + SecPol_DHCPv6NoServer_bool = false, + SecPol_NoRoutingV6_bool = false, + SecPol_CheckIPv6_bool = false, + SecPol_NoServerV6_bool = false, + SecPol_MaxIPv6_u32 = 1234, + SecPol_NoSavePassword_bool = false, + SecPol_AutoDisconnect_u32 = 0, + SecPol_FilterIPv4_bool = false, + SecPol_FilterIPv6_bool = false, + SecPol_FilterNonIP_bool = false, + SecPol_NoIPv6DefaultRouterInRA_bool = false, + SecPol_NoIPv6DefaultRouterInRAWhenIPv6_bool = false, + SecPol_VLanId_u32 = 0, + SecPol_Ver3_bool = true, + }; + VpnRpcSetGroup out_rpc_set_group = api.SetGroup(in_rpc_set_group); + + print_object(out_rpc_set_group); + + Console.WriteLine("End: Test_SetGroup"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetGroup', Get group information + /// + public void Test_GetGroup() + { + Console.WriteLine("Begin: Test_GetGroup"); + + VpnRpcSetGroup in_rpc_set_group = new VpnRpcSetGroup() + { + HubName_str = hub_name, + Name_str = "group1", + }; + VpnRpcSetGroup out_rpc_set_group = api.GetGroup(in_rpc_set_group); + + print_object(out_rpc_set_group); + + Console.WriteLine("End: Test_GetGroup"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteGroup', Delete a group + /// + public void Test_DeleteGroup() + { + Console.WriteLine("Begin: Test_DeleteGroup"); + + VpnRpcDeleteUser in_rpc_delete_user = new VpnRpcDeleteUser() + { + HubName_str = hub_name, + Name_str = "group1", + }; + VpnRpcDeleteUser out_rpc_delete_user = api.DeleteGroup(in_rpc_delete_user); + + print_object(out_rpc_delete_user); + + Console.WriteLine("End: Test_DeleteGroup"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumGroup', Enumerate groups + /// + public void Test_EnumGroup() + { + Console.WriteLine("Begin: Test_EnumGroup"); + + VpnRpcEnumGroup in_rpc_enum_group = new VpnRpcEnumGroup() + { + HubName_str = hub_name, + }; + VpnRpcEnumGroup out_rpc_enum_group = api.EnumGroup(in_rpc_enum_group); + + print_object(out_rpc_enum_group); + + Console.WriteLine("End: Test_EnumGroup"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumSession', Enumerate sessions + /// + public VpnRpcEnumSession Test_EnumSession() + { + Console.WriteLine("Begin: Test_EnumSession"); + + VpnRpcEnumSession in_rpc_enum_session = new VpnRpcEnumSession() + { + HubName_str = hub_name, + }; + VpnRpcEnumSession out_rpc_enum_session = api.EnumSession(in_rpc_enum_session); + + print_object(out_rpc_enum_session); + + Console.WriteLine("End: Test_EnumSession"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_session; + } + + /// + /// API test for 'GetSessionStatus', Get session status + /// + public void Test_GetSessionStatus(string session_name) + { + Console.WriteLine("Begin: Test_GetSessionStatus"); + + VpnRpcSessionStatus in_rpc_session_status = new VpnRpcSessionStatus() + { + HubName_str = hub_name, + Name_str = session_name, + }; + VpnRpcSessionStatus out_rpc_session_status = api.GetSessionStatus(in_rpc_session_status); + + print_object(out_rpc_session_status); + + Console.WriteLine("End: Test_GetSessionStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteSession', Delete a session + /// + public void Test_DeleteSession(string session_id) + { + Console.WriteLine("Begin: Test_DeleteSession"); + + VpnRpcDeleteSession in_rpc_delete_session = new VpnRpcDeleteSession() + { + HubName_str = hub_name, + Name_str = session_id, + }; + VpnRpcDeleteSession out_rpc_delete_session = api.DeleteSession(in_rpc_delete_session); + + print_object(out_rpc_delete_session); + + Console.WriteLine("End: Test_DeleteSession"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumMacTable', Get MAC address table + /// + public VpnRpcEnumMacTable Test_EnumMacTable() + { + Console.WriteLine("Begin: Test_EnumMacTable"); + + VpnRpcEnumMacTable in_rpc_enum_mac_table = new VpnRpcEnumMacTable() + { + HubName_str = hub_name, + }; + VpnRpcEnumMacTable out_rpc_enum_mac_table = api.EnumMacTable(in_rpc_enum_mac_table); + + print_object(out_rpc_enum_mac_table); + + Console.WriteLine("End: Test_EnumMacTable"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_mac_table; + } + + /// + /// API test for 'DeleteMacTable', Delete MAC address table entry + /// + public void Test_DeleteMacTable(uint key32) + { + Console.WriteLine("Begin: Test_DeleteMacTable"); + + VpnRpcDeleteTable in_rpc_delete_table = new VpnRpcDeleteTable() + { + HubName_str = hub_name, + Key_u32 = key32, + }; + VpnRpcDeleteTable out_rpc_delete_table = api.DeleteMacTable(in_rpc_delete_table); + + Console.WriteLine("End: Test_DeleteMacTable"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumIpTable', Get IP address table + /// + public VpnRpcEnumIpTable Test_EnumIpTable() + { + Console.WriteLine("Begin: Test_EnumIpTable"); + + VpnRpcEnumIpTable in_rpc_enum_ip_table = new VpnRpcEnumIpTable() + { + HubName_str = hub_name, + }; + VpnRpcEnumIpTable out_rpc_enum_ip_table = api.EnumIpTable(in_rpc_enum_ip_table); + + print_object(out_rpc_enum_ip_table); + + Console.WriteLine("End: Test_EnumIpTable"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_ip_table; + } + + /// + /// API test for 'DeleteIpTable', Delete IP address table entry + /// + public void Test_DeleteIpTable(uint key32) + { + Console.WriteLine("Begin: Test_DeleteIpTable"); + + VpnRpcDeleteTable in_rpc_delete_table = new VpnRpcDeleteTable() + { + HubName_str = hub_name, + Key_u32 = key32, + }; + VpnRpcDeleteTable out_rpc_delete_table = api.DeleteIpTable(in_rpc_delete_table); + + print_object(out_rpc_delete_table); + + Console.WriteLine("End: Test_DeleteIpTable"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetKeep', Set keep-alive function setting + /// + public void Test_SetKeep() + { + Console.WriteLine("Begin: Test_SetKeep"); + + VpnRpcKeep in_rpc_keep = new VpnRpcKeep() + { + UseKeepConnect_bool = true, + KeepConnectHost_str = "www.softether.org", + KeepConnectPort_u32 = 123, + KeepConnectProtocol_u32 = VpnRpcKeepAliveProtocol.UDP, + KeepConnectInterval_u32 = 1, + }; + VpnRpcKeep out_rpc_keep = api.SetKeep(in_rpc_keep); + + print_object(out_rpc_keep); + + Console.WriteLine("End: Test_SetKeep"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetKeep', Get keep-alive function setting + /// + public void Test_GetKeep() + { + Console.WriteLine("Begin: Test_GetKeep"); + + VpnRpcKeep in_rpc_keep = new VpnRpcKeep() + { + }; + VpnRpcKeep out_rpc_keep = api.GetKeep(in_rpc_keep); + + print_object(out_rpc_keep); + + Console.WriteLine("End: Test_GetKeep"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnableSecureNAT', Enable SecureNAT function of the hub + /// + public void Test_EnableSecureNAT() + { + Console.WriteLine("Begin: Test_EnableSecureNAT"); + + VpnRpcHub in_rpc_hub = new VpnRpcHub() + { + HubName_str = hub_name, + }; + VpnRpcHub out_rpc_hub = api.EnableSecureNAT(in_rpc_hub); + + print_object(out_rpc_hub); + + Console.WriteLine("End: Test_EnableSecureNAT"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DisableSecureNAT', Disable the SecureNAT function of the hub + /// + public void Test_DisableSecureNAT() + { + Console.WriteLine("Begin: Test_DisableSecureNAT"); + + VpnRpcHub in_rpc_hub = new VpnRpcHub() + { + HubName_str = hub_name, + }; + VpnRpcHub out_rpc_hub = api.DisableSecureNAT(in_rpc_hub); + + print_object(out_rpc_hub); + + Console.WriteLine("End: Test_DisableSecureNAT"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetSecureNATOption', Set SecureNAT options + /// + public void Test_SetSecureNATOption() + { + Console.WriteLine("Begin: Test_SetSecureNATOption"); + + VpnVhOption in_vh_option = new VpnVhOption() + { + RpcHubName_str = hub_name, + MacAddress_bin = new byte[] { 0x00, 0xAC, 0x00, 0x11, 0x22, 0x33 }, + Ip_ip = "10.0.0.254", + Mask_ip = "255.255.255.0", + UseNat_bool = true, + Mtu_u32 = 1200, + NatTcpTimeout_u32 = 100, + NatUdpTimeout_u32 = 50, + UseDhcp_bool = true, + DhcpLeaseIPStart_ip = "10.0.0.101", + DhcpLeaseIPEnd_ip = "10.0.0.199", + DhcpSubnetMask_ip = "255.255.255.0", + DhcpExpireTimeSpan_u32 = 3600, + DhcpGatewayAddress_ip = "10.0.0.254", + DhcpDnsServerAddress_ip = "10.0.0.254", + DhcpDnsServerAddress2_ip = "8.8.8.8", + DhcpDomainName_str = "lab.coe.ad.jp", + SaveLog_bool = true, + ApplyDhcpPushRoutes_bool = false, + DhcpPushRoutes_str = "", + }; + VpnVhOption out_vh_option = api.SetSecureNATOption(in_vh_option); + + print_object(out_vh_option); + + Console.WriteLine("End: Test_SetSecureNATOption"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetSecureNATOption', Get SecureNAT options + /// + public void Test_GetSecureNATOption() + { + Console.WriteLine("Begin: Test_GetSecureNATOption"); + + VpnVhOption in_vh_option = new VpnVhOption() + { + RpcHubName_str = hub_name, + }; + VpnVhOption out_vh_option = api.GetSecureNATOption(in_vh_option); + + print_object(out_vh_option); + + Console.WriteLine("End: Test_GetSecureNATOption"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumNAT', Enumerate NAT entries of the SecureNAT + /// + public void Test_EnumNAT() + { + Console.WriteLine("Begin: Test_EnumNAT"); + + VpnRpcEnumNat in_rpc_enum_nat = new VpnRpcEnumNat() + { + HubName_str = hub_name, + }; + VpnRpcEnumNat out_rpc_enum_nat = api.EnumNAT(in_rpc_enum_nat); + + print_object(out_rpc_enum_nat); + + Console.WriteLine("End: Test_EnumNAT"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumDHCP', Enumerate DHCP entries + /// + public void Test_EnumDHCP() + { + Console.WriteLine("Begin: Test_EnumDHCP"); + + VpnRpcEnumDhcp in_rpc_enum_dhcp = new VpnRpcEnumDhcp() + { + HubName_str = hub_name, + }; + VpnRpcEnumDhcp out_rpc_enum_dhcp = api.EnumDHCP(in_rpc_enum_dhcp); + + print_object(out_rpc_enum_dhcp); + + Console.WriteLine("End: Test_EnumDHCP"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetSecureNATStatus', Get status of the SecureNAT + /// + public void Test_GetSecureNATStatus() + { + Console.WriteLine("Begin: Test_GetSecureNATStatus"); + + VpnRpcNatStatus in_rpc_nat_status = new VpnRpcNatStatus() + { + HubName_str = hub_name, + }; + VpnRpcNatStatus out_rpc_nat_status = api.GetSecureNATStatus(in_rpc_nat_status); + + print_object(out_rpc_nat_status); + + Console.WriteLine("End: Test_GetSecureNATStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumEthernet', Enumerate Ethernet devices + /// + public void Test_EnumEthernet() + { + Console.WriteLine("Begin: Test_EnumEthernet"); + + VpnRpcEnumEth out_rpc_enum_eth = api.EnumEthernet(); + + print_object(out_rpc_enum_eth); + + Console.WriteLine("End: Test_EnumEthernet"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddLocalBridge', Add a new local bridge + /// + public void Test_AddLocalBridge() + { + Console.WriteLine("Begin: Test_AddLocalBridge"); + + VpnRpcLocalBridge in_rpc_localbridge = new VpnRpcLocalBridge() + { + DeviceName_str = "Intel(R) Ethernet Connection (2) I219-V (ID=3632031273)", + HubNameLB_str = hub_name, + }; + VpnRpcLocalBridge out_rpc_localbridge = api.AddLocalBridge(in_rpc_localbridge); + + print_object(out_rpc_localbridge); + + Console.WriteLine("End: Test_AddLocalBridge"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteLocalBridge', Delete a local bridge + /// + public void Test_DeleteLocalBridge() + { + Console.WriteLine("Begin: Test_DeleteLocalBridge"); + + VpnRpcLocalBridge in_rpc_localbridge = new VpnRpcLocalBridge() + { + DeviceName_str = "Intel(R) Ethernet Connection (2) I219-V (ID=3632031273)", + HubNameLB_str = hub_name, + }; + VpnRpcLocalBridge out_rpc_localbridge = api.DeleteLocalBridge(in_rpc_localbridge); + + print_object(out_rpc_localbridge); + + Console.WriteLine("End: Test_DeleteLocalBridge"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumLocalBridge', Enumerate local bridges + /// + public void Test_EnumLocalBridge() + { + Console.WriteLine("Begin: Test_EnumLocalBridge"); + + VpnRpcEnumLocalBridge out_rpc_enum_localbridge = api.EnumLocalBridge(); + + print_object(out_rpc_enum_localbridge); + + Console.WriteLine("End: Test_EnumLocalBridge"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetBridgeSupport', Get availability to localbridge function + /// + public void Test_GetBridgeSupport() + { + Console.WriteLine("Begin: Test_GetBridgeSupport"); + + VpnRpcBridgeSupport out_rpc_bridge_support = api.GetBridgeSupport(); + + print_object(out_rpc_bridge_support); + + Console.WriteLine("End: Test_GetBridgeSupport"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'RebootServer', Reboot server itself + /// + public void Test_RebootServer() + { + Console.WriteLine("Begin: Test_RebootServer"); + + VpnRpcTest in_rpc_test = new VpnRpcTest() + { + }; + VpnRpcTest out_rpc_test = api.RebootServer(in_rpc_test); + + print_object(out_rpc_test); + + Console.WriteLine("End: Test_RebootServer"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetCaps', Get capabilities + /// + public void Test_GetCaps() + { + Console.WriteLine("Begin: Test_GetCaps"); + + VpnCapslist out_capslist = api.GetCaps(); + + print_object(out_capslist); + + Console.WriteLine("End: Test_GetCaps"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetConfig', Get configuration file stream + /// + public void Test_GetConfig() + { + Console.WriteLine("Begin: Test_GetConfig"); + + VpnRpcConfig out_rpc_config = api.GetConfig(); + + print_object(out_rpc_config); + + Console.WriteLine("End: Test_GetConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetConfig', Overwrite configuration file by specified data + /// + public void Test_SetConfig() + { + Console.WriteLine("Begin: Test_SetConfig"); + + VpnRpcConfig in_rpc_config = new VpnRpcConfig() + { + FileData_bin = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, }, + }; + VpnRpcConfig out_rpc_config = api.SetConfig(in_rpc_config); + + Console.WriteLine("End: Test_SetConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetDefaultHubAdminOptions', Get default hub administration options + /// + public void Test_GetDefaultHubAdminOptions() + { + Console.WriteLine("Begin: Test_GetDefaultHubAdminOptions"); + + VpnRpcAdminOption in_rpc_admin_option = new VpnRpcAdminOption() + { + HubName_str = hub_name, + }; + VpnRpcAdminOption out_rpc_admin_option = api.GetDefaultHubAdminOptions(in_rpc_admin_option); + + print_object(out_rpc_admin_option); + + Console.WriteLine("End: Test_GetDefaultHubAdminOptions"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubAdminOptions', Get hub administration options + /// + public void Test_GetHubAdminOptions() + { + Console.WriteLine("Begin: Test_GetHubAdminOptions"); + + VpnRpcAdminOption in_rpc_admin_option = new VpnRpcAdminOption() + { + HubName_str = hub_name, + }; + VpnRpcAdminOption out_rpc_admin_option = api.GetHubAdminOptions(in_rpc_admin_option); + + print_object(out_rpc_admin_option); + + Console.WriteLine("End: Test_GetHubAdminOptions"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubAdminOptions', Set hub administration options + /// + public void Test_SetHubAdminOptions() + { + Console.WriteLine("Begin: Test_SetHubAdminOptions"); + + VpnRpcAdminOption in_rpc_admin_option = new VpnRpcAdminOption() + { + HubName_str = hub_name, + AdminOptionList = new VpnAdminOption[] + { + new VpnAdminOption() + { + Name_str = "no_securenat_enablenat", + Value_u32 = 1, + } + } + }; + VpnRpcAdminOption out_rpc_admin_option = api.SetHubAdminOptions(in_rpc_admin_option); + + print_object(out_rpc_admin_option); + + Console.WriteLine("End: Test_SetHubAdminOptions"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubExtOptions', Get hub extended options + /// + public void Test_GetHubExtOptions() + { + Console.WriteLine("Begin: Test_GetHubExtOptions"); + + VpnRpcAdminOption in_rpc_admin_option = new VpnRpcAdminOption() + { + HubName_str = hub_name, + }; + VpnRpcAdminOption out_rpc_admin_option = api.GetHubExtOptions(in_rpc_admin_option); + + print_object(out_rpc_admin_option); + + Console.WriteLine("End: Test_GetHubExtOptions"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubExtOptions', Set hub extended options + /// + public void Test_SetHubExtOptions() + { + Console.WriteLine("Begin: Test_SetHubExtOptions"); + + VpnRpcAdminOption in_rpc_admin_option = new VpnRpcAdminOption() + { + HubName_str = hub_name, + AdminOptionList = new VpnAdminOption[] + { + new VpnAdminOption() + { + Name_str = "SecureNAT_RandomizeAssignIp", + Value_u32 = 1, + } + } + }; + VpnRpcAdminOption out_rpc_admin_option = api.SetHubExtOptions(in_rpc_admin_option); + + print_object(out_rpc_admin_option); + + Console.WriteLine("End: Test_SetHubExtOptions"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddL3Switch', Add a new virtual layer-3 switch + /// + public void Test_AddL3Switch() + { + Console.WriteLine("Begin: Test_AddL3Switch"); + + VpnRpcL3Sw in_rpc_l3sw = new VpnRpcL3Sw() + { + Name_str = "L3SW1", + }; + VpnRpcL3Sw out_rpc_l3sw = api.AddL3Switch(in_rpc_l3sw); + + print_object(out_rpc_l3sw); + + Console.WriteLine("End: Test_AddL3Switch"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DelL3Switch', Delete a virtual layer-3 switch + /// + public void Test_DelL3Switch() + { + Console.WriteLine("Begin: Test_DelL3Switch"); + + VpnRpcL3Sw in_rpc_l3sw = new VpnRpcL3Sw() + { + Name_str = "L3SW1", + }; + VpnRpcL3Sw out_rpc_l3sw = api.DelL3Switch(in_rpc_l3sw); + + print_object(out_rpc_l3sw); + + Console.WriteLine("End: Test_DelL3Switch"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumL3Switch', Enumerate virtual layer-3 switches + /// + public void Test_EnumL3Switch() + { + Console.WriteLine("Begin: Test_EnumL3Switch"); + + VpnRpcEnumL3Sw out_rpc_enum_l3sw = api.EnumL3Switch(); + + print_object(out_rpc_enum_l3sw); + + Console.WriteLine("End: Test_EnumL3Switch"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'StartL3Switch', Start a virtual layer-3 switch + /// + public void Test_StartL3Switch() + { + Console.WriteLine("Begin: Test_StartL3Switch"); + + VpnRpcL3Sw in_rpc_l3sw = new VpnRpcL3Sw() + { + Name_str = "L3SW1", + }; + VpnRpcL3Sw out_rpc_l3sw = api.StartL3Switch(in_rpc_l3sw); + + print_object(out_rpc_l3sw); + + Console.WriteLine("End: Test_StartL3Switch"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'StopL3Switch', Stop a virtual layer-3 switch + /// + public void Test_StopL3Switch() + { + Console.WriteLine("Begin: Test_StopL3Switch"); + + VpnRpcL3Sw in_rpc_l3sw = new VpnRpcL3Sw() + { + Name_str = "L3SW1", + }; + VpnRpcL3Sw out_rpc_l3sw = api.StopL3Switch(in_rpc_l3sw); + + print_object(out_rpc_l3sw); + + Console.WriteLine("End: Test_StopL3Switch"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddL3If', Add new virtual interface on virtual L3 switch + /// + public void Test_AddL3If() + { + Console.WriteLine("Begin: Test_AddL3If"); + + VpnRpcL3If in_rpc_l3if = new VpnRpcL3If() + { + Name_str = "L3SW1", + HubName_str = hub_name, + IpAddress_ip = "192.168.0.1", + SubnetMask_ip = "255.255.255.0", + }; + VpnRpcL3If out_rpc_l3if = api.AddL3If(in_rpc_l3if); + + print_object(out_rpc_l3if); + + Console.WriteLine("End: Test_AddL3If"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DelL3If', Delete a virtual interface on virtual L3 switch + /// + public void Test_DelL3If() + { + Console.WriteLine("Begin: Test_DelL3If"); + + VpnRpcL3If in_rpc_l3if = new VpnRpcL3If() + { + Name_str = "L3SW1", + HubName_str = hub_name, + }; + VpnRpcL3If out_rpc_l3if = api.DelL3If(in_rpc_l3if); + + print_object(out_rpc_l3if); + + Console.WriteLine("End: Test_DelL3If"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumL3If', Enumerate virtual interfaces on virtual L3 switch + /// + public void Test_EnumL3If() + { + Console.WriteLine("Begin: Test_EnumL3If"); + + VpnRpcEnumL3If in_rpc_enum_l3if = new VpnRpcEnumL3If() + { + Name_str = "L3SW1", + }; + VpnRpcEnumL3If out_rpc_enum_l3if = api.EnumL3If(in_rpc_enum_l3if); + + print_object(out_rpc_enum_l3if); + + Console.WriteLine("End: Test_EnumL3If"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddL3Table', Add new routing table entry on virtual L3 switch + /// + public void Test_AddL3Table() + { + Console.WriteLine("Begin: Test_AddL3Table"); + + VpnRpcL3Table in_rpc_l3table = new VpnRpcL3Table() + { + Name_str = "L3SW1", + NetworkAddress_ip = "10.0.0.0", + SubnetMask_ip = "255.0.0.0", + GatewayAddress_ip = "192.168.7.1", + Metric_u32 = 10, + }; + VpnRpcL3Table out_rpc_l3table = api.AddL3Table(in_rpc_l3table); + + print_object(out_rpc_l3table); + + Console.WriteLine("End: Test_AddL3Table"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DelL3Table', Delete routing table entry on virtual L3 switch + /// + public void Test_DelL3Table() + { + Console.WriteLine("Begin: Test_DelL3Table"); + + VpnRpcL3Table in_rpc_l3table = new VpnRpcL3Table() + { + Name_str = "L3SW1", + NetworkAddress_ip = "10.0.0.0", + SubnetMask_ip = "255.0.0.0", + GatewayAddress_ip = "192.168.7.1", + Metric_u32 = 10, + }; + VpnRpcL3Table out_rpc_l3table = api.DelL3Table(in_rpc_l3table); + + print_object(out_rpc_l3table); + + Console.WriteLine("End: Test_DelL3Table"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumL3Table', Get routing table on virtual L3 switch + /// + public void Test_EnumL3Table() + { + Console.WriteLine("Begin: Test_EnumL3Table"); + + VpnRpcEnumL3Table in_rpc_enum_l3table = new VpnRpcEnumL3Table() + { + Name_str = "L3SW1", + }; + VpnRpcEnumL3Table out_rpc_enum_l3table = api.EnumL3Table(in_rpc_enum_l3table); + + print_object(out_rpc_enum_l3table); + + Console.WriteLine("End: Test_EnumL3Table"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumCrl', Get CRL (Certificate Revocation List) index + /// + public VpnRpcEnumCrl Test_EnumCrl() + { + Console.WriteLine("Begin: Test_EnumCrl"); + + VpnRpcEnumCrl in_rpc_enum_crl = new VpnRpcEnumCrl() + { + HubName_str = hub_name, + }; + VpnRpcEnumCrl out_rpc_enum_crl = api.EnumCrl(in_rpc_enum_crl); + + print_object(out_rpc_enum_crl); + + Console.WriteLine("End: Test_EnumCrl"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_crl; + } + + /// + /// API test for 'AddCrl', Add new CRL (Certificate Revocation List) entry + /// + public void Test_AddCrl() + { + Console.WriteLine("Begin: Test_AddCrl"); + + VpnRpcCrl in_rpc_crl = new VpnRpcCrl() + { + HubName_str = hub_name, + CommonName_utf = "CN", + Organization_utf = "Org", + Unit_utf = "ICSCOE", + Country_utf = "JP", + State_utf = "Ibaraki", + Local_utf = "Tsukuba", + Serial_bin = new byte[] { 1, 2, 3, 4, 5 }, + DigestMD5_bin = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + DigestSHA1_bin = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }, + }; + VpnRpcCrl out_rpc_crl = api.AddCrl(in_rpc_crl); + + print_object(out_rpc_crl); + + Console.WriteLine("End: Test_AddCrl"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DelCrl', Delete CRL (Certificate Revocation List) entry + /// + public void Test_DelCrl(uint key) + { + Console.WriteLine("Begin: Test_DelCrl"); + + VpnRpcCrl in_rpc_crl = new VpnRpcCrl() + { + HubName_str = hub_name, + Key_u32 = key, + }; + VpnRpcCrl out_rpc_crl = api.DelCrl(in_rpc_crl); + + print_object(out_rpc_crl); + + Console.WriteLine("End: Test_DelCrl"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetCrl', Get CRL (Certificate Revocation List) entry + /// + public VpnRpcCrl Test_GetCrl(uint key) + { + Console.WriteLine("Begin: Test_GetCrl"); + + VpnRpcCrl in_rpc_crl = new VpnRpcCrl() + { + HubName_str = hub_name, + Key_u32 = key, + }; + VpnRpcCrl out_rpc_crl = api.GetCrl(in_rpc_crl); + + print_object(out_rpc_crl); + + Console.WriteLine("End: Test_GetCrl"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_crl; + } + + /// + /// API test for 'SetCrl', Set CRL (Certificate Revocation List) entry + /// + public void Test_SetCrl(VpnRpcCrl crl) + { + Console.WriteLine("Begin: Test_SetCrl"); + + VpnRpcCrl out_rpc_crl = api.SetCrl(crl); + + print_object(out_rpc_crl); + + Console.WriteLine("End: Test_SetCrl"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetAcList', Set access control list + /// + public void Test_SetAcList() + { + Console.WriteLine("Begin: Test_SetAcList"); + + VpnRpcAcList in_rpc_ac_list = new VpnRpcAcList() + { + HubName_str = hub_name, + + ACList = new VpnAc[] + { + new VpnAc() + { + Deny_bool = true, + IpAddress_ip = "192.168.0.0", + SubnetMask_ip = "255.255.0.0", + Masked_bool = true, + Priority_u32 = 123, + }, + new VpnAc() + { + Deny_bool = false, + IpAddress_ip = "fe80::", + SubnetMask_ip = "8", + Masked_bool = true, + Priority_u32 = 123, + }, + } + }; + VpnRpcAcList out_rpc_ac_list = api.SetAcList(in_rpc_ac_list); + + print_object(out_rpc_ac_list); + + Console.WriteLine("End: Test_SetAcList"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetAcList', Get access control list + /// + public void Test_GetAcList() + { + Console.WriteLine("Begin: Test_GetAcList"); + + VpnRpcAcList in_rpc_ac_list = new VpnRpcAcList() + { + HubName_str = hub_name, + }; + VpnRpcAcList out_rpc_ac_list = api.GetAcList(in_rpc_ac_list); + + print_object(out_rpc_ac_list); + + Console.WriteLine("End: Test_GetAcList"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumLogFile', Enumerate log files + /// + public VpnRpcEnumLogFile Test_EnumLogFile() + { + Console.WriteLine("Begin: Test_EnumLogFile"); + + VpnRpcEnumLogFile out_rpc_enum_log_file = api.EnumLogFile(); + + print_object(out_rpc_enum_log_file); + + Console.WriteLine("End: Test_EnumLogFile"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_log_file; + } + + /// + /// API test for 'ReadLogFile', Read a log file + /// + public void Test_ReadLogFile(string filename) + { + Console.WriteLine("Begin: Test_ReadLogFile"); + + VpnRpcReadLogFile in_rpc_read_log_file = new VpnRpcReadLogFile() + { + FilePath_str = filename, + }; + VpnRpcReadLogFile out_rpc_read_log_file = api.ReadLogFile(in_rpc_read_log_file); + + print_object(out_rpc_read_log_file); + + Console.WriteLine("End: Test_ReadLogFile"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetSysLog', Set syslog function setting + /// + public void Test_SetSysLog(bool flag) + { + Console.WriteLine("Begin: Test_SetSysLog"); + + VpnSyslogSetting in_syslog_setting = new VpnSyslogSetting() + { + SaveType_u32 = flag ? VpnSyslogSaveType.ServerAndHubAllLog : VpnSyslogSaveType.None, + Hostname_str = "1.2.3.4", + Port_u32 = 123, + }; + VpnSyslogSetting out_syslog_setting = api.SetSysLog(in_syslog_setting); + + print_object(out_syslog_setting); + + Console.WriteLine("End: Test_SetSysLog"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetSysLog', Get syslog function setting + /// + public void Test_GetSysLog() + { + Console.WriteLine("Begin: Test_GetSysLog"); + + VpnSyslogSetting in_syslog_setting = new VpnSyslogSetting() + { + }; + VpnSyslogSetting out_syslog_setting = api.GetSysLog(in_syslog_setting); + + print_object(out_syslog_setting); + + Console.WriteLine("End: Test_GetSysLog"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetHubMsg', Set message of today on hub + /// + public void Test_SetHubMsg() + { + Console.WriteLine("Begin: Test_SetHubMsg"); + + VpnRpcMsg in_rpc_msg = new VpnRpcMsg() + { + HubName_str = hub_name, + Msg_bin = new byte[] + { +0x57,0x6f,0x72,0x6b,0x69,0x6e,0x67,0x20,0x4d,0x65,0x6e,0x20,0x6f,0x66,0x20,0x41, +0x6c,0x6c,0x20,0x43,0x6f,0x75,0x6e,0x74,0x72,0x69,0x65,0x73,0x2c,0x20,0x55,0x6e, +0x69,0x74,0x65,0x21,0x20,0xe4,0xb8,0x87,0xe5,0x9b,0xbd,0xe3,0x81,0xae,0xe5,0x8a, +0xb4,0xe5,0x83,0x8d,0xe8,0x80,0x85,0xe3,0x82,0x88,0xe3,0x80,0x81,0xe5,0x9b,0xa3, +0xe7,0xb5,0x90,0xe3,0x81,0x9b,0xe3,0x82,0x88,0x21,0x20,0xd7,0x92,0xd7,0x91,0xd7, +0xa8,0xd7,0x99,0xd7,0x9d,0x20,0xd7,0xa2,0xd7,0x95,0xd7,0x91,0xd7,0x93,0xd7,0x99, +0xd7,0x9d,0x20,0xd7,0xa9,0xd7,0x9c,0x20,0xd7,0x9b,0xd7,0x9c,0x20,0xd7,0x94,0xd7, +0x9e,0xd7,0x93,0xd7,0x99,0xd7,0xa0,0xd7,0x95,0xd7,0xaa,0x2c,0x20,0xd7,0x94,0xd7, +0xaa,0xd7,0x90,0xd7,0x97,0xd7,0x93,0xd7,0x95,0x21 + }, + }; + VpnRpcMsg out_rpc_msg = api.SetHubMsg(in_rpc_msg); + + print_object(out_rpc_msg); + + Console.WriteLine("End: Test_SetHubMsg"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetHubMsg', Get message of today on hub + /// + public void Test_GetHubMsg() + { + Console.WriteLine("Begin: Test_GetHubMsg"); + + VpnRpcMsg in_rpc_msg = new VpnRpcMsg() + { + HubName_str = hub_name, + }; + VpnRpcMsg out_rpc_msg = api.GetHubMsg(in_rpc_msg); + + print_object(out_rpc_msg); + + Console.WriteLine("End: Test_GetHubMsg"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'Crash', Do Crash + /// + public void Test_Crash() + { + Console.WriteLine("Begin: Test_Crash"); + + VpnRpcTest in_rpc_test = new VpnRpcTest() + { + }; + VpnRpcTest out_rpc_test = api.Crash(in_rpc_test); + + print_object(out_rpc_test); + + Console.WriteLine("End: Test_Crash"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetAdminMsg', Get message for administrators + /// + public void Test_GetAdminMsg() + { + Console.WriteLine("Begin: Test_GetAdminMsg"); + + VpnRpcMsg out_rpc_msg = api.GetAdminMsg(); + + print_object(out_rpc_msg); + + Console.WriteLine("End: Test_GetAdminMsg"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'Flush', Flush configuration file + /// + public void Test_Flush() + { + Console.WriteLine("Begin: Test_Flush"); + + VpnRpcTest in_rpc_test = new VpnRpcTest() + { + }; + VpnRpcTest out_rpc_test = api.Flush(in_rpc_test); + + print_object(out_rpc_test); + + Console.WriteLine("End: Test_Flush"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetIPsecServices', Set IPsec service configuration + /// + public void Test_SetIPsecServices() + { + Console.WriteLine("Begin: Test_SetIPsecServices"); + + VpnIPsecServices in_ipsec_services = new VpnIPsecServices() + { + L2TP_Raw_bool = false, + L2TP_IPsec_bool = false, + EtherIP_IPsec_bool = false, + IPsec_Secret_str = "vpn", + L2TP_DefaultHub_str = "HUB_ABC", + }; + VpnIPsecServices out_ipsec_services = api.SetIPsecServices(in_ipsec_services); + + print_object(out_ipsec_services); + + Console.WriteLine("End: Test_SetIPsecServices"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetIPsecServices', Get IPsec service configuration + /// + public void Test_GetIPsecServices() + { + Console.WriteLine("Begin: Test_GetIPsecServices"); + + VpnIPsecServices out_ipsec_services = api.GetIPsecServices(); + + print_object(out_ipsec_services); + + Console.WriteLine("End: Test_GetIPsecServices"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'AddEtherIpId', Add EtherIP ID setting + /// + public void Test_AddEtherIpId() + { + Console.WriteLine("Begin: Test_AddEtherIpId"); + + VpnEtherIpId in_etherip_id = new VpnEtherIpId() + { + Id_str = "testid", + HubName_str = hub_name, + UserName_str = "nekosan", + Password_str = "torisan", + }; + VpnEtherIpId out_etherip_id = api.AddEtherIpId(in_etherip_id); + + print_object(out_etherip_id); + + Console.WriteLine("End: Test_AddEtherIpId"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetEtherIpId', Get EtherIP ID setting + /// + public void Test_GetEtherIpId(string id) + { + Console.WriteLine("Begin: Test_GetEtherIpId"); + + VpnEtherIpId in_etherip_id = new VpnEtherIpId() + { + Id_str = id, + }; + VpnEtherIpId out_etherip_id = api.GetEtherIpId(in_etherip_id); + + print_object(out_etherip_id); + + Console.WriteLine("End: Test_GetEtherIpId"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'DeleteEtherIpId', Delete EtherIP ID setting + /// + public void Test_DeleteEtherIpId(string id) + { + Console.WriteLine("Begin: Test_DeleteEtherIpId"); + + VpnEtherIpId in_etherip_id = new VpnEtherIpId() + { + Id_str = id, + }; + VpnEtherIpId out_etherip_id = api.DeleteEtherIpId(in_etherip_id); + + print_object(out_etherip_id); + + Console.WriteLine("End: Test_DeleteEtherIpId"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'EnumEtherIpId', Enumerate EtherIP ID settings + /// + public VpnRpcEnumEtherIpId Test_EnumEtherIpId() + { + Console.WriteLine("Begin: Test_EnumEtherIpId"); + + VpnRpcEnumEtherIpId out_rpc_enum_etherip_id = api.EnumEtherIpId(); + + print_object(out_rpc_enum_etherip_id); + + Console.WriteLine("End: Test_EnumEtherIpId"); + Console.WriteLine("-----"); + Console.WriteLine(); + + return out_rpc_enum_etherip_id; + } + + /// + /// API test for 'SetOpenVpnSstpConfig', Set configurations for OpenVPN and SSTP + /// + public void Test_SetOpenVpnSstpConfig() + { + Console.WriteLine("Begin: Test_SetOpenVpnSstpConfig"); + + VpnOpenVpnSstpConfig in_openvpn_sstp_config = new VpnOpenVpnSstpConfig() + { + EnableOpenVPN_bool = true, + OpenVPNPortList_str = "1 2 3 4 5", + EnableSSTP_bool = true, + }; + VpnOpenVpnSstpConfig out_openvpn_sstp_config = api.SetOpenVpnSstpConfig(in_openvpn_sstp_config); + + print_object(out_openvpn_sstp_config); + + Console.WriteLine("End: Test_SetOpenVpnSstpConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetOpenVpnSstpConfig', Get configurations for OpenVPN and SSTP + /// + public void Test_GetOpenVpnSstpConfig() + { + Console.WriteLine("Begin: Test_GetOpenVpnSstpConfig"); + + VpnOpenVpnSstpConfig out_openvpn_sstp_config = api.GetOpenVpnSstpConfig(); + + print_object(out_openvpn_sstp_config); + + Console.WriteLine("End: Test_GetOpenVpnSstpConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetDDnsClientStatus', Get status of DDNS client + /// + public void Test_GetDDnsClientStatus() + { + Console.WriteLine("Begin: Test_GetDDnsClientStatus"); + + VpnDDnsClientStatus out_ddns_client_status = api.GetDDnsClientStatus(); + + print_object(out_ddns_client_status); + + Console.WriteLine("End: Test_GetDDnsClientStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'ChangeDDnsClientHostname', Change host-name for DDNS client + /// + public void Test_ChangeDDnsClientHostname() + { + Console.WriteLine("Begin: Test_ChangeDDnsClientHostname"); + + VpnRpcTest in_rpc_test = new VpnRpcTest() + { + StrValue_str = "nekotest" + rand.Next(1000000000, 2100000000), + }; + VpnRpcTest out_rpc_test = api.ChangeDDnsClientHostname(in_rpc_test); + + print_object(out_rpc_test); + + Console.WriteLine("End: Test_ChangeDDnsClientHostname"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'RegenerateServerCert', Regenerate server certification + /// + public void Test_RegenerateServerCert() + { + Console.WriteLine("Begin: Test_RegenerateServerCert"); + + VpnRpcTest in_rpc_test = new VpnRpcTest() + { + StrValue_str = "abc.example.org", + }; + + VpnRpcTest out_rpc_test = api.RegenerateServerCert(in_rpc_test); + + print_object(out_rpc_test); + + Console.WriteLine("End: Test_RegenerateServerCert"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'MakeOpenVpnConfigFile', Generate OpenVPN configuration files + /// + public void Test_MakeOpenVpnConfigFile() + { + Console.WriteLine("Begin: Test_MakeOpenVpnConfigFile"); + + VpnRpcReadLogFile out_rpc_read_log_file = api.MakeOpenVpnConfigFile(); + + print_object(out_rpc_read_log_file); + + Console.WriteLine("End: Test_MakeOpenVpnConfigFile"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetSpecialListener', Set special listener status + /// + public void Test_SetSpecialListener() + { + Console.WriteLine("Begin: Test_SetSpecialListener"); + + VpnRpcSpecialListener in_rpc_special_listener = new VpnRpcSpecialListener() + { + VpnOverDnsListener_bool = true, + VpnOverIcmpListener_bool = true, + }; + VpnRpcSpecialListener out_rpc_special_listener = api.SetSpecialListener(in_rpc_special_listener); + + print_object(out_rpc_special_listener); + + Console.WriteLine("End: Test_SetSpecialListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetSpecialListener', Get special listener status + /// + public void Test_GetSpecialListener() + { + Console.WriteLine("Begin: Test_GetSpecialListener"); + + VpnRpcSpecialListener out_rpc_special_listener = api.GetSpecialListener(); + + print_object(out_rpc_special_listener); + + Console.WriteLine("End: Test_GetSpecialListener"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetAzureStatus', Get Azure status + /// + public void Test_GetAzureStatus() + { + Console.WriteLine("Begin: Test_GetAzureStatus"); + + VpnRpcAzureStatus out_rpc_azure_status = api.GetAzureStatus(); + + print_object(out_rpc_azure_status); + + Console.WriteLine("End: Test_GetAzureStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetAzureStatus', Set Azure status + /// + public void Test_SetAzureStatus() + { + Console.WriteLine("Begin: Test_SetAzureStatus"); + + VpnRpcAzureStatus in_rpc_azure_status = new VpnRpcAzureStatus() + { + IsEnabled_bool = true, + }; + VpnRpcAzureStatus out_rpc_azure_status = api.SetAzureStatus(in_rpc_azure_status); + + print_object(out_rpc_azure_status); + + Console.WriteLine("End: Test_SetAzureStatus"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetDDnsInternetSettng', Get DDNS proxy configuration + /// + public void Test_GetDDnsInternetSettng() + { + Console.WriteLine("Begin: Test_GetDDnsInternetSettng"); + + VpnInternetSetting out_internet_setting = api.GetDDnsInternetSettng(); + + print_object(out_internet_setting); + + Console.WriteLine("End: Test_GetDDnsInternetSettng"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetDDnsInternetSettng', Set DDNS proxy configuration + /// + public void Test_SetDDnsInternetSettng() + { + Console.WriteLine("Begin: Test_SetDDnsInternetSettng"); + + VpnInternetSetting in_internet_setting = new VpnInternetSetting() + { + ProxyType_u32 = VpnRpcProxyType.Direct, + ProxyHostName_str = "1.2.3.4", + ProxyPort_u32 = 1234, + ProxyUsername_str = "neko", + ProxyPassword_str = "dog", + }; + VpnInternetSetting out_internet_setting = api.SetDDnsInternetSettng(in_internet_setting); + + print_object(out_internet_setting); + + Console.WriteLine("End: Test_SetDDnsInternetSettng"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'SetVgsConfig', Setting VPN Gate Server Configuration + /// + public void Test_SetVgsConfig() + { + Console.WriteLine("Begin: Test_SetVgsConfig"); + + VpnVgsConfig in_vgs_config = new VpnVgsConfig() + { + IsEnabled_bool = false, + Message_utf = "Neko san!!!", + Owner_utf = "Go go go!!!", + Abuse_utf = "da.test@softether.co.jp", + NoLog_bool = false, + LogPermanent_bool = true, + EnableL2TP_bool = true, + }; + VpnVgsConfig out_vgs_config = api.SetVgsConfig(in_vgs_config); + + print_object(out_vgs_config); + + Console.WriteLine("End: Test_SetVgsConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + /// + /// API test for 'GetVgsConfig', Get VPN Gate configuration + /// + public void Test_GetVgsConfig() + { + Console.WriteLine("Begin: Test_GetVgsConfig"); + + VpnVgsConfig out_vgs_config = api.GetVgsConfig(); + + print_object(out_vgs_config); + + Console.WriteLine("End: Test_GetVgsConfig"); + Console.WriteLine("-----"); + Console.WriteLine(); + } + + + void print_object(object obj) + { + var setting = new Newtonsoft.Json.JsonSerializerSettings() + { + NullValueHandling = Newtonsoft.Json.NullValueHandling.Include, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Error, + }; + string str = Newtonsoft.Json.JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented, setting); + Console.WriteLine(str); + } +} diff --git a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj new file mode 100644 index 00000000..8dd4a3cb --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj @@ -0,0 +1,35 @@ + + + + Exe + netcoreapp2.1 + VPNServer_JSONRPC_CodeGen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln new file mode 100644 index 00000000..fbd0f7ec --- /dev/null +++ b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2041 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vpnserver-jsonrpc-codegen", "vpnserver-jsonrpc-codegen.csproj", "{00B41CF0-7AE9-4542-9970-77B312412535}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00B41CF0-7AE9-4542-9970-77B312412535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00B41CF0-7AE9-4542-9970-77B312412535}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00B41CF0-7AE9-4542-9970-77B312412535}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00B41CF0-7AE9-4542-9970-77B312412535}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EBB5B5A2-21A9-42A1-B4F4-7ED92CD8BBC1} + EndGlobalSection +EndGlobal