diff options
| author | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-02-07 13:36:34 +0000 |
|---|---|---|
| committer | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-02-07 13:36:34 +0000 |
| commit | 06d1877811fa6aa97dddc0e03bcde4e766928c87 (patch) | |
| tree | c25462d0e58c3d58c728664440412bf4f16a49ec /src/ui/unixdomainsocket.h | |
| parent | 3f6b60f23c44a8ba8dd97ca6f41a16e2af7ef2f7 (diff) | |
| download | qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.gz qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.bz2 qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.zip | |
new directory structure
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@232 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/unixdomainsocket.h')
| -rw-r--r-- | src/ui/unixdomainsocket.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ui/unixdomainsocket.h b/src/ui/unixdomainsocket.h new file mode 100644 index 000000000..37e5a364b --- /dev/null +++ b/src/ui/unixdomainsocket.h @@ -0,0 +1,46 @@ +#ifndef UNIXDOMAINSOCKET_H +#define UNIXDOMAINSOCKET_H + +#include <QUdpSocket> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/types.h> +#include <linux/un.h> + + +/*! + * UnixDomainSocket class is a wrapper around the unix domain sockets implementation. + * Used for QMMP interprocess communications. + * @author Vladimir Kuznetsov <vovanec@gmail.com> + */ +class UnixDomainSocket : public QUdpSocket +{ +Q_OBJECT +public: + UnixDomainSocket(QObject * parent = 0 ); + + /*! + * Try to bind socket to \b path. Returns \b true on success, otherwise \b false + */ + bool bind(const QString& file); + + /*! + * Checks if socket at \b path path is alive( i.e. connectable). + */ + bool alive(const QString& path); + ~UnixDomainSocket(); + +public slots: + /*! + * Sends the datagram \b command to the socket at \b path path. + */ + void writeDatagram(const char* command,const QString& path); +private: + unsigned int _s; + struct sockaddr_un _local; + bool _bound; +}; + + +#endif + |
