ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzak1_5.4.0.1/rzak1advsubfinal.htm

294 lines
9.9 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- (C) Copyright IBM Corporation, 2005 -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<TITLE>TCP/IP subnet calculator</TITLE>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
<SCRIPT language="JavaScript" type="text/javascript">
<!-- //////////
var calcWindowMessage = "<body bgcolor='#FFFFCC'><h4>Writing Output...<\/h4><\/body>";
var calcWindowMessage1 = "<body bgcolor='#FFFFCC'><h4>Calculating...<\/h4><\/body>";
var throughmess = "through";
var tr1 = "<tr bgcolor='#CCCCCC'>";
var tr2 = "<tr>";
var text1 = "<table>";
var text2 = "<\/table>";
var text3 = "<form><center>";
var text5 = "<input type='button' value='&lt;&lt;&nbsp; Back&nbsp;' onclick='goback()'> ";
var text6 = "<input type='button' value='&lt;&lt;&nbsp;Show Previous 512&nbsp;' onclick='showbefore()'> ";
var text7 = "<input type='button' value='&nbsp;Show Next 512&nbsp;&gt;&gt;' onclick='showmore()'> ";
var text8 = "<input type='button' value='Start Over' onclick='startover()'>";
var text9 = "<\/form>";
var youroutput3 = "<h2>TCP/IP subnet calculator<\/h2>";
var youroutput2 = "<strong>Results for your subnets<\/strong>";
//START NON-TRANSLATABLE
//Obtain name of HTML file in parent frame.
var parentDir = parent.window.location.href.substring(0,location.href.lastIndexOf('/')+1);
var parentUrl = parent.window.location.href.substring(parentDir.length,parent.window.location.href.length+1);
if (parentUrl.indexOf("#") >= 0) {
parentUrl = parentUrl.substring(0,parentUrl.indexOf("#"));
}
//Is the hidden frame already loaded with the correct html?
if (parentUrl != "rzak1advsubwelcome.htm") {
window.location = "rzak1advsubwelcome.htm"; //load calculator frameset
} else {
//Obtain name of HTML file in hidden frame.
var hiddenDir = parent.hidden.window.location.href.substring(0,location.href.lastIndexOf('/')+1);
var hiddenUrl = parent.hidden.window.location.href.substring(hiddenDir.length,parent.hidden.window.location.href.length+1);
if (hiddenUrl.indexOf("#") >= 0) { hiddenUrl = hiddenUrl.substring(0,hiddenUrl.indexOf("#"));}
if (hiddenUrl != "rzak1advsubhidden.htm") {
//Correct HTML not loaded, load it
parent.window.location = "rzak1advsubwelcome.htm";
}
}
var num_subnets = parseInt(parent.hidden.data[5]);
var num_ips = parseInt(parent.hidden.data[4]);
var seg1 = parseInt(parent.hidden.data[1]);
var seg2 = parseInt(parent.hidden.data[2]);
var seg3 = parseInt(parent.hidden.data[3]);
var subnetmask = parent.hidden.data[6];
var placeholder = parseInt(parent.hidden.data[7]);
var seg4 = 0;
var newseg2 = seg2;
var newseg3 = seg3;
var newseg4 = 0;
var counter = 0;
var classb = 1;
var network = seg1 + "." + seg2 + "." + seg3 + "." + seg4;
var flipcounter = 0;
var done = 0;
var theTime = new Date();
var startTime;
calculatesubnets(); /* Call master function */
function calculatesubnets() {
// These direct to the counting routines. It only counts one time through.
if (placeholder == 0) {
if (num_ips <= 256) {
countless();
}
if ( num_ips>256 ) {
countmore();
}
}
// Done Calculating and storing
writeit(); // function writeit() displays writes the output
}
function countless() {
newseg4 = (seg4 + num_ips) - 1;
for (var j = 0; j < num_subnets; j++) {
jj = j + 1;
storeme(); // stores each line of output into an array on the hidden page.
seg4 = newseg4 + 1;
if (seg4 >= 255) {
seg3 = seg3 + 1;
seg4 = 0;
if (seg3 >= 256) {
seg2 = seg2+1;
seg3 = 0;
}
}
newseg4 = (seg4 + num_ips - 1);
newseg3 = seg3;
}
}
// COUNT MORE COUNT MORE COUNT MORE COUNT MORE COUNT MORE
function countmore() {
// Class B Subnetting Class B Subnetting Class B Subnetting
if ((num_ips * num_subnets) == 65536) {
counter = (num_ips / 256);
newseg3 = seg3 + counter-1;
newseg2 = seg2;
newseg4 = 255;
for (var j = 0; j < num_subnets; j++) {
jj = j+1;
storeme();
seg3 = newseg3 + 1;
newseg3 = newseg3 + counter;
}
} else {
// Class A Subnetting Class A Subnetting Class A Subnetting
counter = (num_ips / 65536);
newseg2 = seg2 + counter - 1;
newseg3 = 255;
newseg4 = 255;
for (var j = 0; j < num_subnets; j++) {
if (num_ips < 65536) {
counter = num_ips / 256;
newseg3 = seg3+counter - 1;
newseg2 = seg2;
if ( newseg3>=256 ) {
seg2 = seg2 + 1;
newseg2 = seg2;
seg3 = 0;
newseg3 = seg3 + counter - 1;
}
}
jj = j + 1;
storeme();
if (num_ips < 65536) {
seg3 = newseg3 + 1;
seg2 = newseg2;
} else {
seg2 = newseg2 + 1;
newseg2 = newseg2 + counter
}
}
}
}
function storeme() {
if ((jj % 2) != 0) {
parent.hidden.myarray[jj] = tr1;
} else {
parent.hidden.myarray[jj] = tr2;
}
var network = "<font size='1'>" + seg1 + "." + seg2 + "." + seg3 + "." + seg4;
var startaddress = "<font size='1'>" + seg1 + "." + seg2 + "." + seg3 + "." + (seg4 + 1);
var endaddress = "<font size='1'>" + seg1 + "." + newseg2 + "." + newseg3 + "." + (newseg4 - 1);
var broadcast = "<font size='1'>" + seg1 + "." + newseg2 + "." + newseg3 + "." + newseg4;
parent.hidden.myarray[jj] += "<td><font size='-1'>" + jj + "<\/td>";
parent.hidden.myarray[jj] += "<td>" + network + "<\/td>";
parent.hidden.myarray[jj] += "<td>" + startaddress + "<\/td>";
parent.hidden.myarray[jj] += "<td><font size='-1'>" + throughmess + "<\/td>";
parent.hidden.myarray[jj] += "<td>" + endaddress + "<\/td>";
parent.hidden.myarray[jj] += "<td>" + broadcast + "<\/td>";
parent.hidden.myarray[jj] += "<\/tr>"
}
function goback() {
// called by the back button. resets the placeholder value
parent.hidden.test();
//parent.hidden.document.DataObjects.storeValue(0, 7);
parent.hidden.data[7] = 0;
history.back();
}
function startover() {
// called by the startover button. goes to welcome page
window.location = "rzak1advsubwelcome.htm";
parent.hidden.resetData();
}
function writeit() {
document.write(youroutput3);
// Displays the line counter if num_subnets is greater than 512
if (num_subnets > 512 ) {
var begin = parseInt(parent.hidden.data[7]);
if (begin == 0) {
begin = 1;
}
var end = begin + 511;
//END NON-TRANSLATABLE
youroutput1 = "<br><strong> Results for <font color='#FF0000'>Subnets " + begin + " through " + end + "<\/font><\/strong>";
//START NON-TRANSLATABLE
document.write(youroutput1);
} else {
document.write(youroutput2);
}
// Headings for all ouput
//END NON-TRANSLATABLE
yournetworkaddress = "<ul><li>Your network address is " + network + ".<\/li>";
yourdata = "<li>You asked to subnet your network address into " + num_subnets + " subnets with " + num_ips + " IP addresses.<\/li>";
yoursubnetmask = "<li>Your subnet mask for each subnetwork is " + subnetmask + ".<p><\/li><\/ul>";
tableheader = "<tr><th id='COL1'><font size='1'><strong>Subnet no.<\/th><th id='COL2'><font size='1'><strong>Network address <\/th><th id='COL3'><font size='1'><strong>First host<\/th><th id='COL4'><\/th><th id='COL5'><font size='1'><strong>Last host<\/th><th id='COL6'><font size='1'><strong>Broadcast address<\/tH><\/tr>";
//START NON-TRANSLATABLE
document.write(yournetworkaddress);
document.write(yourdata);
document.write(yoursubnetmask);
document.write(text1);
document.write(tableheader);
if (placeholder == 0) {
writeplaceholder = 1;
} else {
writeplaceholder = placeholder;
}
for (var i = writeplaceholder; i < num_subnets + 1; i++) {
document.write(parent.hidden.myarray[i]);
// stops output at every 512 -- stores the number it stopped at
if ((i % 512 == 0) && (i != 0)) {
parent.hidden.data[7] = i+1;
break;
}
}
// this variable is where the segmented output stopped
var newplaceholder = parseInt(parent.hidden.data[7]);
document.write(text2);
document.write(text3);
//document.write(text4);
// displays the back button that goes to select size panel
if (newplaceholder <= 513) {
document.write(text5);
}
// displays the show previous page of subnets
if (((newplaceholder > num_subnets) || ((newplaceholder - 512) > 512)) && (newplaceholder != 513)) {
document.write(text6);
}
// shows the next page of subnets if it exists
if ((newplaceholder > 512) && (newplaceholder < num_subnets)) {
document.write(text7);
}
document.write(text8);
document.write(text9);
}
function showmore() {
// called when more subnets are needed. reloads the page. initiated by the show more button
window.location = "rzak1advsubfinal.htm";
}
function showbefore() {
// shows the previous page of subnets if exists. sets the counters backwards and recalls this page.
// initiated by the show previous button
var countback = parseInt(parent.hidden.data[7]);
countback = (countback - 512) - 512;
parent.hidden.document.data[7] = countback;
window.location = "rzak1advsubfinal.htm";
}
function printout() {
// called by the print button. brings up the print dialog
self.print();
}
//END NON-TRANSLATABLE
//////////-->
</script>
</HEAD>
<body>
<noscript>
<p>This calculator uses Javascript to function. Ensure you are using a browser which supports Javascript and that
Javascript is enabled.</p></noscript>
</body>
</HTML>