ipc/dbus/RawDBusConnection.h

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_ipc_dbus_gonk_rawdbusconnection_h__
     8 #define mozilla_ipc_dbus_gonk_rawdbusconnection_h__
    10 #include "mozilla/Scoped.h"
    12 struct DBusConnection;
    13 struct DBusError;
    14 struct DBusMessage;
    16 namespace mozilla {
    17 namespace ipc {
    19 typedef void (*DBusReplyCallback)(DBusMessage*, void*);
    21 class RawDBusConnection
    22 {
    23   struct ScopedDBusConnectionPtrTraits : ScopedFreePtrTraits<DBusConnection>
    24   {
    25     static void release(DBusConnection* ptr);
    26   };
    28 public:
    29   RawDBusConnection();
    30   virtual ~RawDBusConnection();
    32   nsresult EstablishDBusConnection();
    34   bool Watch();
    36   DBusConnection* GetConnection()
    37   {
    38     return mConnection;
    39   }
    41   bool Send(DBusMessage* aMessage);
    43   bool SendWithReply(DBusReplyCallback aCallback, void* aData,
    44                      int aTimeout, DBusMessage* aMessage);
    46   bool SendWithReply(DBusReplyCallback aCallback, void* aData,
    47                      int aTimeout,
    48                      const char* aDestination,
    49                      const char* aPath, const char* aIntf,
    50                      const char *aFunc, int aFirstArgType, ...);
    52 protected:
    53   DBusMessage* BuildDBusMessage(const char* aDestination,
    54                                 const char* aPath, const char* aIntf,
    55                                 const char* aFunc, int aFirstArgType,
    56                                 va_list args);
    58   Scoped<ScopedDBusConnectionPtrTraits> mConnection;
    60 private:
    61   static bool sDBusIsInit;
    62 };
    64 }
    65 }
    67 #endif

mercurial