separate PIEthernet::Address to PINetworkAddress, typedef PIEthernet::Address to PINetworkAddress and mark as deprecated

PIValueTree new attributes for File and Dir
This commit is contained in:
2022-12-19 14:29:18 +03:00
parent 6c3f305562
commit 2ac215c19e
18 changed files with 505 additions and 328 deletions

View File

@@ -84,7 +84,7 @@ void PIBroadcast::setMulticastPort(ushort port) {
}
void PIBroadcast::setMulticastAddress(const PIEthernet::Address & addr) {
void PIBroadcast::setMulticastAddress(const PINetworkAddress & addr) {
PIMutexLocker ml(mcast_mutex);
mcast_address = addr;
_reinit = true;
@@ -126,16 +126,16 @@ void PIBroadcast::destroyAll() {
}
void PIBroadcast::initAll(PIVector<PIEthernet::Address> al) {
void PIBroadcast::initAll(PIVector<PINetworkAddress> al) {
PIMutexLocker ml(mcast_mutex);
destroyAll();
_reinit = false;
prev_al = al;
al.removeAll(PIEthernet::Address("127.0.0.1"));
al.removeAll(PINetworkAddress("127.0.0.1"));
al << mcast_address;
eth_mcast.clear();
PIEthernet::InterfaceList ifaces = PIEthernet::interfaces();
piForeachC(PIEthernet::Address & a, al) {
piForeachC(PINetworkAddress & a, al) {
PIEthernet * ce = 0;
// piCout << "mcast try" << a;
if (_channels[Multicast]) {
@@ -166,10 +166,10 @@ void PIBroadcast::initAll(PIVector<PIEthernet::Address> al) {
ce->setName("PIMulticast_" + a.toString());
ce->setParameters(PIEthernet::Broadcast);
const PIEthernet::Interface * cint = ifaces.getByAddress(a.ipString());
PIEthernet::Address nm((cint == 0) ? "255.255.255.0" : cint->netmask);
PINetworkAddress nm((cint == 0) ? "255.255.255.0" : cint->netmask);
ce->setSendAddress(PIEthernet::getBroadcast(a, nm).ipString(), bcast_port);
if (!_send_only) {
ce->setReadAddress(PIEthernet::Address(a.ip(), bcast_port));
ce->setReadAddress(PINetworkAddress(a.ip(), bcast_port));
// piCout << "bcast " << ce->readAddress() << ce->sendAddress();
if (ce->open()) {
eth_mcast << ce;
@@ -260,7 +260,7 @@ void PIBroadcast::mcastRead(const uchar * data, ssize_t size) {
void PIBroadcast::run() {
PIVector<PIEthernet::Address> al = PIEthernet::allAddresses();
PIVector<PINetworkAddress> al = PIEthernet::allAddresses();
mcast_mutex.lock();
bool r = _reinit, ac = (al != prev_al);
mcast_mutex.unlock();