52 #include <netinet/in.h> 53 #include <arpa/inet.h> 55 #ifndef QT_NO_BEARERMANAGEMENT 99 while (!argument.
atEnd()) {
102 detailsList.
append(element);
112 argument.
beginArray(qMetaTypeId<ICd2DetailsDBusStruct>());
114 for (
int i = 0; i < detailsList.
count(); ++i)
115 argument << detailsList[i];
132 switch (icd_connection_state) {
133 case ICD_STATE_CONNECTING:
136 case ICD_STATE_CONNECTED:
139 case ICD_STATE_DISCONNECTING:
142 case ICD_STATE_DISCONNECTED:
163 if (newState !=
state) {
223 if (newState !=
state) {
239 icdConfig->
id = newId;
247 if (icdConfig->
id != newId)
248 icdConfig->
id = newId;
389 #ifdef BEARER_MANAGEMENT_DEBUG 408 if (icd.
state(state_results) && !state_results.
isEmpty()) {
422 case ICD_STATE_DISCONNECTED:
430 case ICD_STATE_CONNECTING:
438 case ICD_STATE_CONNECTED:
473 ptr->
name = name_value;
489 case ICD_STATE_DISCONNECTING:
502 #ifdef BEARER_MANAGEMENT_DEBUG 503 qDebug() <<
"status_req tells icd is not connected";
507 #ifdef BEARER_MANAGEMENT_DEBUG 508 qDebug() <<
"status_req did not return any results from icd";
539 if (
state != oldState)
550 if (
state != oldState)
574 bool newActive =
false;
602 if (oldState !=
state) {
606 #ifdef BEARER_MANAGEMENT_DEBUG 614 #ifdef BEARER_MANAGEMENT_DEBUG 629 #ifdef BEARER_MANAGEMENT_DEBUG 630 qDebug() <<
"Cannot get addrinfo from icd, are you connected or is icd running?";
640 if (inet_aton(data.
constData(), &addr) == 0) {
641 #ifdef BEARER_MANAGEMENT_DEBUG 647 struct ifaddrs *ifaddr, *ifa;
650 if (getifaddrs(&ifaddr) == -1) {
651 #ifdef BEARER_MANAGEMENT_DEBUG 652 qDebug() <<
"getifaddrs() failed";
657 for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
659 family = ifa->ifa_addr->sa_family;
660 if (family != AF_INET) {
663 if (((
struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) {
664 iface =
QString(ifa->ifa_name);
734 #ifdef BEARER_MANAGEMENT_DEBUG 747 if (iap == OSSO_IAP_ANY) {
748 #ifdef BEARER_MANAGEMENT_DEBUG 749 qDebug() <<
"connecting to default IAP" << iap;
771 #ifdef BEARER_MANAGEMENT_DEBUG 772 qDebug(
"connecting to %s/%s/0x%x/%s/0x%x/%s",
797 QString connected_iap = result;
799 #ifdef BEARER_MANAGEMENT_DEBUG 829 icdConfig->
id = connected_iap;
836 icdConfig->
name = name;
849 #ifdef BEARER_MANAGEMENT_DEBUG 871 #ifdef BEARER_MANAGEMENT_DEBUG 872 qDebug()<<
"Existing configuration"<<result<<
"updated in manager in open";
900 #ifdef BEARER_MANAGEMENT_DEBUG 933 #ifdef BEARER_MANAGEMENT_DEBUG 984 #ifndef QT_NO_NETWORKINTERFACE 1000 properties.
insert(key, value);
1002 if (key ==
"ConnectInBackground") {
1013 if (key ==
"ConnectInBackground")
1021 return properties.
value(key);
1078 #endif // QT_NO_BEARERMANAGEMENT The QVariant class acts like a union for the most common Qt data types.
QNetworkConfiguration config
static QNetworkInterface interfaceFromName(const QString &name)
Returns a QNetworkInterface object for the interface named name.
void cleanupSession(void)
void endArray()
Closes a D-Bus array opened with beginArray().
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
QNetworkSession::State currentState
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
char * data()
Returns a pointer to the data stored in the byte array.
int remove(const Key &key)
Removes all the items that have the key from the hash.
QNetworkConfiguration::StateFlags state
The QDBusArgument class is used to marshall and demarshall D-Bus arguments.
icd_connection_flags connectFlags
void beginArray(int elementMetaTypeId)
Opens a new D-Bus array suitable for appending elements of meta-type id.
The QByteArray class provides an array of bytes.
QNetworkSession::SessionError lastError
QDBusPendingCall asyncCall(const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Calls the method method on this interface and passes the parameters to this function to the method...
void clearProxyInformation()
void unlock()
Unlocks this mutex locker.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
void updateProxyInformation()
State
This enum describes the connectivity state of the session.
QVariant sessionProperty(const QString &key) const
QNetworkConfiguration serviceConfig
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
QDBusInterface * m_dbusInterface
SessionError error() const
Returns the type of error that last occurred.
int count(const T &t) const
Returns the number of occurrences of value in the list.
QList< QNetworkConfiguration > children() const
Returns all sub configurations of this network configuration in priority order.
void updateStateFromActiveConfig()
The QString class provides a Unicode character string.
QNetworkConfiguration activeConfig
void updateStateFromServiceNetwork()
QNetworkConfiguration::BearerType bearerType
const T value(const Key &key) const
Returns the value associated with the key.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
QNetworkConfiguration & copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
#define ICD_LONG_CONNECT_TIMEOUT
void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
Q_CORE_EXPORT void qDebug(const char *,...)
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
QTimer m_connectRequestTimer
void append(const T &t)
Inserts value at the end of the list.
SessionError
This enum describes the session errors that can occur.
The QNetworkConfiguration class provides an abstraction of one or more access point configurations...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
virtual QNetworkSession::SessionError error() const =0
bool atEnd() const
Returns true if there are no more elements to be extracted from this QDBusArgument.
void setPrivateConfiguration(QNetworkConfiguration &config, QNetworkConfigurationPrivatePointer ptr) const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void networkConfigurationsChanged()
const T & at(int i) const
Returns the item at index position i in the list.
void updateProxies(QNetworkSession::State newState)
void finishStopBySendingClosedSignal()
QNetworkSession::State state
struct CommonParams params
QNetworkConfigurationManager manager
static const char * data(const QByteArray &arr)
void clearConfiguration(QNetworkConfiguration &config)
void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
const T * ptr(const T &t)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
void clear()
Removes all items from the list.
struct CommonParams params
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
void unlock()
Unlocks the mutex.
QString errorString() const
void newConfigurationActivated()
void iapStateChanged(const QString &iapid, uint icd_connection_state)
QNetworkConfiguration publicConfig
QList< IcdIPInformation > ip_info
T & first()
Returns a reference to the first item in the list.
uint state(QString &service_type, uint service_attrs, QString &service_id, QString &network_type, uint network_attrs, QByteArray &network_id, IcdStateResult &state_result)
const char * constData() const
Returns a pointer to the data stored in the byte array.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
uint addrinfo(QString &service_type, uint service_attrs, QString &service_id, QString &network_type, uint network_attrs, QByteArray &network_id, IcdAddressInfoResult &addr_result)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
QNetworkConfiguration::Purpose purpose
void stateChanged(QNetworkSession::State state)
void updateIdentifier(const QString &newId)
The QDateTime class provides date and time functions.
void setSessionProperty(const QString &key, const QVariant &value)
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
QExplicitlySharedDataPointer< QNetworkConfigurationPrivate > QNetworkConfigurationPrivatePointer
bool hasIdentifier(const QString &id)
quint64 bytesWritten() const
void syncStateWithInterface()
void clear()
Clears the contents of the string and makes it empty.
QNetworkConfiguration::Type type
QNetworkSession::SessionError error() const
void endStructure()
Closes a D-Bus structure opened with beginStructure().
bool singleShot
This static function calls a slot after a given time interval.
Statistics getStatistics() const
StateFlags state() const
Returns the current state of the configuration.
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
QNetworkInterface currentInterface() const
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
uint statistics(QList< IcdStatisticsResult > &stats_results)
void beginStructure()
Opens a new D-Bus structure suitable for appending new arguments.
The QDBusMessage class represents one message sent or received over the D-Bus bus.
QString currentNetworkInterface
QNetworkConfiguration configurationFromIdentifier(const QString &identifier) const
Returns the QNetworkConfiguration for identifier; otherwise returns an invalid QNetworkConfiguration...
void updateState(QNetworkSession::State)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces...
void stateChange(const QDBusMessage &rep)
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
void stop()
Stops the timer.
quint64 activeTime() const
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
QDataStream & operator<<(QDataStream &out, const QUrl &url)
Writes url url to the stream out and returns a reference to the stream.
static QString get_network_interface()
void clear()
Clears the contents of the byte array and makes it empty.
static QHash< QString, QVariant > properties
QVariant value(const QString &key) const
QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType)
QNetworkConfigurationPrivatePointer configuration(const QString &id)
The QList class is a template class that provides lists.
void quitPendingWaitsForOpened()
Type type() const
Returns the type of the configuration.
QDBusMessage call(const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Calls the method method on this interface and passes the parameters to this function to the method...
quint64 bytesReceived() const
QDataStream & operator>>(QDataStream &in, QUrl &url)
Reads a url into url from the stream in and returns a reference to the stream.