private int iNumOfHosts;
private boolean bVerbose;
+ // TODO: THIS IS HACKING FOR IOTSEC
+ // Replace random
+ private int comPortCount = 10000;
+ private int rmiRegCount = 20000;
+ private int rmiStubCount = 30000;
+ private int additionalCount = 40000;
+
/**
* CommunicationHandler class constants
*/
int iComPort = 0;
do {
iComPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
+ //System.out.println("DEBUG: Assigning comPort: " + comPortCount);
+ //iComPort = comPortCount++;
// Check port existence in HashMap
} while (portIsAvailable(iComPort) == false);
hmComPort.put(iNumOfObjects, iComPort);
int iRMIRegPort = 0;
do {
iRMIRegPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
+ //System.out.println("DEBUG: Assigning regPort: " + rmiRegCount);
+ //iRMIRegPort = rmiRegCount++;
// Check port existence in HashMap
} while (portIsAvailable(iRMIRegPort) == false);
hmRMIRegPort.put(iNumOfObjects, iRMIRegPort);
int iRMIStubPort = 0;
do {
iRMIStubPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
+ //System.out.println("DEBUG: Assigning stubPort: " + rmiStubCount);
+ //iRMIStubPort = rmiStubCount++;
// Check port existence in HashMap
} while (portIsAvailable(iRMIStubPort) == false);
hmRMIStubPort.put(iNumOfObjects, iRMIStubPort);
int iAdditionalPort = 0;
do {
iAdditionalPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
+ //System.out.println("DEBUG: Assigning additionalPort: " + additionalCount);
+ //iAdditionalPort = additionalCount++;
// Check port existence in HashMap
} while (portIsAvailable(iAdditionalPort) == false);
hmAdditionalPort.put(iNumOfObjects, iAdditionalPort);
*/
public boolean portIsAvailable(int iPortNumber) {
- /*if (hmComPort.containsValue(iPortNumber) == true) {
+ if (hmComPort.containsValue(iPortNumber) == true) {
return false;
} else if (hmRMIRegPort.containsValue(iPortNumber) == true) {
return false;
return false;
} else {
return true;
- }*/
- if (hsAllPorts.contains(iPortNumber)) {
- return false;
- } else {
- return true;
}
+ //if (hsAllPorts.contains(iPortNumber)) {
+ // return false;
+ //} else {
+ // return true;
+ //}
}
/**