7using System.Security.Cryptography.X509Certificates;
10using System.Threading.Tasks;
56 private static XmppConfiguration instance =
null;
57 private static string defaultFacility =
string.Empty;
58 private static string defaultFacilityKey =
string.Empty;
64 private string host =
string.Empty;
66 private string boshUrl =
string.Empty;
67 private string wsUrl =
string.Empty;
68 private string account =
string.Empty;
69 private string accountHumanReadableName =
string.Empty;
70 private string password =
string.Empty;
71 private string password0 =
string.Empty;
72 private string passwordType =
string.Empty;
73 private string thingRegistry =
string.Empty;
74 private string provisioning =
string.Empty;
75 private string events =
string.Empty;
76 private string muc =
string.Empty;
77 private string pubSub =
string.Empty;
78 private string legal =
string.Empty;
79 private string software =
string.Empty;
80 private string geo =
string.Empty;
81 private string bareJid =
string.Empty;
82 private bool sniffer =
false;
83 private bool trustServer =
false;
84 private bool allowInsecureMechanisms =
false;
85 private bool storePasswordInsteadOfHash =
false;
86 private bool customBinding =
false;
87 private bool offlineMessages =
false;
88 private bool blocking =
false;
89 private bool reporting =
false;
90 private bool abuse =
false;
91 private bool spam =
false;
92 private bool pep =
false;
93 private bool mail =
false;
95 private TaskCompletionSource<bool> testConnection =
null;
97 private bool createAccount =
false;
110 get => this.transportMethod;
111 set => this.transportMethod = value;
117 [DefaultValueStringEmpty]
121 set => this.host = value;
131 set => this.port = value;
137 [DefaultValueStringEmpty]
141 set => this.boshUrl = value;
147 [DefaultValueStringEmpty]
151 set => this.wsUrl = value;
157 [DefaultValueStringEmpty]
161 set => this.account = value;
170 get => this.password;
171 set => this.password = value;
182 [DefaultValueStringEmpty]
185 get => this.passwordType;
186 set => this.passwordType = value;
194 get => this.accountHumanReadableName;
195 set => this.accountHumanReadableName = value;
201 [DefaultValueStringEmpty]
204 get => this.thingRegistry;
205 set => this.thingRegistry = value;
211 [DefaultValueStringEmpty]
214 get => this.provisioning;
215 set => this.provisioning = value;
221 [DefaultValueStringEmpty]
225 set => this.events = value;
231 [DefaultValueStringEmpty]
235 set => this.muc = value;
241 [DefaultValueStringEmpty]
245 set => this.pubSub = value;
251 [DefaultValueStringEmpty]
255 set => this.legal = value;
261 [DefaultValueStringEmpty]
264 get => this.software;
265 set => this.software = value;
271 [DefaultValueStringEmpty]
275 set => this.geo = value;
281 [DefaultValueStringEmpty]
285 set => this.bareJid = value;
291 [DefaultValue(
false)]
295 set => this.sniffer = value;
301 [DefaultValue(
false)]
304 get => this.trustServer;
305 set => this.trustServer = value;
311 [DefaultValue(
false)]
314 get => this.allowInsecureMechanisms;
315 set => this.allowInsecureMechanisms = value;
321 [DefaultValue(
false)]
324 get => this.storePasswordInsteadOfHash;
325 set => this.storePasswordInsteadOfHash = value;
331 [DefaultValue(
false)]
334 get => this.customBinding;
335 set => this.customBinding = value;
341 [DefaultValue(
false)]
344 get => this.offlineMessages;
345 set => this.offlineMessages = value;
351 [DefaultValue(
false)]
354 get => this.blocking;
355 set => this.blocking = value;
361 [DefaultValue(
false)]
364 get => this.reporting;
365 set => this.reporting = value;
371 [DefaultValue(
false)]
375 set => this.abuse = value;
381 [DefaultValue(
false)]
385 set => this.spam = value;
391 [DefaultValue(
false)]
395 set => this.pep = value;
401 [DefaultValue(
false)]
405 set => this.mail = value;
417 public override string Resource =>
"/Settings/XMPP.md";
439 await
Gateway.ConfigureXmpp(
this);
440 await this.CheckAdminAccount();
458 this.connectToHost = WebServer.
Register(
"/Settings/ConnectToHost",
null, this.ConnectToHost,
true,
false,
true);
459 this.randomizePassword = WebServer.
Register(
"/Settings/RandomizePassword",
null, this.RandomizePassword,
true,
false,
true);
461 return base.InitSetup(WebServer);
473 return base.UnregisterSetup(WebServer);
492 if (Content.
HasError || !(Content.
Decoded is Dictionary<string, object> Parameters))
498 if (!Parameters.TryGetValue(
"host", out
object Obj) || !(Obj is
string HostName))
504 string TabID = Request.
Header[
"X-TabID"];
505 if (
string.IsNullOrEmpty(TabID))
511 if (!Parameters.TryGetValue(
"port", out Obj) || !(Obj is
int Port) || Port < 1 || Port > 65535)
517 if (!Parameters.TryGetValue(
"boshUrl", out Obj) || !(Obj is
string BoshUrl))
523 if (!Parameters.TryGetValue(
"wsUrl", out Obj) || !(Obj is
string WsUrl))
529 if (!Parameters.TryGetValue(
"customBinding", out Obj) || !(Obj is
bool CustomBinding))
535 if (!Parameters.TryGetValue(
"trustServer", out Obj) || !(Obj is
bool TrustServer))
541 if (!Parameters.TryGetValue(
"insecureMechanisms", out Obj) || !(Obj is
bool InsecureMechanisms))
553 if (!Parameters.TryGetValue(
"sniffer", out Obj) || !(Obj is
bool Sniffer))
559 if (!Parameters.TryGetValue(
"transport", out Obj) || !(Obj is
string s2) || !Enum.TryParse(s2, out
XmppTransportMethod Method))
565 if (!Parameters.TryGetValue(
"account", out Obj) || !(Obj is
string Account))
571 if (!Parameters.TryGetValue(
"password", out Obj) || !(Obj is
string Password))
577 if (!Parameters.TryGetValue(
"createAccount", out Obj) || !(Obj is
bool CreateAccount))
583 if (!Parameters.TryGetValue(
"accountName", out Obj) || !(Obj is
string AccountName))
589 this.host = HostName;
592 this.wsUrl = WsUrl.Trim();
595 this.allowInsecureMechanisms = InsecureMechanisms;
598 this.transportMethod = Method;
601 this.accountHumanReadableName = AccountName;
605 this.password = this.password0 =
Password;
606 this.passwordType =
string.Empty;
609 if (!(this.client is
null))
617 Response.StatusCode = 200;
618 Response.StatusMessage =
"OK";
623 Response.StatusCode = 200;
624 Response.StatusMessage =
"OK";
648 AllowEncryption =
true,
649 AllowCramMD5 = this.allowInsecureMechanisms,
650 AllowDigestMD5 = this.allowInsecureMechanisms,
651 AllowPlain = this.allowInsecureMechanisms,
652 AllowRegistration = this.createAccount,
653 AllowScramSHA1 =
true,
654 AllowScramSHA256 =
true,
655 RequestRosterOnStartup =
true
658 if (this.createAccount && clp.TryGetValue(
this.host, out KeyValuePair<string, string> P))
660 Credentials.FormSignatureKey = P.Key;
661 Credentials.FormSignatureSecret = P.Value;
664 switch (this.transportMethod)
667 Credentials.UriEndpoint = this.boshUrl;
671 Credentials.UriEndpoint = this.wsUrl;
678 private void Connect(
string TabID)
681 this.client.
SetTag(
"TabID", TabID);
682 this.client.
SetTag(
"StartedEncryption",
false);
683 this.client.
SetTag(
"EncyptionSuccessful",
false);
684 this.client.
SetTag(
"StartedAuthentication",
false);
697 "XMPP Log %YEAR%-%MONTH%-%DAY%T%HOUR%.xml",
703 this.client.OnStateChanged += this.Client_OnStateChanged;
707 private async Task Client_OnStateChanged(
object Sender,
XmppState NewState)
712 if (!Client.TryGetTag(
"TabID", out
object Obj) || !(Obj is
string TabID))
722 Client.SetTag(
"StartedAuthentication",
true);
723 Client.SetTag(
"EncyptionSuccessful",
true);
726 if (!
string.IsNullOrEmpty(TabID))
728 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ConnectionOK0",
"Connection established.",
false,
"User");
730 if (!(this.client is
null))
737 this.Updated = DateTime.Now;
744 Msg =
"Authenticating user.";
748 Msg =
"Binding to resource.";
752 this.bareJid = Client.BareJID;
753 this.password = Client.PasswordHash;
754 this.passwordType = Client.PasswordHashMethod;
756 if (this.bareJid != defaultFacility)
758 defaultFacility = this.bareJid;
760 if (
string.IsNullOrEmpty(defaultFacilityKey))
781 if (this.createAccount && !
string.IsNullOrEmpty(this.accountHumanReadableName))
783 if (!
string.IsNullOrEmpty(TabID))
786 StringBuilder Xml =
new StringBuilder();
788 Xml.Append(
"<vCard xmlns='vcard-temp'>");
790 Xml.Append(
XML.
Encode(
this.accountHumanReadableName));
792 Xml.Append(
"<JABBERID>");
793 Xml.Append(
XML.
Encode(
this.client.BareJID));
794 Xml.Append(
"</JABBERID>");
795 Xml.Append(
"</vCard>");
797 await Client.IqSetAsync(this.client.
BareJID, Xml.ToString());
800 if (!
string.IsNullOrEmpty(TabID))
801 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking server features.",
false,
"User");
807 this.offlineMessages = e.
HasFeature(
"msgoffline");
808 this.blocking = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceBlocking);
809 this.reporting = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceReporting);
810 this.abuse = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceAbuseReason);
811 this.spam = e.
HasFeature(Networking.XMPP.Abuse.AbuseClient.NamespaceSpamReason);
816 this.offlineMessages =
false;
817 this.blocking =
false;
818 this.reporting =
false;
824 if (!
string.IsNullOrEmpty(TabID))
825 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking account features.",
false,
"User");
827 e = await Client.ServiceDiscoveryAsync(
null, Client.BareJID,
string.Empty);
829 this.pep = e.Ok && this.ContainsIdentity(
"pep",
"pubsub", e);
831 if (!
string.IsNullOrEmpty(TabID))
832 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Checking server components.",
false,
"User");
836 this.thingRegistry =
string.Empty;
837 this.provisioning =
string.Empty;
838 this.events =
string.Empty;
839 this.muc =
string.Empty;
840 this.pubSub =
string.Empty;
841 this.legal =
string.Empty;
842 this.software =
string.Empty;
843 this.geo =
string.Empty;
849 if (!
string.IsNullOrEmpty(TabID))
852 e = await Client.ServiceDiscoveryAsync(
null,
Item.
JID,
string.Empty);
854 if (e.
HasAnyFeature(Networking.XMPP.Provisioning.ThingRegistryClient.NamespacesDiscovery))
857 if (e.
HasAnyFeature(Networking.XMPP.Provisioning.ProvisioningClient.NamespacesProvisioningDevice))
860 if (e.
HasFeature(Networking.XMPP.MUC.MultiUserChatClient.NamespaceMuc))
863 if (e.
HasFeature(Networking.XMPP.PubSub.PubSubClient.NamespacePubSub) &&
this.ContainsIdentity(
"service",
"pubsub", e))
869 if (e.
HasAnyFeature(Networking.XMPP.Contracts.ContractsClient.NamespacesLegalIdentities))
872 if (e.
HasAnyFeature(Networking.XMPP.Software.SoftwareUpdateClient.NamespacesSoftwareUpdates))
875 if (e.
HasAnyFeature(Networking.XMPP.Geo.GeoClient.NamespacesGeoSpatial))
880 Dictionary<string, object> ConnectionInfo =
new Dictionary<string, object>()
882 {
"msg",
"Connection successful." },
883 {
"offlineMsg", this.offlineMessages },
884 {
"blocking", this.blocking },
885 {
"reporting", this.reporting },
886 {
"abuse", this.abuse },
887 {
"spam", this.spam },
888 {
"mail", this.mail },
889 {
"pep", this.pep ? this.bareJid : string.Empty },
890 {
"thingRegistry", this.thingRegistry },
891 {
"provisioning", this.provisioning },
892 {
"eventLog", this.events },
893 {
"pubSub", this.pubSub },
895 {
"legal", this.legal },
896 {
"software", this.software },
900 if (!
string.IsNullOrEmpty(TabID))
903 if (!(this.client is
null))
905 this.client.OnStateChanged -= this.Client_OnStateChanged;
911 this.Updated = DateTime.Now;
914 this.testConnection?.TrySetResult(
true);
918 Msg =
"Connecting to server.";
927 this.customBinding =
true;
929 if (!
string.IsNullOrEmpty(TabID))
931 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowStatus",
"Unable to connect properly. Looking for alternative ways to connect.",
false,
"User");
932 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowCustomProperties",
"{\"visible\":true}",
true,
"User");
935 using HttpClient HttpClient =
new HttpClient(
new HttpClientHandler()
938 ServerCertificateCustomValidationCallback = this.RemoteCertificateValidationCallback,
941 AutomaticDecompression = (DecompressionMethods)(-1)
944 Timeout = TimeSpan.FromMilliseconds(60000)
949 Uri Uri =
new Uri(
"http://" + this.host +
"/.well-known/host-meta");
950 HttpResponseMessage Response = await HttpClient.GetAsync(Uri);
951 if (!Response.IsSuccessStatusCode)
953 ContentResponse Temp = await Content.Getters.WebGetter.ProcessResponse(Response, Uri);
957 Stream Stream = await Response.Content.ReadAsStreamAsync();
958 byte[] Bin = await Response.Content.ReadAsByteArrayAsync();
959 string CharSet = Response.Content.Headers.ContentType.CharSet;
960 System.Text.Encoding Encoding;
962 if (
string.IsNullOrEmpty(CharSet))
963 Encoding =
System.Text.Encoding.UTF8;
970 if (!(Doc.DocumentElement is
null) && Doc.DocumentElement.LocalName ==
"XRD")
975 foreach (XmlNode N
in Doc.DocumentElement.ChildNodes)
977 if (N is XmlElement E && E.LocalName ==
"Link")
981 case "urn:xmpp:alt-connections:xbosh":
985 case "urn:xmpp:alt-connections:websocket":
992 if (!
string.IsNullOrEmpty(WsUrl))
997 if (!
string.IsNullOrEmpty(TabID))
998 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowTransport",
"{\"method\":\"WS\"}",
true,
"User");
1000 this.Connect(TabID);
1004 else if (!
string.IsNullOrEmpty(
BoshUrl))
1009 if (!
string.IsNullOrEmpty(TabID))
1010 await
ClientEvents.
PushEvent(
new string[] { TabID },
"ShowTransport",
"{\"method\":\"BOSH\"}",
true,
"User");
1012 this.Connect(TabID);
1023 Msg =
"No alternative binding methods found.";
1028 Msg =
"Unable to connect properly.";
1031 if (Client.TryGetTag(
"StartedAuthentication", out Obj) && Obj is
bool b && b)
1033 if (!
string.IsNullOrEmpty(TabID))
1035 if (this.createAccount)
1046 if (
string.IsNullOrEmpty(TabID))
1051 if (!(this.client is
null))
1057 this.testConnection?.TrySetResult(
false);
1063 Msg =
"Fetching roster from server.";
1071 Msg =
"Registering account.";
1075 Msg =
"Requesting session.";
1079 Msg =
"Setting presence.";
1083 Msg =
"Starting encryption.";
1084 Client.SetTag(
"StartedEncryption",
true);
1088 Msg =
"Negotiating stream.";
1092 Msg =
"Stream opened.";
1096 Msg = NewState.ToString();
1100 if (!
string.IsNullOrEmpty(TabID))
1103 catch (Exception ex)
1107 if (!
string.IsNullOrEmpty(TabID))
1112 private async Task CheckAdminAccount()
1114 if (
string.IsNullOrEmpty(this.password0) && (!
string.IsNullOrEmpty(this.passwordType) ||
string.IsNullOrEmpty(this.password)))
1120 string.IsNullOrEmpty(
this.password0) ?
this.password :
this.password0));
1123 User.RoleIds =
new string[] {
"Administrator" };
1136 Role.Description =
"Administrator role. Has all privileges by default.";
1153 private bool RemoteCertificateValidationCallback(
object Sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
1157 if (sslPolicyErrors == SslPolicyErrors.None)
1160 Valid = this.trustServer;
1172 if (featuredServers is
null)
1174 string[] Result =
new string[clp.Count];
1175 clp.Keys.CopyTo(Result, 0);
1177 featuredServers = Result;
1180 return featuredServers;
1184 private static string[] featuredServers =
null;
1284 this.transportMethod = Method;
1287 switch (this.transportMethod)
1291 if (!
string.IsNullOrEmpty(Value))
1293 if (!
int.TryParse(Value, out
int i) || i <= 0 || i > 65535)
1300 this.customBinding =
false;
1308 this.customBinding =
true;
1315 this.customBinding =
true;
1319 this.
LogEnvironmentError(
"Unhandled binding method.", GATEWAY_XMPP_TRANSPORT, this.transportMethod);
1326 if (this.createAccount)
1329 if (
string.IsNullOrEmpty(Value))
1331 if (!clp.ContainsKey(
this.host))
1333 this.
LogEnvironmentError(
"Host is not a featured broker. If an account is to be created, an API Key must be provided.",
1334 GATEWAY_XMPP_CREATE_KEY, Value);
1343 clp[this.host] =
new KeyValuePair<string, string>(Value, Value2);
1352 if (this.createAccount)
1361 this.password0 = this.password;
1362 this.passwordType =
string.Empty;
1365 this.accountHumanReadableName = Value;
1379 this.testConnection =
new TaskCompletionSource<bool>();
1382 Task
_ = Task.Delay(30000).ContinueWith(Prev => this.testConnection?.TrySetException(
new TimeoutException()));
1386 if (await this.testConnection.Task)
1391 catch (Exception ex)
1398 this.testConnection =
null;
Contains information about a response to a content request.
bool HasError
If an error occurred.
object Decoded
Decoded object.
void AssertOk()
Asserts response is OK.
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 XmlDocument ParseXml(string Xml)
Parses an XML Document from its string representation.
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.
string Geo
JID of geo-spatial publish/subscribe component.
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....
string[] EncryptedProperties
Array of properties that are encrypted.
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< ContentResponse > DecodeDataAsync()
Decodes data sent in request.
Base class for all HTTP resources.
Represets a response of an HTTP client request.
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
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.
Static class managing binary representations of strings.
static string GetString(byte[] Data, int Offset, int Count, Encoding DefaultEncoding)
Gets a string from its binary representation, taking any Byte Order Mark (BOM) into account.
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...
Interface for objects containing encrypted properties. Mark the properties that are encrypted with th...
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.