void ExistenceChecker::setClient(ApiMirror::Client *client) { kulloAssert(!client_); kulloAssert(client); client_ = client; emit clientChanged(); }
void ProxyConfig::fillClients() { m_current = (unsigned)(-1); m_data.clear(); cmbClient->clear(); cmbClient->insertItem(i18n("Default")); ProxyData d(m_plugin->data); clear_list(&d.Clients); m_data.push_back(d); for (unsigned i = 0; i < getContacts()->nClients(); i++){ Client *client = getContacts()->getClient(i); if (client->protocol()->description()->flags & PROTOCOL_NOPROXY) continue; QString name = client->name().c_str(); int pos = name.find("."); if (pos > 0) name = name.replace(pos, 1, " "); cmbClient->insertItem(Pict(client->protocol()->description()->icon), name); ProxyData d; m_plugin->clientData(static_cast<TCPClient*>(client), d); m_data.push_back(d); } bool bState; if (!get_connection_state(bState)){ cmbClient->insertItem(i18n("HTTP requests"));; ProxyData d; m_plugin->clientData((TCPClient*)(-1), d); m_data.push_back(d); } clientChanged(0); }
void WindowThumbnailItem::setClient(Client *client) { if (m_client == client) { return; } m_client = client; if (m_client) { setWId(m_client->window()); } else { setWId(0); } emit clientChanged(); }
void WindowThumbnailItem::setWId(qulonglong wId) { if (m_wId == wId) { return; } m_wId = wId; if (m_wId != 0) { setClient(Workspace::self()->findClient(WindowMatchPredicate(m_wId))); } else if (m_client) { m_client = NULL; emit clientChanged(); } emit wIdChanged(wId); }
void Conversation::setClient(ChatClient *client) { bool check; Q_UNUSED(check); if (client != m_client) { m_client = client; m_historyModel->setClient(client); check = connect(client, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceived(QXmppMessage))); Q_ASSERT(check); emit clientChanged(client); } }
void ProxyConfig::apply() { if (m_client){ ProxyData nd(NULL); get(&nd); set_str(&nd.Client.ptr, NULL); if (getContacts()->nClients() <= 1){ m_plugin->clearClients(); m_plugin->data = nd; return; } ProxyData d; m_plugin->clientData(static_cast<TCPClient*>(m_client), d); m_data.clear(); if (d.Default.bValue){ d = nd; }else{ d = m_plugin->data; } m_data.push_back(d); for (unsigned i = 0; i < getContacts()->nClients(); i++){ Client *client = getContacts()->getClient(i); if (client == m_client){ set_str(&nd.Client.ptr, m_client->name().c_str()); m_data.push_back(nd); }else{ ProxyData d; m_plugin->clientData(static_cast<TCPClient*>(client), d); m_data.push_back(d); } } }else{ clientChanged(0); } m_plugin->data = m_data[0]; m_plugin->clearClients(); unsigned nClient = 1; for (unsigned i = 1; i < m_data.size(); i++){ if (m_data[i] == m_data[0]) continue; m_plugin->setClients(nClient++, save_data(ProxyPlugin::proxyData, &m_data[i]).c_str()); } }
/////////////////////////////////////////// // Set the IP address of the client to monitor void EQPacket::monitorIPClient(const QString& ip) { showeq_params->ip = ip; struct in_addr ia; inet_aton (showeq_params->ip, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); printf("Listening for IP client: %s\n", (const char*)showeq_params->ip); if (!showeq_params->playbackpackets) { m_packetCapture->setFilter(showeq_params->device, showeq_params->ip, showeq_params->realtime, IP_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
/////////////////////////////////////////// // Set the IP address of the client to monitor void EQPacket::monitorIPClient(const QString& ip) { m_ip = ip; struct in_addr ia; inet_aton (m_ip, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); seqInfo("Listening for IP client: %s", (const char*)m_ip); if (!m_playbackPackets) { m_packetCapture->setFilter(m_device, m_ip, m_realtime, IP_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
/////////////////////////////////////////// // Monitor the next client seen void EQPacket::monitorNextClient() { m_detectingClient = true; showeq_params->ip = AUTOMATIC_CLIENT_IP; struct in_addr ia; inet_aton (showeq_params->ip, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); printf("Listening for next client seen. (you must zone for this to work!)\n"); if (!showeq_params->playbackpackets) { m_packetCapture->setFilter(showeq_params->device, NULL, showeq_params->realtime, DEFAULT_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
/////////////////////////////////////////// // Monitor the next client seen void EQPacket::monitorNextClient() { m_detectingClient = true; m_ip = AUTOMATIC_CLIENT_IP; struct in_addr ia; inet_aton (m_ip, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); seqInfo("Listening for next client seen. (you must zone for this to work!)"); if (m_playbackPackets == PLAYBACK_OFF || m_playbackPackets == PLAYBACK_FORMAT_TCPDUMP) { m_packetCapture->setFilter(m_device, NULL, m_realtime, DEFAULT_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
/////////////////////////////////////////// // Set the MAC address of the client to monitor void EQPacket::monitorMACClient(const QString& mac) { showeq_params->mac_address = mac; m_detectingClient = true; struct in_addr ia; inet_aton (AUTOMATIC_CLIENT_IP, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); printf("Listening for MAC client: %s\n", (const char*)showeq_params->mac_address); if (!showeq_params->playbackpackets) { m_packetCapture->setFilter(showeq_params->device, showeq_params->ip, showeq_params->realtime, IP_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
/////////////////////////////////////////// // Set the MAC address of the client to monitor void EQPacket::monitorMACClient(const QString& mac) { m_mac = mac; m_detectingClient = true; struct in_addr ia; inet_aton (AUTOMATIC_CLIENT_IP, &ia); m_client_addr = ia.s_addr; emit clientChanged(m_client_addr); resetEQPacket(); seqInfo("Listening for MAC client: %s", (const char*)m_mac); if (!m_playbackPackets) { m_packetCapture->setFilter(m_device, m_ip, m_realtime, IP_ADDRESS_TYPE, 0, 0); emit filterChanged(); } }
ProxyConfig::ProxyConfig(QWidget *parent, ProxyPlugin *plugin, QTabWidget *tab, Client *client) : QWidget( parent) { setupUi( this); m_plugin = plugin; m_client = client; m_current = (unsigned)(-1); cmbType->insertItem(i18n("None")); cmbType->insertItem("SOCKS4"); cmbType->insertItem("SOCKS5"); cmbType->insertItem("HTTP/HTTPS"); if (tab){ tab->addTab(this, i18n("&Proxy")); for (QWidget *p = this; p; p = p->parentWidget()){ QSize s = p->sizeHint(); QSize s1 = QSize(p->width(), p->height()); p->setMinimumSize(s); p->resize(QMAX(s.width(), s1.width()), QMAX(s.height(), s1.height())); if (p->layout()) p->layout()->invalidate(); if (p == topLevelWidget()) break; } } connect(cmbType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); connect(chkAuth, SIGNAL(toggled(bool)), this, SLOT(authToggled(bool))); if (m_client){ lblClient->hide(); cmbClient->hide(); ProxyData data; plugin->clientData(static_cast<TCPClient*>(m_client), data); fill(&data); }else{ fillClients(); connect(cmbClient, SIGNAL(activated(int)), this, SLOT(clientChanged(int))); clientChanged(0); } }
void EQPacket::dispatchPacket(EQUDPIPPacketFormat& packet) { // Detect client by world server port traffic... if (m_detectingClient && packet.getSourcePort() == WorldServerGeneralPort) { m_ip = packet.getIPv4DestA(); m_client_addr = packet.getIPv4DestN(); m_detectingClient = false; emit clientChanged(m_client_addr); seqInfo("Client Detected: %s", (const char*)m_ip); } else if (m_detectingClient && packet.getDestPort() == WorldServerGeneralPort) { m_ip = packet.getIPv4SourceA(); m_client_addr = packet.getIPv4SourceN(); m_detectingClient = false; emit clientChanged(m_client_addr); seqInfo("Client Detected: %s", (const char*)m_ip); } // Dispatch based on known streams if ((packet.getDestPort() == ChatServerPort) || (packet.getSourcePort() == ChatServerPort)) { // Drop chat server traffic return; } else if ((packet.getDestPort() == WorldServerChatPort) || (packet.getSourcePort() == WorldServerChatPort)) { // Drop cross-server chat traffic return; } else if ((packet.getDestPort() == WorldServerChat2Port) || (packet.getSourcePort() == WorldServerChat2Port)) { // Drop email and cross-game chat traffic return; } else if (((packet.getDestPort() >= LoginServerMinPort) && (packet.getDestPort() <= LoginServerMaxPort)) || (packet.getSourcePort() >= LoginServerMinPort) && (packet.getSourcePort() <= LoginServerMaxPort)) { // Drop login server traffic return; } else if (packet.getDestPort() == WorldServerGeneralPort || packet.getSourcePort() == WorldServerGeneralPort) { // World server traffic. Dispatch it. if (packet.getIPv4SourceN() == m_client_addr) { m_client2WorldStream->handlePacket(packet); } else { m_world2ClientStream->handlePacket(packet); } } else { // Anything else we assume is zone server traffic. if (packet.getIPv4SourceN() == m_client_addr) { m_client2ZoneStream->handlePacket(packet); } else { m_zone2ClientStream->handlePacket(packet); } } } /* end dispatchPacket() */
//////////////////////////////////////////////////// // This function decides the fate of the Everquest packet // and dispatches it to the correct packet stream for handling function void EQPacket::dispatchPacket(int size, unsigned char *buffer) { #ifdef DEBUG_PACKET debug ("dispatchPacket()"); #endif /* DEBUG_PACKET */ /* Setup variables */ // Create an object to parse the packet EQUDPIPPacketFormat packet(buffer, size, false); // signal a new packet emit newPacket(packet); /* Chat and Login Server Packets, Discard for now */ if ((packet.getDestPort() == ChatServerPort) || (packet.getSourcePort() == ChatServerPort)) return; if (((packet.getDestPort() >= LoginServerMinPort) && (packet.getDestPort() <= LoginServerMaxPort)) || (packet.getSourcePort() >= LoginServerMinPort) && (packet.getSourcePort() <= LoginServerMaxPort)) return; /* discard pure ack/req packets and non valid flags*/ if (packet.flagsHi() < 0x02 || packet.flagsHi() > 0x46 || size < 10) { #if defined(PACKET_PROCESS_DIAG) printf("discarding packet %s:%d ==>%s:%d flagsHi=%d size=%d\n", (const char*)packet.getIPv4SourceA(), packet.getSourcePort(), (const char*)packet.getIPv4DestA(), packet.getDestPort(), packet.flagsHi(), size); printf("%s\n", (const char*)packet.headerFlags(false)); #endif return; } #if defined(PACKET_PROCESS_DIAG) && (PACKET_PROCESS_DIAG > 1) printf("%s\n", (const char*)packet.headerFlags((PACKET_PROCESS_DIAG < 3))); uint32_t crc = packet.calcCRC32(); if (crc != packet.crc32()) printf("CRC: Warning Packet seq = %d CRC (%08x) != calculated CRC (%08x)!\n", packet.seq(), packet.crc32(), crc); #endif if (!packet.isValid()) { printf("INVALID PACKET: Bad CRC32 [%s:%d -> %s:%d] seq %04x len %d crc32 (%08x != %08x)\n", (const char*)packet.getIPv4SourceA(), packet.getSourcePort(), (const char*)packet.getIPv4DestA(), packet.getDestPort(), packet.seq(), packet.payloadLength(), packet.crc32(), packet.calcCRC32()); return; } /* Client Detection */ if (m_detectingClient && packet.getSourcePort() == WorldServerGeneralPort) { showeq_params->ip = packet.getIPv4DestA(); m_client_addr = packet.getIPv4DestN(); m_detectingClient = false; emit clientChanged(m_client_addr); printf("Client Detected: %s\n", (const char*)showeq_params->ip); } else if (m_detectingClient && packet.getDestPort() == WorldServerGeneralPort) { showeq_params->ip = packet.getIPv4SourceA(); m_client_addr = packet.getIPv4SourceN(); m_detectingClient = false; emit clientChanged(m_client_addr); printf("Client Detected: %s\n", (const char*)showeq_params->ip); } /* end client detection */ if (packet.getSourcePort() == WorldServerChatPort) { dispatchWorldChatData(packet.payloadLength(), packet.payload(), DIR_SERVER); return; } else if (packet.getDestPort() == WorldServerChatPort) { dispatchWorldChatData(packet.payloadLength(), packet.payload(), DIR_CLIENT); return; } /* stream identification */ if (packet.getIPv4SourceN() == m_client_addr) { if (packet.getDestPort() == WorldServerGeneralPort) m_client2WorldStream->handlePacket(packet); else m_client2ZoneStream->handlePacket(packet); } else if (packet.getIPv4DestN() == m_client_addr) { if (packet.getSourcePort() == WorldServerGeneralPort) m_world2ClientStream->handlePacket(packet); else m_zone2ClientStream->handlePacket(packet); } return; } /* end dispatchPacket() */
void AbstractAdapter::setClient(QString client) { if (this->client != client) { this->client = client; emit clientChanged(client); } }