Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="rby-ox-fjA">
<rect key="frame" x="1" y="1" width="567" height="485"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView identifier="tabViewFLSM" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="ELH-v1-zWW" id="zYs-mh-V7e">
<rect key="frame" x="0.0" y="0.0" width="567" height="457"/>
Expand Down Expand Up @@ -1021,7 +1021,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView identifier="tabViewVLSM" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="SoM-fw-J5F" id="Xp5-Sj-frC">
<rect key="frame" x="0.0" y="0.0" width="579" height="457"/>
<rect key="frame" x="0.0" y="0.0" width="884" height="457"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -1063,12 +1063,12 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="nameVLSMCol" editable="NO" width="203.843994140625" minWidth="36.844001770019531" maxWidth="1000" id="rxF-Te-Q4K">
<tableColumn identifier="nameVLSMCol" width="203.843994140625" minWidth="36.844001770019531" maxWidth="1000" id="rxF-Te-Q4K">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Subnet Name">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" id="juC-wO-jPv">
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" id="juC-wO-jPv">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -1087,6 +1087,30 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="rangeVLSMCol" editable="NO" width="149.51300048828125" minWidth="60.01300048828125" maxWidth="1000" id="i5N-yj-4Gi">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Range">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" id="cBn-5z-Byv">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="broadcastVLSMCol" editable="NO" width="149.51300048828125" minWidth="60.01300048828125" maxWidth="1000" id="2mz-yz-Fkv">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Broadcast">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" id="mXd-Jc-hvk">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="b7w-M5-ti7" id="wKM-A7-jKm"/>
Expand All @@ -1103,7 +1127,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" wantsLayer="YES" id="SoM-fw-J5F">
<rect key="frame" x="0.0" y="0.0" width="579" height="28"/>
<rect key="frame" x="0.0" y="0.0" width="884" height="28"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SubnetCalc
Subnet Calculator for MacOS

What's New in version 2.1:
- FLSM (Fixed Length Subnet Mask) support
- VLSM (Variable Length Subnet Mask) support
- Export FSLM result in a CSV file
- Export VSLM result in a CSV file
What's New in version 2.2:
- Change the VLSM Subnet Name by editing the corresponding column
- Display Hosts Range and Broadcast columns in the VLSM view
- Export Hosts Range and Broadcast infos to the CSV file



For more information: http://subnetcalc.mulot.org
Expand Down
2 changes: 1 addition & 1 deletion SubnetCalc-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>JMUL</string>
<key>CFBundleVersion</key>
Expand Down
6 changes: 4 additions & 2 deletions SubnetCalc.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEVELOPMENT_TEAM = VNLK894MAE;
ENABLE_HARDENED_RUNTIME = YES;
GCC_DYNAMIC_NO_PIC = NO;
Expand All @@ -411,6 +411,7 @@
INFOPLIST_FILE = "SubnetCalc-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MARKETING_VERSION = 2.2;
PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc;
PRODUCT_NAME = SubnetCalc;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -429,7 +430,7 @@
CODE_SIGN_ENTITLEMENTS = SubnetCalc.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = VNLK894MAE;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -438,6 +439,7 @@
INFOPLIST_FILE = "SubnetCalc-Info.plist";
INSTALL_PATH = /Applications;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MARKETING_VERSION = 2.2;
PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc;
PRODUCT_NAME = SubnetCalc;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
45 changes: 42 additions & 3 deletions SubnetCalcAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,18 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
return 0
}

//Invoked when editing a value from a TabView
//Used only for VLSM Subnet Name
func tableView(_ tableView: NSTableView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, row: Int)
{
if (tableView == viewVLSM) {
if (tableColumn!.identifier.rawValue == "nameVLSMCol") {
//print("edit tableView Name VLSM: \(row) \(object as! String)")
subnetsVLSM[row].1 = object as! String
}
}
}

//Display all subnets info in the TableView Subnet/Hosts
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?,
row: Int) -> Any?
Expand Down Expand Up @@ -848,12 +860,38 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
else if (tableColumn!.identifier.rawValue == "usedVLSMCol") {
return (subnetsVLSM[row].2)
}
else if (tableColumn!.identifier.rawValue == "rangeVLSMCol") {
var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId())
if (row > 0) {
for index in (0...(row - 1)) {
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1
}
}
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0))
if (ipsc_tmp != nil)
{
return (ipsc_tmp!.subnetRange())
}
}
else if (tableColumn!.identifier.rawValue == "broadcastVLSMCol") {
var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId())
if (row > 0) {
for index in (0...(row - 1)) {
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1
}
}
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0))
if (ipsc_tmp != nil)
{
return (ipsc_tmp!.subnetBroadcast())
}
}
}
}
}
return (nil)
}

@IBAction func subnetBitsSlide(_ sender: AnyObject)
{
if (ipsc == nil)
Expand Down Expand Up @@ -1174,7 +1212,7 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
var cvsData = Data(capacity: Constants.BUFFER_LINES)
let cvsFile = FileHandle(forWritingAtPath: panel.url!.path)
if (cvsFile != nil) {
var cvsStr = "#;Subnet ID;Mask bits;Subnet Name;Used\n"
var cvsStr = "#;Subnet Name;Subnet ID;Mask bits;Hosts Range;Broadcast;Used\n"
let subnetid = IPSubnetCalc.numerize(ipAddress: self.ipsc!.subnetId())
for index in (0...(self.subnetsVLSM.count - 1)) {
var subnet = subnetid
Expand All @@ -1183,8 +1221,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: self.subnetsVLSM[index2].0) + 1
}
}
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: self.subnetsVLSM[index].0)!
//print("VLSM: \(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n")
cvsStr.append("\(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n")
cvsStr.append("\(index + 1);\(self.subnetsVLSM[index].1);\(ipsc_tmp.subnetId());\(self.subnetsVLSM[index].0);\(ipsc_tmp.subnetRange());\(ipsc_tmp.subnetBroadcast());\(self.subnetsVLSM[index].2)\n")
}
cvsData.append(cvsStr.data(using: String.Encoding.ascii)!)
cvsFile!.write(cvsData)
Expand Down