summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/tanya/encoding/ascii.d501
-rw-r--r--source/tanya/encoding/package.d17
-rw-r--r--source/tanya/os/error.d419
-rw-r--r--source/tanya/os/package.d18
-rw-r--r--source/tanya/sys/linux/syscall.d61
-rw-r--r--source/tanya/sys/posix/ioctl.d78
-rw-r--r--source/tanya/sys/posix/mman.d31
-rw-r--r--source/tanya/sys/posix/net/if_.d27
-rw-r--r--source/tanya/sys/posix/socket.d152
-rw-r--r--source/tanya/sys/windows/def.d66
-rw-r--r--source/tanya/sys/windows/ifdef.d30
-rw-r--r--source/tanya/sys/windows/iphlpapi.d39
-rw-r--r--source/tanya/sys/windows/package.d21
-rw-r--r--source/tanya/sys/windows/winbase.d55
-rw-r--r--source/tanya/sys/windows/winsock2.d219
15 files changed, 0 insertions, 1734 deletions
diff --git a/source/tanya/encoding/ascii.d b/source/tanya/encoding/ascii.d
deleted file mode 100644
index c30d931..0000000
--- a/source/tanya/encoding/ascii.d
+++ /dev/null
@@ -1,501 +0,0 @@
-/* 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/. */
-
-/**
- * Functions operating on ASCII characters.
- *
- * ASCII is $(B A)merican $(B S)tandard $(B C)ode for $(B I)nformation
- * $(B I)nterchange.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/encoding/ascii.d,
- * tanya/encoding/ascii.d)
- */
-module tanya.encoding.ascii;
-
-import tanya.meta.trait;
-
-immutable string fullHexDigits = "0123456789ABCDEFabcdef"; /// 0..9A..Fa..f.
-immutable string hexDigits = "0123456789ABCDEF"; /// 0..9A..F.
-immutable string lowerHexDigits = "0123456789abcdef"; /// 0..9a..f.
-immutable string digits = "0123456789"; /// 0..9.
-immutable string octalDigits = "01234567"; /// 0..7.
-
-/// A..Za..z.
-immutable string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-immutable string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /// A..Z.
-immutable string lowercase = "abcdefghijklmnopqrstuvwxyz"; /// a..z.
-
-/**
- * Whitespace, Horizontal Tab (HT), Line Feed (LF), Carriage Return (CR),
- * Vertical Tab (VT) or Form Feed (FF).
- */
-immutable string whitespace = "\t\n\v\f\r ";
-
-/// Letter case specifier.
-enum LetterCase : bool
-{
- upper, /// Uppercase.
- lower, /// Lowercase.
-}
-
-/**
- * Checks for an uppecase alphabetic character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is an uppercase alphabetic
- * character, $(D_KEYWORD false) otherwise.
- */
-bool isUpper(C)(C c)
-if (isSomeChar!C)
-{
- return (c >= 'A') && (c <= 'Z');
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isUpper('A'));
- assert(isUpper('Z'));
- assert(isUpper('L'));
- assert(!isUpper('a'));
- assert(!isUpper('!'));
-}
-
-/**
- * Checks for a lowercase alphabetic character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a lowercase alphabetic
- * character, $(D_KEYWORD false) otherwise.
- */
-bool isLower(C)(C c)
-if (isSomeChar!C)
-{
- return (c >= 'a') && (c <= 'z');
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isLower('a'));
- assert(isLower('z'));
- assert(isLower('l'));
- assert(!isLower('A'));
- assert(!isLower('!'));
-}
-
-/**
- * Checks for an alphabetic character (upper- or lowercase).
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is an alphabetic character,
- * $(D_KEYWORD false) otherwise.
- */
-bool isAlpha(C)(C c)
-if (isSomeChar!C)
-{
- return isUpper(c) || isLower(c);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isAlpha('A'));
- assert(isAlpha('Z'));
- assert(isAlpha('L'));
- assert(isAlpha('a'));
- assert(isAlpha('z'));
- assert(isAlpha('l'));
- assert(!isAlpha('!'));
-}
-
-/**
- * Checks for a digit.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a digit,
- * $(D_KEYWORD false) otherwise.
- */
-bool isDigit(C)(C c)
-if (isSomeChar!C)
-{
- return (c >= '0') && (c <= '9');
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isDigit('0'));
- assert(isDigit('1'));
- assert(isDigit('2'));
- assert(isDigit('3'));
- assert(isDigit('4'));
- assert(isDigit('5'));
- assert(isDigit('6'));
- assert(isDigit('7'));
- assert(isDigit('8'));
- assert(isDigit('9'));
- assert(!isDigit('a'));
- assert(!isDigit('!'));
-}
-
-/**
- * Checks for an alphabetic character (upper- or lowercase) or a digit.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is an alphabetic character or a
- * digit, $(D_KEYWORD false) otherwise.
- */
-bool isAlphaNum(C)(C c)
-if (isSomeChar!C)
-{
- return isAlpha(c) || isDigit(c);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isAlphaNum('0'));
- assert(isAlphaNum('1'));
- assert(isAlphaNum('9'));
- assert(isAlphaNum('A'));
- assert(isAlphaNum('Z'));
- assert(isAlphaNum('L'));
- assert(isAlphaNum('a'));
- assert(isAlphaNum('z'));
- assert(isAlphaNum('l'));
- assert(!isAlphaNum('!'));
-}
-
-/**
- * Checks for a 7-bit ASCII character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is an ASCII character,
- * $(D_KEYWORD false) otherwise.
- */
-bool isASCII(C)(C c)
-if (isSomeChar!C)
-{
- return c < 128;
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isASCII('0'));
- assert(isASCII('L'));
- assert(isASCII('l'));
- assert(isASCII('!'));
- assert(!isASCII('©'));
- assert(!isASCII('§'));
- assert(!isASCII(char.init)); // 0xFF
- assert(!isASCII(wchar.init)); // 0xFFFF
- assert(!isASCII(dchar.init)); // 0xFFFF
-}
-
-/**
- * Checks for a control character.
- *
- * Control characters are non-printable characters. Their ASCII codes are those
- * between 0x00 (NUL) and 0x1f (US), and 0x7f (DEL).
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a control character,
- * $(D_KEYWORD false) otherwise.
- *
- * See_Also: $(D_PSYMBOL isPrintable), $(D_PSYMBOL isGraphical).
- */
-bool isControl(C)(C c)
-if (isSomeChar!C)
-{
- return (c <= 0x1f) || (c == 0x7f);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isControl('\t'));
- assert(isControl('\0'));
- assert(isControl('\u007f'));
- assert(!isControl(' '));
- assert(!isControl('a'));
- assert(!isControl(char.init)); // 0xFF
- assert(!isControl(wchar.init)); // 0xFFFF
-}
-
-/**
- * Checks for a whitespace character.
- *
- * Whitespace characters are:
- *
- * $(UL
- * $(LI Whitespace)
- * $(LI Horizontal Tab (HT))
- * $(LI Line Feed (LF))
- * $(LI Carriage Return (CR))
- * $(LI Vertical Tab (VT))
- * $(LI Form Feed (FF))
- * )
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a whitespace character,
- * $(D_KEYWORD false) otherwise.
- *
- * See_Also: $(D_PSYMBOL whitespace).
- */
-bool isWhite(C)(C c)
-if (isSomeChar!C)
-{
- return ((c >= 0x09) && (c <= 0x0d)) || (c == 0x20);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isWhite('\t'));
- assert(isWhite('\n'));
- assert(isWhite('\v'));
- assert(isWhite('\f'));
- assert(isWhite('\r'));
- assert(isWhite(' '));
-}
-
-/**
- * Checks for a graphical character.
- *
- * Graphical characters are printable characters but whitespace characters.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a control character,
- * $(D_KEYWORD false) otherwise.
- *
- * See_Also: $(D_PSYMBOL isControl), $(D_PSYMBOL isWhite).
- */
-bool isGraphical(C)(C c)
-if (isSomeChar!C)
-{
- return (c > 0x20) && (c < 0x7f);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isGraphical('a'));
- assert(isGraphical('0'));
- assert(!isGraphical('\u007f'));
- assert(!isGraphical('§'));
- assert(!isGraphical('\n'));
- assert(!isGraphical(' '));
-}
-
-/**
- * Checks for a printable character.
- *
- * This is the opposite of a control character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a control character,
- * $(D_KEYWORD false) otherwise.
- *
- * See_Also: $(D_PSYMBOL isControl).
- */
-bool isPrintable(C)(C c)
-if (isSomeChar!C)
-{
- return (c >= 0x20) && (c < 0x7f);
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isPrintable('a'));
- assert(isPrintable('0'));
- assert(!isPrintable('\u007f'));
- assert(!isPrintable('§'));
- assert(!isPrintable('\n'));
- assert(isPrintable(' '));
-}
-
-/**
- * Checks for a hexadecimal digit.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a hexadecimal digit,
- * $(D_KEYWORD false) otherwise.
- */
-bool isHexDigit(C)(C c)
-if (isSomeChar!C)
-{
- return ((c >= '0') && (c <= '9'))
- || ((c >= 'a') && (c <= 'f'))
- || ((c >= 'A') && (c <= 'F'));
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isHexDigit('0'));
- assert(isHexDigit('1'));
- assert(isHexDigit('8'));
- assert(isHexDigit('9'));
- assert(isHexDigit('A'));
- assert(isHexDigit('F'));
- assert(!isHexDigit('G'));
- assert(isHexDigit('a'));
- assert(isHexDigit('f'));
- assert(!isHexDigit('g'));
-}
-
-/**
- * Checks for an octal character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is an octal character,
- * $(D_KEYWORD false) otherwise.
- */
-bool isOctalDigit(C)(C c)
-if (isSomeChar!C)
-{
- return (c >= '0') && (c <= '7');
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isOctalDigit('0'));
- assert(isOctalDigit('1'));
- assert(isOctalDigit('2'));
- assert(isOctalDigit('3'));
- assert(isOctalDigit('4'));
- assert(isOctalDigit('5'));
- assert(isOctalDigit('6'));
- assert(isOctalDigit('7'));
- assert(!isOctalDigit('8'));
-}
-
-/**
- * Checks for a octal character.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: $(D_KEYWORD true) if $(D_PARAM c) is a octal character,
- * $(D_KEYWORD false) otherwise.
- */
-bool isPunctuation(C)(C c)
-if (isSomeChar!C)
-{
- return ((c >= 0x21) && (c <= 0x2f))
- || ((c >= 0x3a) && (c <= 0x40))
- || ((c >= 0x5b) && (c <= 0x60))
- || ((c >= 0x7b) && (c <= 0x7e));
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(isPunctuation('!'));
- assert(isPunctuation(':'));
- assert(isPunctuation('\\'));
- assert(isPunctuation('|'));
- assert(!isPunctuation('0'));
- assert(!isPunctuation(' '));
-}
-
-/**
- * Converts $(D_PARAM c) to uppercase.
- *
- * If $(D_PARAM c) is not a lowercase character, $(D_PARAM c) is returned
- * unchanged.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: The lowercase of $(D_PARAM c) if available, just $(D_PARAM c)
- * otherwise.
- */
-C toUpper(C)(C c)
-if (isSomeChar!C)
-{
- return isLower(c) ? (cast(C) (c - 32)) : c;
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(toUpper('a') == 'A');
- assert(toUpper('A') == 'A');
- assert(toUpper('!') == '!');
-}
-
-/**
- * Converts $(D_PARAM c) to lowercase.
- *
- * If $(D_PARAM c) is not an uppercase character, $(D_PARAM c) is returned
- * unchanged.
- *
- * Params:
- * C = Some character type.
- * c = Some character.
- *
- * Returns: The uppercase of $(D_PARAM c) if available, just $(D_PARAM c)
- * otherwise.
- */
-C toLower(C)(C c)
-if (isSomeChar!C)
-{
- return isUpper(c) ? (cast(C) (c + 32)) : c;
-}
-
-///
-@nogc nothrow pure @safe unittest
-{
- assert(toLower('A') == 'a');
- assert(toLower('a') == 'a');
- assert(toLower('!') == '!');
-}
diff --git a/source/tanya/encoding/package.d b/source/tanya/encoding/package.d
deleted file mode 100644
index 49f5ca5..0000000
--- a/source/tanya/encoding/package.d
+++ /dev/null
@@ -1,17 +0,0 @@
-/* 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/. */
-
-/**
- * This package provides tools to work with text encodings.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/encoding/package.d,
- * tanya/encoding/package.d)
- */
-module tanya.encoding;
-
-public import tanya.encoding.ascii;
diff --git a/source/tanya/os/error.d b/source/tanya/os/error.d
deleted file mode 100644
index bc4a008..0000000
--- a/source/tanya/os/error.d
+++ /dev/null
@@ -1,419 +0,0 @@
-/* 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/. */
-
-/**
- * This module provides a portable way of using operating system error codes.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/os/error.d,
- * tanya/os/error.d)
- */
-module tanya.os.error;
-
-import tanya.meta.trait;
-
-// Socket API error.
-private template SAError(int posix, int wsa = posix)
-{
- version (Windows)
- {
- enum SAError = 10000 + wsa;
- }
- else
- {
- alias SAError = posix;
- }
-}
-
-// Error for Windows and Posix separately.
-private template NativeError(int posix, int win)
-{
- version (Windows)
- {
- alias NativeError = win;
- }
- else
- {
- alias NativeError = posix;
- }
-}
-
-version (Windows)
-{
- private enum eProtocolError = -71;
-}
-else version (OpenBSD)
-{
- private enum eProtocolError = -71;
-}
-else
-{
- private enum eProtocolError = 71;
-}
-
-/**
- * System error code.
- */
-struct ErrorCode
-{
- /**
- * Error code numbers.
- */
- enum ErrorNo : int
- {
- /// The operation completed successfully.
- success = 0,
-
- /// Operation not permitted.
- noPermission = NativeError!(1, 5),
-
- /// Interrupted system call.
- interrupted = SAError!4,
-
- /// Bad file descriptor.
- badDescriptor = SAError!9,
-
- /// An operation on a non-blocking socket would block.
- wouldBlock = SAError!(11, 35),
-
- /// Out of memory.
- noMemory = NativeError!(12, 14),
-
- /// Access denied.
- accessDenied = SAError!13,
-
- /// An invalid pointer address detected.
- fault = SAError!14,
-
- /// No such device.
- noSuchDevice = NativeError!(19, 20),
-
- /// An invalid argument was supplied.
- invalidArgument = SAError!22,
-
- /// The limit on the number of open file descriptors.
- tooManyDescriptors = NativeError!(23, 331),
-
- /// The limit on the number of open file descriptors.
- noDescriptors = SAError!24,
-
- /// Broken pipe.
- brokenPipe = NativeError!(32, 109),
-
- /// The name was too long.
- nameTooLong = SAError!(36, 63),
-
- /// A socket operation was attempted on a non-socket.
- notSocket = SAError!(88, 38),
-
- /// Protocol error.
- protocolError = eProtocolError,
-
- /// Message too long.
- messageTooLong = SAError!(90, 40),
-
- /// Wrong protocol type for socket.
- wrongProtocolType = SAError!(91, 41),
-
- /// Protocol not available.
- noProtocolOption = SAError!(92, 42),
-
- /// The protocol is not implemented or has not been configured.
- protocolNotSupported = SAError!(93, 43),
-
- /// The support for the specified socket type does not exist in this
- /// address family.
- socketNotSupported = SAError!(94, 44),
-
- /// The address family is no supported by the protocol family.
- operationNotSupported = SAError!(95, 45),
-
- /// Address family specified is not supported.
- addressFamilyNotSupported = SAError!(97, 47),
-
- /// Address already in use.
- addressInUse = SAError!(98, 48),
-
- /// The network is not available.
- networkDown = SAError!(100, 50),
-
- /// No route to host.
- networkUnreachable = SAError!(101, 51),
-
- /// Network dropped connection because of reset.
- networkReset = SAError!(102, 52),
-
- /// The connection has been aborted.
- connectionAborted = SAError!(103, 53),
-
- /// Connection reset by peer.
- connectionReset = SAError!(104, 54),
-
- /// No free buffer space is available for a socket operation.
- noBufferSpace = SAError!(105, 55),
-
- /// Transport endpoint is already connected.
- alreadyConnected = SAError!(106, 56),
-
- /// Transport endpoint is not connected.
- notConnected = SAError!(107, 57),
-
- /// Cannot send after transport endpoint shutdown.
- shutdown = SAError!(108, 58),
-
- /// The connection attempt timed out, or the connected host has failed
- /// to respond.
- timedOut = SAError!(110, 60),
-
- /// Connection refused.
- connectionRefused = SAError!(111, 61),
-
- /// Host is down.
- hostDown = SAError!(112, 64),
-
- /// No route to host.
- hostUnreachable = SAError!(113, 65),
-
- /// Operation already in progress.
- alreadyStarted = SAError!(114, 37),
-
- /// Operation now in progress.
- inProgress = SAError!(115, 36),
-
- /// Operation cancelled.
- cancelled = SAError!(125, 103),
- }
-
- /**
- * Error descriptions.
- */
- private enum ErrorStr : string
- {
- success = "The operation completed successfully",
- noPermission = "Operation not permitted",
- interrupted = "Interrupted system call",
- badDescriptor = "Bad file descriptor",
- wouldBlock = "An operation on a non-blocking socket would block",
- noMemory = "Out of memory",
- accessDenied = "Access denied",
- fault = "An invalid pointer address detected",
- noSuchDevice = "No such device",
- invalidArgument = "An invalid argument was supplied",
- tooManyDescriptors = "The limit on the number of open file descriptors",
- noDescriptors = "The limit on the number of open file descriptors",
- brokenPipe = "Broken pipe",
- nameTooLong = "The name was too long",
- notSocket = "A socket operation was attempted on a non-socket",
- protocolError = "Protocol error",
- messageTooLong = "Message too long",
- wrongProtocolType = "Wrong protocol type for socket",
- noProtocolOption = "Protocol not available",
- protocolNotSupported = "The protocol is not implemented or has not been configured",
- socketNotSupported = "Socket type not supported",
- operationNotSupported = "The address family is no supported by the protocol family",
- addressFamilyNotSupported = "Address family specified is not supported",
- addressInUse = "Address already in use",
- networkDown = "The network is not available",
- networkUnreachable = "No route to host",
- networkReset = "Network dropped connection because of reset",
- connectionAborted = "The connection has been aborted",
- connectionReset = "Connection reset by peer",
- noBufferSpace = "No free buffer space is available for a socket operation",
- alreadyConnected = "Transport endpoint is already connected",
- notConnected = "Transport endpoint is not connected",
- shutdown = "Cannot send after transport endpoint shutdown",
- timedOut = "Operation timed out",
- connectionRefused = "Connection refused",
- hostDown = "Host is down",
- hostUnreachable = "No route to host",
- alreadyStarted = "Operation already in progress",
- inProgress = "Operation now in progress",
- cancelled = "Operation cancelled",
- }
-
- /**
- * Constructor.
- *
- * Params:
- * value = Numeric error code.
- */
- this(const ErrorNo value) @nogc nothrow pure @safe
- {
- this.value_ = value;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec;
- assert(ec == ErrorCode.success);
-
- ec = ErrorCode.fault;
- assert(ec == ErrorCode.fault);
- }
-
- /**
- * Resets this $(D_PSYMBOL ErrorCode) to default
- * ($(D_PSYMBOL ErrorCode.success)).
- */
- void reset() @nogc nothrow pure @safe
- {
- this.value_ = ErrorNo.success;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- auto ec = ErrorCode(ErrorCode.fault);
- assert(ec == ErrorCode.fault);
-
- ec.reset();
- assert(ec == ErrorCode.success);
- }
-
- /**
- * Returns: Numeric error code.
- */
- ErrorNo opCast(T : ErrorNo)() const
- {
- return this.value_;
- }
-
- /// ditto
- ErrorNo opCast(T : int)() const
- {
- return this.value_;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec = ErrorCode.fault;
- auto errorNo = cast(ErrorCode.ErrorNo) ec;
-
- assert(errorNo == ErrorCode.fault);
- static assert(is(typeof(cast(int) ec)));
- }
-
- /**
- * Assigns another error code or error code number.
- *
- * Params:
- * that = Numeric error code.
- *
- * Returns: $(D_KEYWORD this).
- */
- ref ErrorCode opAssign(const ErrorNo that) @nogc nothrow pure @safe
- {
- this.value_ = that;
- return this;
- }
-
- /// ditto
- ref ErrorCode opAssign(const ErrorCode that) @nogc nothrow pure @safe
- {
- this.value_ = that.value_;
- return this;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec;
- assert(ec == ErrorCode.success);
-
- ec = ErrorCode.fault;
- assert(ec == ErrorCode.fault);
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- auto ec1 = ErrorCode(ErrorCode.fault);
- ErrorCode ec2;
- assert(ec2 == ErrorCode.success);
-
- ec2 = ec1;
- assert(ec1 == ec2);
- }
-
- /**
- * Equality with another error code or error code number.
- *
- * Params:
- * that = Numeric error code.
- *
- * Returns: Whether $(D_KEYWORD this) and $(D_PARAM that) are equal.
- */
- bool opEquals(const ErrorNo that) const @nogc nothrow pure @safe
- {
- return this.value_ == that;
- }
-
- /// ditto
- bool opEquals(const ErrorCode that) const @nogc nothrow pure @safe
- {
- return this.value_ == that.value_;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec1 = ErrorCode.fault;
- ErrorCode ec2 = ErrorCode.accessDenied;
-
- assert(ec1 != ec2);
- assert(ec1 != ErrorCode.accessDenied);
- assert(ErrorCode.fault != ec2);
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec1 = ErrorCode.fault;
- ErrorCode ec2 = ErrorCode.fault;
-
- assert(ec1 == ec2);
- assert(ec1 == ErrorCode.fault);
- assert(ErrorCode.fault == ec2);
- }
-
- /**
- * Returns string describing the error number. If a description for a
- * specific error number is not available, returns $(D_KEYWORD null).
- *
- * Returns: String describing the error number.
- */
- string toString() const @nogc nothrow pure @safe
- {
- foreach (e; __traits(allMembers, ErrorNo))
- {
- if (__traits(getMember, ErrorNo, e) == this.value_)
- {
- return __traits(getMember, ErrorStr, e);
- }
- }
- return null;
- }
-
- ///
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec = ErrorCode.fault;
- assert(ec.toString() == "An invalid pointer address detected");
- }
-
- @nogc nothrow pure @safe unittest
- {
- ErrorCode ec = cast(ErrorCode.ErrorNo) -1;
- assert(ec.toString() is null);
- }
-
- private ErrorNo value_ = ErrorNo.success;
-
- alias ErrorNo this;
-}
diff --git a/source/tanya/os/package.d b/source/tanya/os/package.d
deleted file mode 100644
index 5292a8a..0000000
--- a/source/tanya/os/package.d
+++ /dev/null
@@ -1,18 +0,0 @@
-/* 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/. */
-
-/**
- * This package provides platform-independent interfaces to operating system
- * functionality.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/os/package.d,
- * tanya/os/package.d)
- */
-module tanya.os;
-
-public import tanya.os.error;
diff --git a/source/tanya/sys/linux/syscall.d b/source/tanya/sys/linux/syscall.d
deleted file mode 100644
index e70f75a..0000000
--- a/source/tanya/sys/linux/syscall.d
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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/. */
-
-/*
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/linux/syscall.d,
- * tanya/sys/linux/syscall.d)
- */
-module tanya.sys.linux.syscall;
-
-version (TanyaNative):
-
-extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t)
-@nogc nothrow @system;
-
-extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t, ptrdiff_t)
-@nogc nothrow @system;
-
-extern ptrdiff_t syscall(ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t)
-@nogc nothrow @system;
-
-extern ptrdiff_t syscall(ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t) @nogc nothrow @system;
-
-// Same syscalls as above but pure.
-private template getOverloadMangling(size_t n)
-{
- enum string getOverloadMangling = __traits(getOverloads,
- tanya.sys.linux.syscall,
- "syscall")[n].mangleof;
-}
-
-pragma(mangle, getOverloadMangling!0)
-extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t)
-@nogc nothrow pure @system;
-
-pragma(mangle, getOverloadMangling!1)
-extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t, ptrdiff_t)
-@nogc nothrow pure @system;
-
-pragma(mangle, getOverloadMangling!2)
-extern ptrdiff_t syscall_(ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t)
-@nogc nothrow pure @system;
-
-pragma(mangle, getOverloadMangling!3)
-extern ptrdiff_t syscall_(ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t,
- ptrdiff_t) @nogc nothrow pure @system;
diff --git a/source/tanya/sys/posix/ioctl.d b/source/tanya/sys/posix/ioctl.d
deleted file mode 100644
index abd8f84..0000000
--- a/source/tanya/sys/posix/ioctl.d
+++ /dev/null
@@ -1,78 +0,0 @@
-/* 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/. */
-
-/*
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/posix/ioctl.d,
- * tanya/sys/posix/ioctl.d)
- */
-module tanya.sys.posix.ioctl;
-
-version (TanyaNative):
-
-enum
-{
- SIOCADDRT = 0x890B, // Add routing table entry.
- SIOCDELRT = 0x890C, // Delete routing table entry.
- SIOCRTMSG = 0x890D, // Call to routing system.
-
- SIOCGIFNAME = 0x8910, // Get iface name.
- SIOCSIFLINK = 0x8911, // Set iface channel.
- SIOCGIFCONF = 0x8912, // Get iface list.
- SIOCGIFFLAGS = 0x8913, // Get flags.
- SIOCSIFFLAGS = 0x8914, // Set flags.
- SIOCGIFADDR = 0x8915, // Get PA address.
- SIOCSIFADDR = 0x8916, // Set PA address.
- SIOCGIFDSTADDR = 0x8917, // Get remote PA address.
- SIOCSIFDSTADDR = 0x8918, // Set remote PA address.
- SIOCGIFBRDADDR = 0x8919, // Get broadcast PA address.
- SIOCSIFBRDADDR = 0x891a, // Set broadcast PA address.
- SIOCGIFNETMASK = 0x891b, // Get network PA mask.
- SIOCSIFNETMASK = 0x891c, // Set network PA mask.
- SIOCGIFMETRIC = 0x891d, // Get metric.
- SIOCSIFMETRIC = 0x891e, // Set metric.
- SIOCGIFMEM = 0x891f, // Get memory address (BSD).
- SIOCSIFMEM = 0x8920, // Set memory address (BSD).
- SIOCGIFMTU = 0x8921, // Get MTU size.
- SIOCSIFMTU = 0x8922, // Set MTU size.
- SIOCSIFNAME = 0x8923, // Set interface name.
- SIOCSIFHWADDR = 0x8924, // Set hardware address.
- SIOCGIFENCAP = 0x8925, // Get/set encapsulations.
- SIOCSIFENCAP = 0x8926,
- SIOCGIFHWADDR = 0x8927, // Get hardware address.
- SIOCGIFSLAVE = 0x8929, // Driver slaving support.
- SIOCSIFSLAVE = 0x8930,
- SIOCADDMULTI = 0x8931, // Multicast address lists.
- SIOCDELMULTI = 0x8932,
- SIOCGIFINDEX = 0x8933, // Name -> if_index mapping.
- SIOGIFINDEX = SIOCGIFINDEX, // Misprint compatibility.
- SIOCSIFPFLAGS = 0x8934, // Set/get extended flags set.
- SIOCGIFPFLAGS = 0x8935,
- SIOCDIFADDR = 0x8936, // Delete PA address.
- SIOCSIFHWBROADCAST = 0x8937, // Set hardware broadcast address.
- SIOCGIFCOUNT = 0x8938, // Get number of devices.
-
- SIOCGIFBR = 0x8940, // Bridging support.
- SIOCSIFBR = 0x8941, // Set bridging options.
-
- SIOCGIFTXQLEN = 0x8942, // Get the tx queue length.
- SIOCSIFTXQLEN = 0x8943, // Set the tx queue length.
-
- SIOCDARP = 0x8953, // Delete ARP table entry.
- SIOCGARP = 0x8954, // Get ARP table entry.
- SIOCSARP = 0x8955, // Set ARP table entry.
-
- SIOCDRARP = 0x8960, // Delete RARP table entry.
- SIOCGRARP = 0x8961, // Get RARP table entry.
- SIOCSRARP = 0x8962, // Set RARP table entry.
-
- SIOCGIFMAP = 0x8970, // Get device parameters.
- SIOCSIFMAP = 0x8971, // Set device parameters.
-
- SIOCADDDLCI = 0x8980, // Create new DLCI device.
- SIOCDELDLCI = 0x8981, // Delete DLCI device.
-}
diff --git a/source/tanya/sys/posix/mman.d b/source/tanya/sys/posix/mman.d
deleted file mode 100644
index dbf78a9..0000000
--- a/source/tanya/sys/posix/mman.d
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 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/. */
-
-/*
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/posix/mman.d,
- * tanya/sys/posix/mman.d)
- */
-module tanya.sys.posix.mman;
-
-version (TanyaNative):
-
-enum
-{
- PROT_EXEC = 0x4, // Page can be executed.
- PROT_NONE = 0x0, // Page cannot be accessed.
- PROT_READ = 0x1, // Page can be read.
- PROT_WRITE = 0x2, // Page can be written.
-}
-
-enum
-{
- MAP_FIXED = 0x10, // Interpret addr exactly.
- MAP_PRIVATE = 0x02, // Changes are private.
- MAP_SHARED = 0x01, // Share changes.
- MAP_ANONYMOUS = 0x20, // Don't use a file.
-}
diff --git a/source/tanya/sys/posix/net/if_.d b/source/tanya/sys/posix/net/if_.d
deleted file mode 100644
index e72cc04..0000000
--- a/source/tanya/sys/posix/net/if_.d
+++ /dev/null
@@ -1,27 +0,0 @@
-/* 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/. */
-
-/*
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/posix/net/if_.d,
- * tanya/sys/posix/net/if_.d)
- */
-module tanya.sys.posix.net.if_;
-
-version (TanyaNative):
-
-enum size_t IF_NAMESIZE = 16;
-
-struct ifreq
-{
- char[IF_NAMESIZE] ifr_name;
-
- union
- {
- int ifr_ifindex;
- }
-}
diff --git a/source/tanya/sys/posix/socket.d b/source/tanya/sys/posix/socket.d
deleted file mode 100644
index 9708f04..0000000
--- a/source/tanya/sys/posix/socket.d
+++ /dev/null
@@ -1,152 +0,0 @@
-/* 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/. */
-
-/*
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/posix/socket.d,
- * tanya/sys/posix/socket.d)
- */
-module tanya.sys.posix.socket;
-
-version (TanyaNative):
-
-/*
- * Protocol families.
- */
-enum
-{
- PF_UNSPEC = 0, // Unspecified.
- PF_LOCAL = 1, // Local to host (pipes and file-domain).
- PF_UNIX = PF_LOCAL, // POSIX name for PF_LOCAL.
- PF_FILE = PF_LOCAL, // Another non-standard name for PF_LOCAL.
- PF_INET = 2, // IP protocol family.
- PF_AX25 = 3, // Amateur Radio AX.25.
- PF_IPX = 4, // Novell Internet Protocol.
- PF_APPLETALK = 5, // Appletalk DDP.
- PF_NETROM = 6, // Amateur radio NetROM.
- PF_BRIDGE = 7, // Multiprotocol bridge.
- PF_ATMPVC = 8, // ATM PVCs.
- PF_X25 = 9, // Reserved for X.25 project.
- PF_INET6 = 10, // IP version 6.
- PF_ROSE = 11, // Amateur Radio X.25 PLP.
- PF_DECnet = 12, // Reserved for DECnet project.
- PF_NETBEUI = 13, // Reserved for 802.2LLC project.
- PF_SECURITY = 14, // Security callback pseudo AF.
- PF_KEY = 15, // PF_KEY key management API.
- PF_NETLINK = 16, // Kernel user interface device.
- PF_ROUTE = PF_NETLINK, // Alias to emulate 4.4BSD.
- PF_PACKET = 17, // Packet family.
- PF_ASH = 18, // Ash.
- PF_ECONET = 19, // Acorn Econet.
- PF_ATMSVC = 20, // ATM SVCs.
- PF_RDS = 21, // RDS sockets.
- PF_SNA = 22, // Linux SNA Project.
- PF_IRDA = 23, // IRDA sockets.
- PF_PPPOX = 24, // PPPoX sockets.
- PF_WANPIPE = 25, // Wanpipe API sockets.
- PF_LLC = 26, // Linux LLC.
- PF_IB = 27, // Native InfiniBand address.
- PF_MPLS = 28, // MPLS.
- PF_CAN = 29, // Controller Area Network.
- PF_TIPC = 30, // TIPC sockets.
- PF_BLUETOOTH = 31, // Bluetooth sockets.
- PF_IUCV = 32, // IUCV sockets.
- PF_RXRPC = 33, // RxRPC sockets.
- PF_ISDN = 34, // mISDN sockets.
- PF_PHONET = 35, // Phonet sockets.
- PF_IEEE802154 = 36, // IEEE 802.15.4 sockets.
- PF_CAIF = 37, // CAIF sockets.
- PF_ALG = 38, // Algorithm sockets.
- PF_NFC = 39, // NFC sockets.
- PF_VSOCK = 40, // vSockets.
- PF_MAX = 41, // For now.
-}
-
-/*
- * Address families.
- */
-enum
-{
- AF_UNSPEC = PF_UNSPEC,
- AF_LOCAL = PF_LOCAL,
- AF_UNIX = PF_UNIX,
- AF_FILE = PF_FILE,
- AF_INET = PF_INET,
- AF_AX25 = PF_AX25,
- AF_IPX = PF_IPX,
- AF_APPLETALK = PF_APPLETALK,
- AF_NETROM = PF_NETROM,
- AF_BRIDGE = PF_BRIDGE,
- AF_ATMPVC = PF_ATMPVC,
- AF_X25 = PF_X25,
- AF_INET6 = PF_INET6,
- AF_ROSE = PF_ROSE,
- AF_DECnet = PF_DECnet,
- AF_NETBEUI = PF_NETBEUI,
- AF_SECURITY = PF_SECURITY,
- AF_KEY = PF_KEY,
- AF_NETLINK = PF_NETLINK,
- AF_ROUTE = PF_ROUTE,
- AF_PACKET = PF_PACKET,
- AF_ASH = PF_ASH,
- AF_ECONET = PF_ECONET,
- AF_ATMSVC = PF_ATMSVC,
- AF_RDS = PF_RDS,
- AF_SNA = PF_SNA,
- AF_IRDA = PF_IRDA,
- AF_PPPOX = PF_PPPOX,
- AF_WANPIPE = PF_WANPIPE,
- AF_LLC = PF_LLC,
- AF_IB = PF_IB,
- AF_MPLS = PF_MPLS,
- AF_CAN = PF_CAN,
- AF_TIPC = PF_TIPC,
- AF_BLUETOOTH = PF_BLUETOOTH,
- AF_IUCV = PF_IUCV,
- AF_RXRPC = PF_RXRPC,
- AF_ISDN = PF_ISDN,
- AF_PHONET = PF_PHONET,
- AF_IEEE802154 = PF_IEEE802154,
- AF_CAIF = PF_CAIF,
- AF_ALG = PF_ALG,
- AF_NFC = PF_NFC,
- AF_VSOCK = PF_VSOCK,
- AF_MAX = PF_MAX,
-}
-
-/*
- * Types of sockets.
- */
-enum
-{
- // Sequenced, reliable, connection-based byte streams.
- SOCK_STREAM = 1,
- // Connectionless, unreliable datagrams of fixed maximum length.
- SOCK_DGRAM = 2,
- // Raw protocol interface.
- SOCK_RAW = 3,
- // Reliably-delivered messages.
- SOCK_RDM = 4,
- // Sequenced, reliable, connection-based, datagrams of fixed maximum
- // length.
- SOCK_SEQPACKET = 5,
- // Datagram Congestion Control Protocol.
- SOCK_DCCP = 6,
- // Linux specific way of getting packets at the dev level. For writing rarp
- // and other similar things on the user level.
- SOCK_PACKET = 10,
-}
-
-/*
- * Flags to be ORed into the type parameter of socket and socketpair and used
- * for the flags parameter of paccept.
- */
-enum
-{
- SOCK_CLOEXEC = 0x80000, // Atomically set close-on-exec flag for the new descriptor(s).
- SOCK_NONBLOCK = 0x800, // Atomically mark descriptor(s) as non-blocking.
-}
diff --git a/source/tanya/sys/windows/def.d b/source/tanya/sys/windows/def.d
deleted file mode 100644
index ea37266..0000000
--- a/source/tanya/sys/windows/def.d
+++ /dev/null
@@ -1,66 +0,0 @@
-/* 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/. */
-
-/**
- * Base type definitions and aliases.
- *
- * This module doesn't provide aliases for all types used by Windows, but only
- * for types that can vary on different platforms. For example there is no
- * need to define `INT32` alias for D, since $(D_KEYWORD int) is always a
- * 32-bit signed integer. But `int` and its Windows alias `INT` is not the
- * same on all platforms in C, so its size can be something differen than
- * 32 bit, therefore an $(D_PSYMBOL INT) alias is available in this module.
- * $(D_PARAM TCHAR) can be a $(D_KEYWORD char) if Unicode isn't supported or
- * $(D_KEYWORD wchar) if Unicode is supported, so $(D_PSYMBOL TCHAR) is
- * defined here.
- * Also aliases for specific types like $(D_PSYMBOL SOCKET) are defined here.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/def.d,
- * tanya/sys/windows/def.d)
- */
-module tanya.sys.windows.def;
-
-version (Windows):
-
-alias BYTE = ubyte;
-alias TBYTE = wchar; // If Unicode, otherwise char.
-alias CHAR = char; // Signed or unsigned char.
-alias WCHAR = wchar;
-alias TCHAR = wchar; // If Unicode, otherwise char.
-alias SHORT = short;
-alias USHORT = ushort;
-alias WORD = ushort;
-alias INT = int;
-alias UINT = uint;
-alias LONG = int;
-alias ULONG = uint;
-alias DWORD = uint;
-alias LONGLONG = long; // Or double.
-alias ULONGLONG = ulong; // Or double.
-alias DWORDLONG = ulong;
-alias FLOAT = float;
-alias BOOL = int;
-alias BOOLEAN = BYTE;
-
-alias HANDLE = void*;
-enum HANDLE INVALID_HANDLE_VALUE = cast(HANDLE) -1;
-
-enum TRUE = 1;
-enum FALSE = 0;
-
-alias PSTR = CHAR*;
-alias PWSTR = WCHAR*;
-alias PTSTR = TCHAR*;
-
-align(1) struct GUID
-{
- uint Data1;
- ushort Data2;
- ushort Data3;
- char[8] Data4;
-}
diff --git a/source/tanya/sys/windows/ifdef.d b/source/tanya/sys/windows/ifdef.d
deleted file mode 100644
index 89e1c3f..0000000
--- a/source/tanya/sys/windows/ifdef.d
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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/. */
-
-/**
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/ifdef.d,
- * tanya/sys/windows/ifdef.d)
- */
-module tanya.sys.windows.ifdef;
-
-version (Windows):
-
-import tanya.sys.windows.def;
-
-union NET_LUID_LH
-{
- ulong Value;
- ulong Info;
-}
-
-alias NET_LUID = NET_LUID_LH;
-alias IF_LUID = NET_LUID_LH;
-
-alias NET_IFINDEX = ULONG;
-
-enum size_t IF_MAX_STRING_SIZE = 256;
diff --git a/source/tanya/sys/windows/iphlpapi.d b/source/tanya/sys/windows/iphlpapi.d
deleted file mode 100644
index 002d2f5..0000000
--- a/source/tanya/sys/windows/iphlpapi.d
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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/. */
-
-/**
- * Copyright: Eugene Wissner 2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/iphlpapi.d,
- * tanya/sys/windows/iphlpapi.d)
- */
-module tanya.sys.windows.iphlpapi;
-
-version (Windows):
-
-import tanya.sys.windows.def;
-import tanya.sys.windows.ifdef;
-
-extern(Windows)
-DWORD ConvertInterfaceNameToLuidA(const(CHAR)* InterfaceName,
- NET_LUID* InterfaceLuid)
-@nogc nothrow @system;
-
-extern(Windows)
-DWORD ConvertInterfaceLuidToIndex(const(NET_LUID)* InterfaceLuid,
- NET_IFINDEX* InterfaceIndex)
-@nogc nothrow @system;
-
-extern(Windows)
-DWORD ConvertInterfaceIndexToLuid(NET_IFINDEX InterfaceIndex,
- NET_LUID* InterfaceLuid)
-@nogc nothrow @system;
-
-extern(Windows)
-DWORD ConvertInterfaceLuidToNameA(const(NET_LUID)* InterfaceLuid,
- PSTR InterfaceName,
- size_t Length)
-@nogc nothrow @system;
diff --git a/source/tanya/sys/windows/package.d b/source/tanya/sys/windows/package.d
deleted file mode 100644
index 120013f..0000000
--- a/source/tanya/sys/windows/package.d
+++ /dev/null
@@ -1,21 +0,0 @@
-/* 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/. */
-
-/**
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/package.d,
- * tanya/sys/windows/package.d)
- */
-module tanya.sys.windows;
-
-version (Windows):
-
-public import tanya.sys.windows.def;
-public import tanya.sys.windows.ifdef;
-public import tanya.sys.windows.iphlpapi;
-public import tanya.sys.windows.winbase;
-public import tanya.sys.windows.winsock2;
diff --git a/source/tanya/sys/windows/winbase.d b/source/tanya/sys/windows/winbase.d
deleted file mode 100644
index 02978a3..0000000
--- a/source/tanya/sys/windows/winbase.d
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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/. */
-
-/**
- * Definitions from winbase.h.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/winbase.d,
- * tanya/sys/windows/winbase.d)
- */
-module tanya.sys.windows.winbase;
-
-version (Windows):
-
-public import tanya.sys.windows.def;
-
-struct OVERLAPPED
-{
- size_t Internal;
- size_t InternalHigh;
- union
- {
- struct
- {
- DWORD Offset;
- DWORD OffsetHigh;
- }
- void* Pointer;
- }
- HANDLE hEvent;
-}
-
-extern(Windows)
-HANDLE CreateIoCompletionPort(HANDLE FileHandle,
- HANDLE ExistingCompletionPort,
- size_t CompletionKey,
- DWORD NumberOfConcurrentThreads)
-nothrow @system @nogc;
-
-extern(Windows)
-BOOL GetQueuedCompletionStatus(HANDLE CompletionPort,
- DWORD* lpNumberOfBytes,
- size_t* lpCompletionKey,
- OVERLAPPED** lpOverlapped,
- DWORD dwMilliseconds) nothrow @system @nogc;
-
-extern(Windows)
-BOOL GetOverlappedResult(HANDLE hFile,
- OVERLAPPED* lpOverlapped,
- DWORD* lpNumberOfBytesTransferred,
- BOOL bWait) nothrow @system @nogc;
diff --git a/source/tanya/sys/windows/winsock2.d b/source/tanya/sys/windows/winsock2.d
deleted file mode 100644
index 8a00ed9..0000000
--- a/source/tanya/sys/windows/winsock2.d
+++ /dev/null
@@ -1,219 +0,0 @@
-/* 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/. */
-
-/**
- * Definitions from winsock2.h, ws2def.h and MSWSock.h.
- *
- * Copyright: Eugene Wissner 2017-2018.
- * 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)
- * Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/winsock2.d,
- * tanya/sys/windows/winsock2.d)
- */
-module tanya.sys.windows.winsock2;
-
-version (Windows):
-
-public import tanya.sys.windows.def;
-public import tanya.sys.windows.winbase;
-
-alias SOCKET = size_t;
-enum SOCKET INVALID_SOCKET = ~0;
-enum SOCKET_ERROR = -1;
-
-enum
-{
- IOC_UNIX = 0x00000000,
- IOC_WS2 = 0x08000000,
- IOC_PROTOCOL = 0x10000000,
- IOC_VOID = 0x20000000, // No parameters.
- IOC_OUT = 0x40000000, // Copy parameters back.
- IOC_IN = 0x80000000, // Copy parameters into.
- IOC_VENDOR = 0x18000000,
- IOC_WSK = (IOC_WS2 | 0x07000000), // _WIN32_WINNT >= 0x0600.
- IOC_INOUT = (IOC_IN | IOC_OUT), // Copy parameter into and get back.
-}
-
-template _WSAIO(int x, int y)
-{
- enum _WSAIO = IOC_VOID | x | y;
-}
-template _WSAIOR(int x, int y)
-{
- enum _WSAIOR = IOC_OUT | x | y;
-}
-template _WSAIOW(int x, int y)
-{
- enum _WSAIOW = IOC_IN | x | y;
-}
-template _WSAIORW(int x, int y)
-{
- enum _WSAIORW = IOC_INOUT | x | y;
-}
-
-alias SIO_ASSOCIATE_HANDLE = _WSAIOW!(IOC_WS2, 1);
-alias SIO_ENABLE_CIRCULAR_QUEUEING = _WSAIO!(IOC_WS2, 2);
-alias SIO_FIND_ROUTE = _WSAIOR!(IOC_WS2, 3);
-alias SIO_FLUSH = _WSAIO!(IOC_WS2, 4);
-alias SIO_GET_BROADCAST_ADDRESS = _WSAIOR!(IOC_WS2, 5);
-alias SIO_GET_EXTENSION_FUNCTION_POINTER = _WSAIORW!(IOC_WS2, 6);
-alias SIO_GET_QOS = _WSAIORW!(IOC_WS2, 7);
-alias SIO_GET_GROUP_QOS = _WSAIORW!(IOC_WS2, 8);
-alias SIO_MULTIPOINT_LOOPBACK = _WSAIOW!(IOC_WS2, 9);
-alias SIO_MULTICAST_SCOPE = _WSAIOW!(IOC_WS2, 10);
-alias SIO_SET_QOS = _WSAIOW!(IOC_WS2, 11);
-alias SIO_SET_GROUP_QOS = _WSAIOW!(IOC_WS2, 12);
-alias SIO_TRANSLATE_HANDLE = _WSAIORW!(IOC_WS2, 13);
-alias SIO_ROUTING_INTERFACE_QUERY = _WSAIORW!(IOC_WS2, 20);
-alias SIO_ROUTING_INTERFACE_CHANGE = _WSAIOW!(IOC_WS2, 21);
-alias SIO_ADDRESS_LIST_QUERY = _WSAIOR!(IOC_WS2, 22);
-alias SIO_ADDRESS_LIST_CHANGE = _WSAIO!(IOC_WS2, 23);
-alias SIO_QUERY_TARGET_PNP_HANDLE = _WSAIOR!(IOC_WS2, 24);
-alias SIO_NSP_NOTIFY_CHANGE = _WSAIOW!(IOC_WS2, 25);
-
-alias GROUP = uint;
-
-enum
-{
- WSA_FLAG_OVERLAPPED = 0x01,
- WSA_FLAG_MULTIPOINT_C_ROOT = 0x02,
- WSA_FLAG_MULTIPOINT_C_LEAF = 0x04,
- WSA_FLAG_MULTIPOINT_D_ROOT = 0x08,
- WSA_FLAG_MULTIPOINT_D_LEAF = 0x10,
- WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40,
- WSA_FLAG_NO_HANDLE_INHERIT = 0x80,
- WSA_FLAG_REGISTERED_IO = 0x100,
-}
-
-enum MAX_PROTOCOL_CHAIN = 7;
-enum BASE_PROTOCOL = 1;
-enum LAYERED_PROTOCOL = 0;
-enum WSAPROTOCOL_LEN = 255;
-
-struct WSAPROTOCOLCHAIN
-{
- int ChainLen;
- DWORD[MAX_PROTOCOL_CHAIN] ChainEntries;
-}
-
-struct WSABUF
-{
- ULONG len;
- CHAR* buf;
-}
-
-struct WSAPROTOCOL_INFO
-{
- DWORD dwServiceFlags1;
- DWORD dwServiceFlags2;
- DWORD dwServiceFlags3;
- DWORD dwServiceFlags4;
- DWORD dwProviderFlags;
- GUID ProviderId;
- DWORD dwCatalogEntryId;
- WSAPROTOCOLCHAIN ProtocolChain;
- int iVersion;
- int iAddressFamily;
- int iMaxSockAddr;
- int iMinSockAddr;
- int iSocketType;
- int iProtocol;
- int iProtocolMaxOffset;
- int iNetworkByteOrder;
- int iSecurityScheme;
- DWORD dwMessageSize;
- DWORD dwProviderReserved;
- TCHAR[WSAPROTOCOL_LEN + 1] szProtocol;
-}
-
-const GUID WSAID_GETACCEPTEXSOCKADDRS = {
- 0xb5367df2, 0xcbac, 0x11cf,
- [0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92],
-};
-
-const GUID WSAID_ACCEPTEX = {
- 0xb5367df1, 0xcbac, 0x11cf,
- [0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92],
-};
-
-alias LPWSAOVERLAPPED_COMPLETION_ROUTINE = void function(DWORD dwError,
- DWORD cbTransferred,
- OVERLAPPED* lpOverlapped,
- DWORD dwFlags) nothrow @nogc;
-
-extern(Windows)
-SOCKET WSASocket(int af,
- int type,
- int protocol,
- WSAPROTOCOL_INFO* lpProtocolInfo,
- GROUP g,
- DWORD dwFlags) nothrow @system @nogc;
-
-extern(Windows)
-int WSARecv(SOCKET s,
- WSABUF* lpBuffers,
- DWORD dwBufferCount,
- DWORD* lpNumberOfBytesRecvd,
- DWORD* lpFlags,
- OVERLAPPED* lpOverlapped,
- LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-nothrow @system @nogc;
-
-extern(Windows)
-int WSASend(SOCKET s,
- WSABUF* lpBuffers,
- DWORD dwBufferCount,
- DWORD* lpNumberOfBytesRecvd,
- DWORD lpFlags,
- OVERLAPPED* lpOverlapped,
- LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-nothrow @system @nogc;
-
-extern(Windows)
-int WSAIoctl(SOCKET s,
- uint dwIoControlCode,
- void* lpvInBuffer,
- uint cbInBuffer,
- void* lpvOutBuffer,
- uint cbOutBuffer,
- uint* lpcbBytesReturned,
- OVERLAPPED* lpOverlapped,
- LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-nothrow @system @nogc;
-
-alias ADDRESS_FAMILY = USHORT;
-
-struct SOCKADDR
-{
- ADDRESS_FAMILY sa_family; // Address family.
- CHAR[14] sa_data; // Up to 14 bytes of direct address.
-}
-
-alias LPFN_GETACCEPTEXSOCKADDRS = void function(void*,
- DWORD,
- DWORD,
- DWORD,
- SOCKADDR**,
- INT*,
- SOCKADDR**,
- INT*) nothrow @nogc;
-
-alias LPFN_ACCEPTEX = extern(Windows) BOOL function(SOCKET,
- SOCKET,
- void*,
- DWORD,
- DWORD,
- DWORD,
- DWORD*,
- OVERLAPPED*) @nogc nothrow;
-
-enum
-{
- SO_MAXDG = 0x7009,
- SO_MAXPATHDG = 0x700A,
- SO_UPDATE_ACCEPT_CONTEXT = 0x700B,
- SO_CONNECT_TIME = 0x700C,
- SO_UPDATE_CONNECT_CONTEXT = 0x7010,
-}