e38c58d sbus: Add type-safe DBus method handlers and finish functions

19 files Authored by stefw 9 years ago, Committed by jhrozek 9 years ago,
    sbus: Add type-safe DBus method handlers and finish functions
    
    Type safe method handlers allow methods not to have to do tedious
    unwrapping and wrapping of DBus method call messages or replies.
    
    Arguments of the following DBus types are supported in type-safe
    method handlers. In addition arrays of these are supported.
    
     y: uint8_t
     b: bool     (but no arrays, yet)
     n: int16_t
     q: uint16_t
     i: int32_t
     u: uint32_t
     x: int64_t
     t: uint64_t
     d: double
     s: char *   (utf8 string)
     o: char *   (object path)
    
    As an exception, arrays of booleans are not supported, but could be
    added later. Other more complex types could be added later if desired.
    If a method has other argument types, then it must be marked as having
    a raw handler (see below).
    
    Internally each method can have a type specific invoker function which
    unpacks the incoming arguments and invokes the method handler with the
    correct arguments.
    
    Each method also has a finish which accepts the type-safe out arguments
    (ie: return values) and builds the reply message. Like other request
    'finish' functions, these free the request talloc context, and are to
    be used in place of sbus_request_finish() or friends.
    
    Raw method handlers parse their own method arguments, and prepare their
    own reply (ideally using sbus_request_finish() helpers). They can also
    do strange things like have variable arguments. To mark a DBus method
    as having a raw method handler use the following annotation:
    
    <annotation name="org.freedesktop.sssd.RawHandler" value="true"/>
    
    Raw methods do not have invokers or finish functions.
    
    I've left all of the internal peer to peer communication using raw
    method handlers. No code changes here.
    
    (cherry picked from commit dff909d473f43a6bd0f0286fa2d279c0ebe945c6)
    
        
file modified
+20 -10
file modified
+207 -8
file modified
+6 -0
file modified
+8 -0
file modified
+30 -0