Example #1
0
void IP_Dialog::on_buttonBox_accepted()
{
    QHostAddress myIP;
    if (myIP.setAddress( ui->ipLineEdit->text()))
    {
        qDebug() << "IP address changed to: " << ui->ipLineEdit->text();
        emit changeIPAddress(ui->ipLineEdit->text());
        emit changePort(ui->lineEdit->text().toInt());
    }
    else
    {
        QMessageBox msgBox;
        msgBox.setText("Bad hostname or IP address!  Better try again.");
        msgBox.exec();
    }
}
Example #2
0
void
Groupsock::changeDestinationParameters(struct in_addr const& newDestAddr,
				       Port newDestPort, int newDestTTL, unsigned sessionId) {
  destRecord* dest;
  for (dest = fDests; dest != NULL && dest->fSessionId != sessionId; dest = dest->fNext) {}

  if (dest == NULL) { // There's no existing 'destRecord' for this "sessionId"; add a new one:
    fDests = createNewDestRecord(newDestAddr, newDestPort, newDestTTL, sessionId, fDests);
    return;
  }

  // "dest" is an existing 'destRecord' for this "sessionId"; change its values to the new ones:
  struct in_addr destAddr = dest->fGroupEId.groupAddress();
  if (newDestAddr.s_addr != 0) {
    if (newDestAddr.s_addr != destAddr.s_addr
	&& IsMulticastAddress(newDestAddr.s_addr)) {
      // If the new destination is a multicast address, then we assume that
      // we want to join it also.  (If this is not in fact the case, then
      // call "multicastSendOnly()" afterwards.)
      socketLeaveGroup(env(), socketNum(), destAddr.s_addr);
      socketJoinGroup(env(), socketNum(), newDestAddr.s_addr);
    }
    destAddr.s_addr = newDestAddr.s_addr;
  }

  portNumBits destPortNum = dest->fGroupEId.portNum();
  if (newDestPort.num() != 0) {
    if (newDestPort.num() != destPortNum
	&& IsMulticastAddress(destAddr.s_addr)) {
      // Also bind to the new port number:
      changePort(newDestPort);
      // And rejoin the multicast group:
      socketJoinGroup(env(), socketNum(), destAddr.s_addr);
    }
    destPortNum = newDestPort.num();
  }

  u_int8_t destTTL = ttl();
  if (newDestTTL != ~0) destTTL = (u_int8_t)newDestTTL;

  dest->fGroupEId = GroupEId(destAddr, destPortNum, destTTL);

  // Finally, remove any other 'destRecord's that might also have this "sessionId":
  removeDestinationFrom(dest->fNext, sessionId);
}
Example #3
0
void
Groupsock::changeDestinationParameters(struct in_addr const& newDestAddr,
							 Port newDestPort, int newDestTTL) {
  if (fDests == NULL) return;
	printf("changeDestinationParameters: %s:%d\n", inet_ntoa(newDestAddr), ntohs(newDestPort.num()));	//jay

  struct in_addr destAddr = fDests->fGroupEId.groupAddress();
  if (newDestAddr.s_addr != 0) {
	  if (newDestAddr.s_addr != destAddr.s_addr
	&& IsMulticastAddress(newDestAddr.s_addr)) {
			// If the new destination is a multicast address, then we assume that
			// we want to join it also.	(If this is not in fact the case, then
			// call "multicastSendOnly()" afterwards.)
		  socketLeaveGroup(env(), socketNum(), destAddr.s_addr);
		  socketJoinGroup(env(), socketNum(), newDestAddr.s_addr);
		}
	  destAddr.s_addr = newDestAddr.s_addr;
	}

  portNumBits destPortNum = fDests->fGroupEId.portNum();
  if (newDestPort.num() != 0) {
	  if (newDestPort.num() != destPortNum
	&& IsMulticastAddress(destAddr.s_addr)) {
			// Also bind to the new port number:
		  changePort(newDestPort);
			// And rejoin the multicast group:
		  socketJoinGroup(env(), socketNum(), destAddr.s_addr);
		}
	  destPortNum = newDestPort.num();
	  fDests->fPort = newDestPort;
	}

  u_int8_t destTTL = ttl();
  if (newDestTTL != ~0) destTTL = (u_int8_t)newDestTTL;

  fDests->fGroupEId = GroupEId(destAddr, destPortNum, destTTL);
}