sipcalc 3.0.0

dotnet add package sipcalc --version 3.0.0
NuGet\Install-Package sipcalc -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="sipcalc" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add sipcalc --version 3.0.0
#r "nuget: sipcalc, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install sipcalc as a Cake Addin
#addin nuget:?package=sipcalc&version=3.0.0

// Install sipcalc as a Cake Tool
#tool nuget:?package=sipcalc&version=3.0.0
Remark befor start / Замечание перед началом

This manual is written in Russian and English. Данная инструкция составлена русском и английском. A little more details here (чуть более подробно здесь): https://gitlab.com/dmicher/ipcalc/-/wikis/home


English

The main functionality

The "Simple IP Calculator" module (sipcalc) allows you to get the basic parameters of an IPv4 network from its address and mask. The module also allows you to divide it into subnets according to one of the following principles:

  • divide the network equally into the specified number of subnets;
  • divide the network into subnets with variable size, specifying the sizes (in conneted hosts) of the subnets.

Main packet objects

Quatronima

A "Quatronima" object is a positive 32-bit integer that can be represented as 4 single bytes separated by a dot and written in decimal, binary or hexadecimal notation. With quatronima one can record a network, a host or a broadcast addresses, as well as mask and wildcard mask.

You can create them using: uint, byte[4], string "192.168.0.2" or "10101010.10101010.10101010.10101010" and a prefix (for masks only). Operators are defined for quatronimas: + - ~ ! > < ⇐ >= == Interfaces are defined for quatronima IEquatable и IComparable.

IPv4 Network (NetworkIPv4Info)

This object is a pair of quatronimas, one of which is a random address in the network, and the second one is the mask of this network. IPv4 network has a single constructor that requires to pass the address and mask to it. During initialization, it checks the mask for validity. After initial initialization there is no way to change the address or mask in this object.

Other network properties are calculated based on the address and mask.

For the network are defined: address and mssk passed to the constructor, as well as wildcard mask, network, broadcast, first host and last host addresses, and hosts counts.

Also, the basic ToString () method has been overwritten for an IPv4 network object. It returns a short record of the network address and mask now.

Calculator and exception objects created by it

The calculator object performs 3 basic operations:

  • returns the IPv4 Network object by the specified address and mask;
  • splits the specified network into equal parts;
  • splits the specified network into parts with different sizes.

All objects returned by the calculator are IPv4 Networks (or their enumerations). Each network - a set of two quatronimas, for which the corresponding functionality described above.

It is also worth noting the auxiliary Exception objects SipCalcException and their codes SipCalcExceptionCode that the calculator can generate. The exception object itself SipCalcException inherited directly from SystemException and will contain an internal exception if necessary. In addition, this object has a field containing an exception code that is only relevant to the SipCalc calculator.


Русский

Основной функционал

Модуль "Simple IP Calculator" (sipcalc) позволяет получить основные параметры сети IPv4, зная его адрес и маску. Также модуль позволяет разделить эту сеть на подсети по одному из принципов:

  • поровну поделить на указанное количество подсетей;
  • разделить на подсети с переменным размером, указав размеры (в соединяемых терминалах) подсетей.

Основные объекты пакета

Кватронима (Quatronima)

Под объектом "Кватронима" понимается целое положительное 32-разрядное число, которое может быть представлено в виде 4 отдельных байтов, разделённых точкой, и записанных в десятчной, двоичной или шестнадцатиричной системе счисления. Кватронимой может быть записаны адреса сети, терминалов, широковещательные, а также маска и обратная маска.

Кватрониму можно создать, используя uint, byte[4], string "192.168.0.2" или "10101010.10101010.10101010.10101010" или префикс (для масок). Для кватроним определены операторы: + - ~ ! > < ⇐ >= == Для кватроним определены интерфейсы IEquatable и IComparable.

Сеть IPv4 (NetworkIPv4Info)

Этот объект представляет собой пару кватроним, одна из которых - это произвольный адрес в сети, вторая - маска этой сети. Для сети IPv4 предусмотрен единственный конструктор, требующий передать ему адрес и маску. При инициализации проверяет маску на приемлемость. После первичной инициализации изменение адреса или маски в этом объекте не предусмотрено.

Другие свойства сети высчитываются на основе адреса и маски.

Для сети определяются: переданные адрес, маска, а также обратная маска, адрес сети, первого и последнего хостов, широковещательный адрес и количество адресов в сети.

Также для объекта сети IPv4 переопределён базовый метод ToString(), который возвращает краткую запись сетевого адреса и маски сети.

Калькулятор (Calculator) и объекты исключений, создаваемые им

Объект калькулятора производит 3 основные операции:

  • возвращает объект Сеть IPv4 по заданным адресу и маске;
  • разбивает указанную сеть на равные части;
  • разбивает указанную сеть на части, размеры которых отличаются.

Все объекты, возвращаемые калькулятором - Сеть IPv4 (или их перечисление). Каждая сеть - набор из двух кватроним, для которых доступен соответствующий функционал, описанный выше.

Здесь же стоит отметить вспомогательные объекты Исключений SipCalcException и их кодов SipCalcExceptionCode, которые калькулятор может сгенерировать. Сам объект исключения SipCalcException унаследован напрямую от SystemException и, при необходимости, будет содежать внутреннее исключение. Кроме того, у этого объекта имеется поле, содержащее код исключения, имеющий отношение только к калькулятору SipCalc.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 493 9/17/2020

Из пакета исключена логика вывода результатов расчётов в консоль. Теперь пакет будет удобнее использовать в ваших проектах.
The logic for displaying calculation results in the console is excluded from the package. Now the package will be easier to use in your projects.