Add tanya.network package file

This commit is contained in:
Eugen Wissner 2017-04-01 09:53:59 +02:00
parent 647cfe03c2
commit 5e16fe98d6
3 changed files with 1697 additions and 1673 deletions

View File

@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Network programming.
*
* Copyright: Eugene Wissner 2016-2017.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/
module tanya.network;
public import tanya.network.socket;
public import tanya.network.url;

View File

@ -3,7 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** /**
* Copyright: Eugene Wissner 2016. * Socket programming.
*
* Copyright: Eugene Wissner 2016-2017.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0). * Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner) * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
@ -1004,10 +1006,14 @@ interface ConnectionOrientedSocket
*/ */
enum Flag : int enum Flag : int
{ {
none = 0, /// No flags specified /// No flags specified.
outOfBand = MSG_OOB, /// Out-of-band stream data none = 0,
peek = MSG_PEEK, /// Peek at incoming data without removing it from the queue, only for receiving /// Out-of-band stream data.
dontRoute = MSG_DONTROUTE, /// Data should not be subject to routing; this flag may be ignored. Only for sending outOfBand = MSG_OOB,
/// Peek at incoming data without removing it from the queue, only for receiving.
peek = MSG_PEEK,
/// Data should not be subject to routing; this flag may be ignored. Only for sending.
dontRoute = MSG_DONTROUTE,
} }
alias Flags = BitFlags!Flag; alias Flags = BitFlags!Flag;

View File

@ -3,10 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** /**
* Copyright: Eugene Wissner 2016. * URL parser.
*
* Copyright: Eugene Wissner 2016-2017.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/, * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0). * Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:belka@caraus.de, Eugene Wissner) * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
*/ */
module tanya.network.url; module tanya.network.url;
@ -911,8 +913,8 @@ struct URL
} }
} }
~this() ~this()
{ {
if (scheme !is null) if (scheme !is null)
{ {
scheme = null; scheme = null;
@ -941,7 +943,7 @@ struct URL
{ {
fragment = null; fragment = null;
} }
} }
/** /**
* Attempts to parse and set the port. * Attempts to parse and set the port.
@ -1107,7 +1109,7 @@ URL parseURL(typeof(null) T)(in char[] source)
/// Ditto. /// Ditto.
const(char)[] parseURL(immutable(char)[] T)(in char[] source) const(char)[] parseURL(immutable(char)[] T)(in char[] source)
if (T == "scheme" if (T == "scheme"
|| T =="host" || T == "host"
|| T == "user" || T == "user"
|| T == "pass" || T == "pass"
|| T == "path" || T == "path"