//Execute request & return OK if found, NOTFOUND or ERROR on error, or PROCESSING if the request has not completed yet void LwipNetDnsRequest::poll() { err_t err; switch(m_state) { case LWIPNETDNS_START: //First req, let's call dns_gethostbyname ip_addr_t ipStruct; err = dns_gethostbyname(m_hostname, &ipStruct, LwipNetDnsRequest::sFoundCb, (void*) this ); if( err == ERR_OK ) { m_ip = IpAddr(&ipStruct); m_state = LWIPNETDNS_OK; DBG("DNS: Ip found in cache.\n"); } else if( err == ERR_INPROGRESS) { DBG("DNS: Processing.\n"); m_state = LWIPNETDNS_PROCESSING; } else //Likely ERR_VAL { DBG("DNS: Error on init.\n"); m_state = LWIPNETDNS_ERROR; } break; case LWIPNETDNS_PROCESSING: break; //Nothing to do, DNS is polled on interrupt case LWIPNETDNS_OK: if(!m_cbFired) { DBG("DNS: Ip found.\n"); m_cbFired = true; onReply(NETDNS_FOUND); //Raise callback } break; case LWIPNETDNS_NOTFOUND: if(!m_cbFired) { DBG("DNS: could not be resolved.\n"); m_cbFired = true; onReply(NETDNS_NOTFOUND); //Raise callback } break; case LWIPNETDNS_ERROR: default: if(!m_cbFired) { DBG("DNS: Error.\n"); m_cbFired = true; onReply(NETDNS_ERROR); //Raise callback } break; } if(m_closing && (m_state!=LWIPNETDNS_PROCESSING)) //Check wether the closure has been reqd { DBG("LwipNetDnsRequest: Closing in poll()\n"); NetDnsRequest::close(); } }
UdpEchoClient::UdpEchoClient(QObject *pParent) : QObject(pParent), m_address(QString("127.0.0.1")), m_port(2012) { QLOG_DEBUG(); m_pUdpSocket = new QUdpSocket(this); if(m_pUdpSocket->bind(m_port, QUdpSocket::ShareAddress) == false){ QLOG_ERROR() << "Cannot listen on port " << m_port << ", error " << m_pUdpSocket->errorString(); } connect(m_pUdpSocket, SIGNAL(readyRead()), this, SLOT(onReply())); m_datagram.append("Ciao Biloute"); }
int MoodBox::MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: onUserAccountUpdated(); break; case 1: onUserStatusChanged((*reinterpret_cast< UserStatus::UserStatusEnum(*)>(_a[1]))); break; case 2: onServerError((*reinterpret_cast< ServerResponseHandler::ServerError(*)>(_a[1]))); break; case 3: onShowExceptionDialogSendingMessage((*reinterpret_cast< ContactResultCode::ContactResultCodeEnum(*)>(_a[1])),(*reinterpret_cast< qint32(*)>(_a[2]))); break; case 4: onLogonStarted(); break; case 5: onLogonStopped(); break; case 6: onLogonSuccess(); break; case 7: showWindow(); break; case 8: shutDown(); break; case 9: onLogoutCompleted(); break; case 10: relogon(); break; case 11: offline((*reinterpret_cast< bool(*)>(_a[1]))); break; case 12: offline(); break; case 13: { bool _r = logout((*reinterpret_cast< bool(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 14: { bool _r = logout(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 15: showSettings(); break; case 16: ipcMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 17: addFriendByLogin(); break; case 18: forceQuit(); break; case 19: onTrayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break; case 20: on_contactListButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 21: on_drawButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 22: on_historyButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 23: onDownloadNewVersion(); break; case 24: onInviteCodeAccepted(); break; case 25: onRegistrationSuccess(); break; case 26: onResetPassword(); break; case 27: onShowClipart(); break; case 28: onReply((*reinterpret_cast< const QImage(*)>(_a[1]))); break; case 29: showTvWidget(); break; case 30: showLogonWidget((*reinterpret_cast< bool(*)>(_a[1]))); break; case 31: showLogonWidget(); break; case 32: showInviteCodeWidget(); break; case 33: showRegistrationWidget(); break; case 34: showForgotPasswordWidget(); break; case 35: showInfoWidget(); break; case 36: showWaitingWidget(); break; case 37: stopWaitingWidget(); break; case 38: hideWaitingWidget(); break; case 39: cancelWaitingWidget(); break; case 40: onRegistrationBack(); break; case 41: onInviteCodeNeeded(); break; case 42: onContactSelected((*reinterpret_cast< qint32(*)>(_a[1]))); break; case 43: onContactImageDrop((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const QImage(*)>(_a[2]))); break; case 44: onSoundStateChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 45: onPrivateMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break; case 46: onChannelMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break; case 47: onFriendsMessageReceived((*reinterpret_cast< const MessageKey(*)>(_a[1]))); break; case 48: onMessageSent(); break; case 49: showHelp(); break; case 50: requestFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break; case 51: dataProcessedProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 52: cancelHttpRequest(); break; default: ; } _id -= 53; } return _id; }