adbus_Match Struct Reference

Data structure used to register general matches. More...

Data Fields

adbus_MessageType type
 Type of message to match or ADBUS_MSG_INVALID (default).
adbus_Bool addMatchToBusDaemon
 Whether the match should be added to bus daemon (default not).
int64_t replySerial
 Reply serial to match or -1 (default).
const char * sender
 Sender field to match or NULL (default).
int senderSize
 Length of the adbus_Match::sender field or -1 if null terminated (default).
const char * destination
 Destination field to match or NULL (default).
int destinationSize
 Length of the adbus_Match::destination field or -1 if null terminated (default).
const char * interface
 Interface field to match or NULL (default).
int interfaceSize
 Length of the adbus_Match::interface field or -1 if null terminated (default).
const char * path
 Object path field to match or NULL (default).
int pathSize
 Length of the adbus_Match::path field or -1 if null terminated (default).
const char * member
 Member field to match or NULL (default).
int memberSize
 Length of the adbus_Match::member field or -1 if null terminated (default).
const char * error
 Error name field to match or NULL (default).
int errorSize
 Length of the adbus_Match::error field or -1 if null terminated (default).
adbus_Argument * arguments
 Array of adbus_Argument detailing what string arguments to match or NULL to not match arguments (default).
size_t argumentsSize
 Size of the adbus_Match::argument array.
adbus_MsgCallback callback
 Function to call when a message matches the supplied fields.
void * cuser
 User data for the adbus_Match::callback function.
adbus_ProxyMsgCallback proxy
 Proxy function for the adbus_Match::callback function.
void * puser
 User data for the adbus_Match::proxy function.
adbus_Callback release [2]
 Function called when the match is removed from the connection.
void * ruser [2]
 User data for the adbus_Match::release functions.
adbus_ProxyCallback relproxy
 Proxy function for the adbus_Match::release field.
void * relpuser
 User data for the adbus_Match::relproxy field.

Related Functions

(Note that these are not member functions.)



void adbus_match_init (adbus_Match *pmatch)
 Initialise a match.

Detailed Description

Data structure used to register general matches.

Note:
An adbus_Match structure should always be initialised using adbus_match_init().
The proxy and relproxy fields should almost always be initialised using adbus_conn_getproxy().

Matches are used to register for any message by specifying specific values to look for for the various message header fields. They can also be pushed through to the bus server. There are mostly used to register callbacks for signals from a specific remote object.

For example:

  static int Signal(adbus_CbData* d)
  {
      Object* o = (Object*) d->user1;
      o->OnSignal();
      return 0;
  }

  void RegisterForSignal(adbus_Connection* c, Object* o)
  {
      adbus_Match m;
      adbus_match_init(&m);
      m.addMatchToBusDaemon = 1;
      m.type      = ADBUS_MSG_SIGNAL;
      m.sender    = "com.example.Service";
      m.path      = "/";
      m.member    = "ExampleSignal";
      m.callback  = &Signal;
      m.cuser     = o;
      adbus_state_addmatch(o->state(), c, &m);
  }
Note:
If writing C code, the adbus_State and adbus_Proxy modules vastly simplify the unregistering and thread jumping issues.
See also:
adbus_Connection, adbus_conn_addmatch(), adbus_conn_addmatch(), adbus_Proxy

Field Documentation

Proxy function for the adbus_Match::callback function.

Should be default set using adbus_conn_getproxy().

User data for the adbus_Match::proxy function.

Should be default set using adbus_conn_getproxy().

Proxy function for the adbus_Match::release field.

Should be default set using adbus_conn_getproxy().

User data for the adbus_Match::relproxy field.

Should be default set using adbus_conn_getproxy().


The documentation for this struct was generated from the following files:
 All Data Structures Files Functions Variables Friends Defines

Generated on Mon Mar 22 00:10:02 2010 for adbus by  doxygen 1.6.1