2using System.Collections.Generic;
6using System.Net.Security;
7using System.Security.Cryptography.X509Certificates;
10using System.Threading.Tasks;
53 public partial class XmppConfiguration : SystemMultiStepConfiguration,
IHostReference
55 private static XmppConfiguration instance =
null;
56 private static string defaultFacility =
string.Empty;
57 private static string defaultFacilityKey =
string.Empty;
63 private string host =
string.Empty;
65 private string boshUrl =
string.Empty;
66 private string wsUrl =
string.Empty;
67 private string account =
string.Empty;
68 private string accountHumanReadableName =
string.Empty;
69 private string password =
string.Empty;
70 private string password0 =
string.Empty;
71 private string passwordType =
string.Empty;
72 private string thingRegistry =
string.Empty;
73 private string provisioning =
string.Empty;
74 private string events =
string.Empty;
75 private string muc =
string.Empty;
76 private string pubSub =
string.Empty;
77 private string legal =
string.Empty;
78 private string software =
string.Empty;
79 private string bareJid =
string.Empty;
80 private bool sniffer =
false;
81 private bool trustServer =
false;
82 private bool allowInsecureMechanisms =
false;
83 private bool storePasswordInsteadOfHash =
false;
84 private bool customBinding =
false;
85 private bool offlineMessages =
false;
86 private bool blocking =
false;
87 private bool reporting =
false;
88 private bool abuse =
false;
89 private bool spam =
false;
90 private bool pep =
false;
91 private bool mail =
false;
93 private TaskCompletionSource<bool> testConnection =
null;
95 private bool createAccount =
false;
108 get => this.transportMethod;
109 set => this.transportMethod = value;
115 [DefaultValueStringEmpty]
119 set => this.host = value;
129 set => this.port = value;
135 [DefaultValueStringEmpty]
139 set => this.boshUrl = value;
145 [DefaultValueStringEmpty]
149 set => this.wsUrl = value;
155 [DefaultValueStringEmpty]
159 set => this.account = value;
165 [DefaultValueStringEmpty]
168 get => this.password;
169 set => this.password = value;
175 [DefaultValueStringEmpty]
178 get => this.passwordType;
179 set => this.passwordType = value;
187 get => this.accountHumanReadableName;
188 set => this.accountHumanReadableName = value;
194 [DefaultValueStringEmpty]
197 get => this.thingRegistry;
198 set => this.thingRegistry = value;
204 [DefaultValueStringEmpty]
207 get => this.provisioning;
208 set => this.provisioning = value;
214 [DefaultValueStringEmpty]
218 set => this.events = value;
224 [DefaultValueStringEmpty]
228 set => this.muc = value;
234 [DefaultValueStringEmpty]
238 set => this.pubSub = value;
244 [DefaultValueStringEmpty]
248 set => this.legal = value;
254 [DefaultValueStringEmpty]
257 get => this.software;
258 set => this.software = value;
264 [DefaultValueStringEmpty]
268 set => this.bareJid = value;
274 [DefaultValue(
false)]
278 set => this.sniffer = value;
284 [DefaultValue(
false)]
287 get => this.trustServer;
288 set => this.trustServer = value;
294 [DefaultValue(
false)]
297 get => this.allowInsecureMechanisms;
298 set => this.allowInsecureMechanisms = value;
304 [DefaultValue(
false)]
307 get => this.storePasswordInsteadOfHash;
308 set => this.storePasswordInsteadOfHash = value;
314 [DefaultValue(
false)]
317 get => this.customBinding;
318 set => this.customBinding = value;
324 [DefaultValue(
false)]
327 get => this.offlineMessages;
328 set => this.offlineMessages = value;
334 [DefaultValue(
false)]
337 get => this.blocking;
338 set => this.blocking = value;
344 [DefaultValue(
false)]
347 get => this.reporting;
348 set => this.reporting = value;
354 [DefaultValue(
false)]
358 set => this.abuse = value;
364 [DefaultValue(
false)]
368 set => this.spam = value;
374 [DefaultValue(
false)]
378 set => this.pep = value;
384 [DefaultValue(
false)]
388 set => this.mail = value;
400 public override string Resource =>
"/Settings/XMPP.md";
422 await
Gateway.ConfigureXmpp(
this);
423 await this.CheckAdminAccount();
441 this.connectToHost = WebServer.
Register(
"/Settings/ConnectToHost",
null, this.ConnectToHost,
true,
false,
true);
442 this.randomizePassword = WebServer.
Register(
"/Settings/RandomizePassword",
null, this.RandomizePassword,
true,
false,
true);
444 return base.InitSetup(WebServer);
456 return base.UnregisterSetup(WebServer);
472 if (!(Obj is Dictionary<string, object> Parameters))
475 if (!Parameters.TryGetValue(
"host", out Obj) || !(Obj is
string HostName))
478 string TabID = Request.
Header[
"X-TabID"];
479 if (
string.IsNullOrEmpty(TabID))
482 if (!Parameters.TryGetValue(
"port", out Obj) || !(Obj is
int Port) || Port < 1 || Port > 65535)
485 if (!Parameters.TryGetValue(
"boshUrl", out Obj) || !(Obj is
string BoshUrl))
488 if (!Parameters.TryGetValue(
"wsUrl", out Obj) || !(Obj is
string WsUrl))
491 if (!Parameters.TryGetValue(
"customBinding", out Obj) || !(Obj is
bool CustomBinding))
494 if (!Parameters.TryGetValue(
"trustServer", out Obj) || !(Obj is
bool TrustServer))
497 if (!Parameters.TryGetValue(
"insecureMechanisms", out Obj) || !(Obj is
bool InsecureMechanisms))
503 if (!Parameters.TryGetValue(
"sniffer", out Obj) || !(Obj is
bool Sniffer))
506 if (!Parameters.TryGetValue(
"transport", out Obj) || !(Obj is
string s2) || !Enum.TryParse(s2, out
XmppTransportMethod Method))
509 if (!Parameters.TryGetValue(
"account", out Obj) || !(Obj is
string Account))
512 if (!Parameters.TryGetValue(
"password", out Obj) || !(Obj is
string Password))
515 if (!Parameters.TryGetValue(
"createAccount", out Obj) || !(Obj is
bool CreateAccount))
518 if (!Parameters.TryGetValue(
"accountName", out Obj) || !(Obj is
string AccountName))
521 this.host = HostName;
524 this.wsUrl = WsUrl.Trim();
527 this.allowInsecureMechanisms = InsecureMechanisms;
530 this.transportMethod = Method;
533 this.accountHumanReadableName = AccountName;
537 this.password = this.password0 =
Password;
538 this.passwordType =
string.Empty;
541 if (!(this.client is
null))
549 Response.StatusCode = 200;
554 Response.StatusCode = 200;
578 AllowEncryption =
true,
579 AllowCramMD5 = this.allowInsecureMechanisms,
580 AllowDigestMD5 = this.allowInsecureMechanisms,
581 AllowPlain = this.allowInsecureMechanisms,
582 AllowRegistration = this.createAccount,
583 AllowScramSHA1 =
true,
584 AllowScramSHA256 =
true,
585 RequestRosterOnStartup =
true
588 if (this.createAccount && clp.TryGetValue(
this.host, out KeyValuePair<string, string> P))
590 Credentials.FormSignatureKey = P.Key;
591 Credentials.FormSignatureSecret = P.Value;
594 switch (this.transportMethod)
597 Credentials.UriEndpoint = this.boshUrl;
601 Credentials.UriEndpoint = this.wsUrl;
608 private void Connect(
string TabID)
611 this.client.
SetTag(
"TabID", TabID);
612 this.client.
SetTag(
"StartedEncryption",
false);
613 this.client.
SetTag(
"EncyptionSuccessful",
false);
614 this.client.
SetTag(
"StartedAuthentication",
false);
627 "XMPP Log %YEAR%-%MONTH%-%DAY%T%HOUR%.xml",
633 this.client.OnStateChanged += this.Client_OnStateChanged;
637 private async Task Client_OnStateChanged(
object Sender,
XmppState NewState)
642 if (!Client.TryGetTag(
"TabID", out
object Obj) || !(Obj is
string TabID))
652 Client.SetTag(
"StartedAuthentication",
true);
653 Client.SetTag(
"EncyptionSuccessful",
true);
656 if (!
string.IsNullOrEmpty(TabID))
658 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ConnectionOK0",
"Connection established.",
false,
"User");
660 if (!(this.client is
null))
667 this.Updated = DateTime.Now;
674 Msg =
"Authenticating user.";
678 Msg =
"Binding to resource.";
682 this.bareJid = Client.BareJID;
683 this.password = Client.PasswordHash;
684 this.passwordType = Client.PasswordHashMethod;
686 if (this.bareJid != defaultFacility)
688 defaultFacility = this.bareJid;
690 if (
string.IsNullOrEmpty(defaultFacilityKey))
711 if (this.createAccount && !
string.IsNullOrEmpty(this.accountHumanReadableName))
713 if (!
string.IsNullOrEmpty(TabID))
716 StringBuilder Xml =
new StringBuilder();
718 Xml.Append(
"<vCard xmlns='vcard-temp'>");
720 Xml.Append(
XML.
Encode(
this.accountHumanReadableName));
722 Xml.Append(
"<JABBERID>");
723 Xml.Append(
XML.
Encode(
this.client.BareJID));
724 Xml.Append(
"</JABBERID>");
725 Xml.Append(
"</vCard>");
727 await Client.IqSetAsync(this.client.
BareJID, Xml.ToString());
730 if (!
string.IsNullOrEmpty(TabID))
731 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking server features.",
false,
"User");
737 this.offlineMessages = e.
HasFeature(
"msgoffline");
738 this.blocking = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceBlocking);
739 this.reporting = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceReporting);
740 this.abuse = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceAbuseReason);
741 this.spam = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceSpamReason);
746 this.offlineMessages =
false;
747 this.blocking =
false;
748 this.reporting =
false;
754 if (!
string.IsNullOrEmpty(TabID))
755 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking account features.",
false,
"User");
757 e = await Client.ServiceDiscoveryAsync(
null, Client.BareJID,
string.Empty);
759 this.pep = e.Ok && this.ContainsIdentity(
"pep",
"pubsub", e);
761 if (!
string.IsNullOrEmpty(TabID))
762 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking server components.",
false,
"User");
766 this.thingRegistry =
string.Empty;
767 this.provisioning =
string.Empty;
768 this.events =
string.Empty;
769 this.muc =
string.Empty;
770 this.pubSub =
string.Empty;
771 this.legal =
string.Empty;
772 this.software =
string.Empty;
778 if (!
string.IsNullOrEmpty(TabID))
781 e = await Client.ServiceDiscoveryAsync(
null,
Item.
JID,
string.Empty);
783 if (e.
HasAnyFeature(Networking.XMPP.Provisioning.ThingRegistryClient.NamespacesDiscovery))
786 if (e.
HasAnyFeature(Networking.XMPP.Provisioning.ProvisioningClient.NamespacesProvisioningDevice))
789 if (e.
HasFeature(Networking.XMPP.MUC.MultiUserChatClient.NamespaceMuc))
792 if (e.
HasFeature(Networking.XMPP.PubSub.PubSubClient.NamespacePubSub) &&
this.ContainsIdentity(
"service",
"pubsub", e))
798 if (e.
HasAnyFeature(Networking.XMPP.Contracts.ContractsClient.NamespacesLegalIdentities))
801 if (e.
HasAnyFeature(Networking.XMPP.Software.SoftwareUpdateClient.NamespacesSoftwareUpdates))
806 Dictionary<string, object> ConnectionInfo =
new Dictionary<string, object>()
808 {
"msg",
"Connection successful." },
809 {
"offlineMsg", this.offlineMessages },
810 {
"blocking", this.blocking },
811 {
"reporting", this.reporting },
812 {
"abuse", this.abuse },
813 {
"spam", this.spam },
814 {
"mail", this.mail },
815 {
"pep", this.pep ? this.bareJid : string.Empty },
816 {
"thingRegistry", this.thingRegistry },
817 {
"provisioning", this.provisioning },
818 {
"eventLog", this.events },
819 {
"pubSub", this.pubSub },
821 {
"legal", this.legal },
822 {
"software", this.software }
825 if (!
string.IsNullOrEmpty(TabID))
828 if (!(this.client is
null))
835 this.Updated = DateTime.Now;
838 this.testConnection?.TrySetResult(
true);
842 Msg =
"Connecting to server.";
851 this.customBinding =
true;
853 if (!
string.IsNullOrEmpty(TabID))
855 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Unable to connect properly. Looking for alternative ways to connect.",
false,
"User");
856 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowCustomProperties",
"{\"visible\":true}",
true,
"User");
859 using (HttpClient HttpClient =
new HttpClient(
new HttpClientHandler()
862 ServerCertificateCustomValidationCallback = this.RemoteCertificateValidationCallback,
865 AutomaticDecompression = (DecompressionMethods)(-1)
868 Timeout = TimeSpan.FromMilliseconds(60000)
873 Uri Uri =
new Uri(
"http://" + this.host +
"/.well-known/host-meta");
874 HttpResponseMessage Response = await HttpClient.GetAsync(Uri);
875 if (!Response.IsSuccessStatusCode)
876 await Content.Getters.WebGetter.ProcessResponse(Response, Uri);
878 Stream Stream = await Response.Content.ReadAsStreamAsync();
879 byte[] Bin = await Response.Content.ReadAsByteArrayAsync();
880 string CharSet = Response.Content.Headers.
ContentType.CharSet;
881 System.Text.Encoding Encoding;
883 if (
string.IsNullOrEmpty(CharSet))
884 Encoding = System.Text.Encoding.UTF8;
889 XmlDocument Doc =
new XmlDocument()
891 PreserveWhitespace =
true
893 Doc.LoadXml(XmlResponse);
895 if (!(Doc.DocumentElement is
null) && Doc.DocumentElement.LocalName ==
"XRD")
900 foreach (XmlNode N
in Doc.DocumentElement.ChildNodes)
902 if (N is XmlElement E && E.LocalName ==
"Link")
906 case "urn:xmpp:alt-connections:xbosh":
910 case "urn:xmpp:alt-connections:websocket":
917 if (!
string.IsNullOrEmpty(WsUrl))
922 if (!
string.IsNullOrEmpty(TabID))
923 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowTransport",
"{\"method\":\"WS\"}",
true,
"User");
929 else if (!
string.IsNullOrEmpty(
BoshUrl))
934 if (!
string.IsNullOrEmpty(TabID))
935 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowTransport",
"{\"method\":\"BOSH\"}",
true,
"User");
948 Msg =
"No alternative binding methods found.";
954 Msg =
"Unable to connect properly.";
957 if (Client.TryGetTag(
"StartedAuthentication", out Obj) && Obj is
bool b && b)
959 if (!
string.IsNullOrEmpty(TabID))
961 if (this.createAccount)
972 if (
string.IsNullOrEmpty(TabID))
977 if (!(this.client is
null))
983 this.testConnection?.TrySetResult(
false);
989 Msg =
"Fetching roster from server.";
997 Msg =
"Registering account.";
1001 Msg =
"Requesting session.";
1005 Msg =
"Setting presence.";
1009 Msg =
"Starting encryption.";
1010 Client.SetTag(
"StartedEncryption",
true);
1014 Msg =
"Negotiating stream.";
1018 Msg =
"Stream opened.";
1022 Msg = NewState.ToString();
1026 if (!
string.IsNullOrEmpty(TabID))
1029 catch (Exception ex)
1033 if (!
string.IsNullOrEmpty(TabID))
1038 private async Task CheckAdminAccount()
1040 if (
string.IsNullOrEmpty(this.password0) && (!
string.IsNullOrEmpty(this.passwordType) ||
string.IsNullOrEmpty(this.password)))
1046 string.IsNullOrEmpty(
this.password0) ?
this.password :
this.password0));
1049 User.RoleIds =
new string[] {
"Administrator" };
1062 Role.Description =
"Administrator role. Has all privileges by default.";
1079 private bool RemoteCertificateValidationCallback(
object Sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
1083 if (sslPolicyErrors == SslPolicyErrors.None)
1086 Valid = this.trustServer;
1098 if (featuredServers is
null)
1100 string[] Result =
new string[clp.Count];
1101 clp.Keys.CopyTo(Result, 0);
1103 featuredServers = Result;
1106 return featuredServers;
1110 private static string[] featuredServers =
null;
1210 this.transportMethod = Method;
1213 switch (this.transportMethod)
1217 if (!
string.IsNullOrEmpty(Value))
1219 if (!
int.TryParse(Value, out
int i) || i <= 0 || i > 65535)
1226 this.customBinding =
false;
1234 this.customBinding =
true;
1241 this.customBinding =
true;
1245 this.
LogEnvironmentError(
"Unhandled binding method.", GATEWAY_XMPP_TRANSPORT, this.transportMethod);
1252 if (this.createAccount)
1255 if (
string.IsNullOrEmpty(Value))
1257 if (!clp.ContainsKey(
this.host))
1259 this.
LogEnvironmentError(
"Host is not a featured broker. If an account is to be created, an API Key must be provided.",
1260 GATEWAY_XMPP_CREATE_KEY, Value);
1269 clp[this.host] =
new KeyValuePair<string, string>(Value, Value2);
1278 if (this.createAccount)
1287 this.password0 = this.password;
1288 this.passwordType =
string.Empty;
1291 this.accountHumanReadableName = Value;
1305 this.testConnection =
new TaskCompletionSource<bool>();
1308 Task _ = Task.Delay(30000).ContinueWith(Prev => this.testConnection?.TrySetException(
new TimeoutException()));
1312 if (await this.testConnection.Task)
1317 catch (Exception ex)
1324 this.testConnection =
null;
Helps with parsing of commong data types.
static string GetString(byte[] Data, Encoding DefaultEncoding)
Gets a string from its binary representation, taking any Byte Order Mark (BOM) into account.
Static class managing encoding and decoding of internet content.
static Encoding GetEncoding(string CharacterSet)
Gets a character encoding from its name.
Helps with common JSON-related tasks.
static string Encode(string s)
Encodes a string for inclusion in JSON.
Plain text encoder/decoder.
const string DefaultContentType
text/plain
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
static string Encode(string s)
Encodes a string for use in XML.
Static class managing the application event log. Applications and services log events on this static ...
static IEventSink[] Sinks
Registered sinks.
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Creates an even sink that stores incoming (logged) events in the local object database,...
void SetDefaultFacility(string DefaultFacility, string DefaultFacilityKey)
Sets the default facility. The default facility can only be reset by a caller presenting the same key...
Event sink sending events to a destination over the XMPP network.
const string NamespaceEventLogging
urn:xmpp:eventlog
The ClientEvents class allows applications to push information asynchronously to web clients connecte...
static Task< int > PushEvent(string[] TabIDs, string Type, object Data)
Puses an event to a set of Tabs, given their Tab IDs.
Static class managing the runtime environment of the IoT Gateway.
static IUser AssertUserAuthenticated(HttpRequest Request, string Privilege)
Makes sure a request is being made from a session with a successful user login.
static byte[] NextBytes(int NrBytes)
Generates an array of random bytes.
static string AppDataFolder
Application data folder.
Returns the Bare JID of a JID.
Creates a random password.
static string CreateRandomPassword(int NrBytes, int NrBuckets)
Creates a random password.
void LogEnvironmentVariableInvalidRangeError(int Min, int Max, string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value is not within a va...
void LogEnvironmentVariableMissingError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value is missing.
void LogEnvironmentError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value contains an error.
bool TryGetEnvironmentVariable(string VariableName, bool Required, out string Value)
Tries to get a string-valued environment variable.
int Step
Configuration step.
string Account
XMPP Account
string LegalIdentities
JID of legal identities component.
const string GATEWAY_XMPP_PASSWORD
Password of account. If creating an account, this variable is optional. If not available,...
override void SetStaticInstance(ISystemConfiguration Configuration)
Sets the static instance of the configuration.
const string GATEWAY_XMPP_TRANSPORT
XMPP transport method(a.k.a.binding). Can be C2S (default if variable not available),...
string SoftwareUpdates
JID of software updates component.
override Task< string > Title(Language Language)
Gets a title for the system configuration.
XmppTransportMethod TransportMethod
Transport method
const string GATEWAY_XMPP_ACCOUNT_NAME
Optional Human-readable name of account.
override async Task ConfigureSystem()
Is called during startup to configure the system.
const string GATEWAY_XMPP_WSURL
URL to use when connecting to host. (If WS binding has been selected).
static string[] FeaturedServers
Array of XMPP servers featured by the installation.
override Task UnregisterSetup(HttpServer WebServer)
Unregisters the setup object.
const string GATEWAY_XMPP_BOSHURL
URL to use when connecting to host. (If BOSH binding has been selected).
XmppCredentials GetCredentials()
Gets connection credentials.
bool StorePasswordInsteadOfHash
If password should be stored instead of hash.
bool Reporting
If reporting is supported by the server.
override int Priority
Priority of the setting. Configurations are sorted in ascending order.
string ThingRegistry
JID of Thing Registry.
bool TrustServer
If server is to be trusted (true), or if certificate should be validated before connection is accepte...
string PubSub
JID of publish/subscribe component.
bool Abuse
If reporting abuse is supported by the server.
string WebSocketUrl
Web-socket URL to bind to.
static XmppConfiguration Instance
Current instance of configuration.
const string GATEWAY_XMPP_CREATE_SECRET
API-Key secret to use when creating account, if host is not one of the featured hosts.
override string ConfigPrivilege
Minimum required privilege for a user to be allowed to change the configuration defined by the class.
bool AllowInsecureMechanisms
If insecure authentication methods should be allowed.
bool PersonalEventing
If the Personal Eventing Protocol (PEP) is supported by the server.
override async Task< bool > EnvironmentConfiguration()
Environment configuration by configuring values available in environment variables.
const string GATEWAY_XMPP_CREATE_KEY
API-Key to use when creating account, if host is not one of the featured hosts.
bool Sniffer
If communication should be sniffed.
const string GATEWAY_XMPP_HOST
XMPP broker to connect to. (If C2S binding has been selected).
const string GATEWAY_XMPP_TRUST
Optional. true or 1 if gateway should trust server certificate, even if it does not validate,...
int Port
Port number to use
override Task InitSetup(HttpServer WebServer)
Initializes the setup object.
const string GATEWAY_XMPP_OBS_AUTH
Optional. true or 1 if gateway should be allowed to use obsolete and insecure authentication mechanis...
bool Mail
If mail is supported by the server.
string Host
Host to connect to
bool CreateAccount
If an account can be created.
bool OfflineMessages
If offline messages are supported by the server.
string PasswordType
Type of password. Empty string = clear text, otherwise, type of hash.
bool Spam
If reporting spam is supported by the server.
string BoshUrl
BOSH URL to bind to.
string AccountHumanReadableName
Human readable account name, if any.
string Events
JID of event log.
const string GATEWAY_XMPP_PORT
Optional Port number to use when connecting to host. (If C2S binding has been selected....
override string Resource
Resource to be redirected to, to perform the configuration.
const string GATEWAY_XMPP_CLEAR_PWD
Optional. true or 1 if gateway should store password as-is in the database, false or 0 if only the pa...
bool CustomBinding
If a custom binding is used.
string MultiUserChat
JID of Multi-User Chat service.
const string GATEWAY_XMPP_CREATE
If an account is to be created.
const string GATEWAY_XMPP_ACCOUNT
Name of account.
const string GATEWAY_XMPP_LOG
Optional. true or 1 if gateway should log communication to program data folder, false or 0 if communi...
bool Blocking
If blocking accounts is supported by the server.
string Provisioning
JID of provisioning server.
virtual void Add(ISniffer Sniffer)
ICommunicationLayer.Add
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
HttpRequestHeader Header
Request header.
bool HasData
If the request has data.
async Task< object > DecodeDataAsync()
Decodes data sent in request.
Base class for all HTTP resources.
Represets a response of an HTTP client request.
string ContentType
The Content-Type entity-header field indicates the media type of the entity-body sent to the recipien...
async Task Write(byte[] Data)
Returns binary data in the response.
Implements an HTTP server.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool Unregister(HttpResource Resource)
Unregisters a resource from the server.
Outputs sniffed data to the Console Output, serialized by ConsoleOut.
Outputs sniffed data to an XML file.
bool Ok
If the response is an OK result response (true), or an error response (false).
Contains information about an identity of an entity.
Contains information about an item of an entity.
Event arguments for service discovery responses.
Identity[] Identities
Identities
bool HasFeature(string Feature)
Checks if the remote entity supports a specific feature.
bool HasAnyFeature(params string[] Features)
Checks if the remote entity supports any of a set of features.
Event arguments for service items discovery responses.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Task OfflineAndDisposeAsync()
Sends an offline presence, and then disposes the object by calling DisposeAsync.
void SetTag(string TagName, object Tag)
Sets a tag value.
Task Connect()
Connects the client.
Class containing credentials for an XMPP client connection.
const int DefaultPort
Default XMPP Server port.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Contains methods for simple hash calculations.
static string BinaryToString(byte[] Data)
Converts an array of bytes to a string with their hexadecimal representations (in lower case).
Contains a reference to a privilege
Corresponds to a role in the system.
string Description
Description of privilege.
PrivilegePattern[] Privileges
Privileges
Maintains the collection of all roles in the system.
static Task< Role > GetRole(string RoleId)
Gets the Role object corresponding to a Role ID.
Corresponds to a user in the system.
Maintains the collection of all users in the system.
static byte[] ComputeHash(string UserName, string Password)
Computes a hash of a password.
static async Task< User > GetUser(string UserName, bool CreateIfNew)
Gets the User object corresponding to a User Name.
Interface for objects that contain a reference to a host.
Interface for all event sinks.
Interface for system configurations. The gateway will scan all module for system configuration classe...
Interface for sniffers. Sniffers can be added to ICommunicationLayer classes to eavesdrop on communic...
XmppTransportMethod
How to bind to the XMPP network.
LineEnding
Type of line ending.
BinaryPresentationMethod
How binary data is to be presented.
XmppState
State of XMPP connection.