# sd_bus_message_get_type

## NAME



           sd_bus_message_get_type, sd_bus_message_get_error,
           sd_bus_message_get_errno, sd_bus_message_get_creds,
           sd_bus_message_is_signal, sd_bus_message_is_method_call,
           sd_bus_message_is_method_error - Query bus message
           addressing/credentials metadata
    


## SYNOPSIS



           **#include <systemd/sd-bus.h>**
    
           **int sd_bus_message_get_type(sd_bus_message ***_m_**, uint8_t ***_type_**);**
    
           **sd_bus_error* sd_bus_message_get_error(sd_bus_message ***_m_**);**
    
           **int sd_bus_message_get_errno(sd_bus_message ***_m_**);**
    
           **sd_bus_creds* sd_bus_message_get_creds(sd_bus_message ***_m_**);**
    
           **int sd_bus_message_is_signal(sd_bus_message ***_m_**,**
                                        **const char ***_interface_**,**
                                        **const char ***_member_**);**
    
           **int sd_bus_message_is_method_call(sd_bus_message ***_m_**,**
                                             **const char ***_interface_**,**
                                             **const char ***_member_**);**
    
           **int sd_bus_message_is_method_error(sd_bus_message ***_m_**,**
                                              **const char ***_name_**);**
    


## DESCRIPTION



           **sd_bus_message_get_type()** returns the type of a message in the
           output parameter _type_ , one of **SD_BUS_MESSAGE_METHOD_CALL** ,
           **SD_BUS_MESSAGE_METHOD_RETURN** , **SD_BUS_MESSAGE_METHOD_ERROR** ,
           **SD_BUS_MESSAGE_SIGNAL**. This type is either specified as a
           parameter when the message is created using sd_bus_message_new(3),
           or is set automatically when the message is created using
           sd_bus_message_new_signal(3), sd_bus_message_new_method_call(3),
           sd_bus_message_new_method_error(3) and similar functions.
    
           **sd_bus_message_get_error()** returns the error stored in the message
           _m_ , if there is any. Otherwise, it returns **NULL**.
           **sd_bus_message_get_errno()** returns the error stored in the message
           _m_ as a positive errno-style value, if there is any. Otherwise, it
           returns zero. Errors are mapped to errno values according to the
           default and any additional registered error mappings. See
           sd-bus-errors(3) and sd_bus_error_add_map(3).
    
           **sd_bus_message_get_creds()** returns the message credentials
           attached to the message _m_. If no credentials are attached to the
           message, it returns **NULL**. Ownership of the credentials instance is
           not transferred to the caller and hence should not be freed.
    
           **sd_bus_message_is_signal()** checks if message _m_ is a signal
           message. If _interface_ is non-null, it also checks if the message
           has the same interface set. If _member_ is non-null, it also checks
           if the message has the same member set. Also see
           sd_bus_message_new_signal(3). It returns true when all checks
           pass.
    
           **sd_bus_message_is_method_call()** checks if message _m_ is a method
           call message. If _interface_ is non-null, it also checks if the
           message has the same interface set. If _member_ is non-null, it also
           checks if the message has the same member set. Also see
           sd_bus_message_new_method_call(3). It returns true when all checks
           pass.
    
           **sd_bus_message_is_method_error()** checks if message _m_ is an error
           reply message. If _name_ is non-null, it also checks if the message
           has the same error identifier set. Also see
           sd_bus_message_new_method_error(3). It returns true when all
           checks pass.
    


## RETURN VALUE



           On success, these functions (except **sd_bus_message_get_error()** and
           **sd_bus_message_get_creds()**) return a non-negative integer. On
           failure, they return a negative errno-style error code.
           **sd_bus_message_get_errno()** always returns a non-negative integer,
           even on failure.
    
       **Errors**
           Returned errors may indicate the following problems:
    
           **-EINVAL**
               The message parameter _m_ or an output parameter is **NULL**.
    


## NOTES



           Functions described here are available as a shared library, which
           can be compiled against and linked to with the
           **libsystemd pkg-config**(1) file.
    
           The code described here uses getenv(3), which is declared to be
           not multi-thread-safe. This means that the code calling the
           functions described here must not call setenv(3) from a parallel
           thread. It is recommended to only do calls to **setenv()** from an
           early phase of the program when no other threads have been
           started.
    


* * *