From dd5c57647f6f98a0b8be8ca7d52ca0263bc28e49 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 20 Feb 2015 14:42:13 +0000 Subject: [PATCH 4/6] Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests The rules are: * symbols in libdbus-1 with neither decoration are private to libdbus-1 * symbols in libdbus-1 with DBUS_EXPORT are public API * symbols in libdbus-1 with DBUS_PRIVATE_EXPORT are private to the dbus source package, but may be used by other programs in the dbus source tree, including tests * symbols in libdbus-internal must not have DBUS_EXPORT or DBUS_PRIVATE_EXPORT, and should be used by as few things as possible Thanks to Ralf Habacker for his contributions to this rather large commit. --- dbus/dbus-auth.h | 15 +++++++++++ dbus/dbus-connection-internal.h | 9 +++++++ dbus/dbus-credentials.h | 18 +++++++++++++ dbus/dbus-file.h | 2 ++ dbus/dbus-hash.h | 22 +++++++++++++++ dbus/dbus-internals.h | 23 ++++++++++++++++ dbus/dbus-list.h | 27 +++++++++++++++++++ dbus/dbus-macros.h | 22 ++++++++++++++- dbus/dbus-marshal-basic.h | 6 +++++ dbus/dbus-marshal-byteswap.h | 1 + dbus/dbus-marshal-header.h | 4 +++ dbus/dbus-marshal-recursive.h | 18 +++++++++++++ dbus/dbus-marshal-validate.h | 9 +++++++ dbus/dbus-mempool.h | 4 +++ dbus/dbus-message-internal.h | 12 +++++++++ dbus/dbus-message-private.h | 1 + dbus/dbus-pending-call-internal.h | 3 +++ dbus/dbus-pipe.h | 7 +++++ dbus/dbus-server-protected.h | 3 +++ dbus/dbus-server-socket.h | 1 + dbus/dbus-string.h | 56 +++++++++++++++++++++++++++++++++++++++ dbus/dbus-sysdeps-unix.h | 6 +++++ dbus/dbus-sysdeps-win.h | 7 +++++ dbus/dbus-sysdeps.h | 26 +++++++++++++++++- dbus/dbus-test.h | 43 ++++++++++++++++++++++++++++++ dbus/dbus-threads-internal.h | 2 ++ dbus/dbus-timeout.h | 4 +++ dbus/dbus-userdb.h | 14 ++++++++++ dbus/dbus-uuidgen.h | 2 ++ dbus/dbus-watch.h | 11 ++++++++ 30 files changed, 376 insertions(+), 2 deletions(-) diff --git a/dbus/dbus-auth.h b/dbus/dbus-auth.h index ba1975f..e032302 100644 --- a/dbus/dbus-auth.h +++ b/dbus/dbus-auth.h @@ -41,23 +41,35 @@ typedef enum DBUS_AUTH_STATE_AUTHENTICATED } DBusAuthState; +DBUS_PRIVATE_EXPORT DBusAuth* _dbus_auth_server_new (const DBusString *guid); +DBUS_PRIVATE_EXPORT DBusAuth* _dbus_auth_client_new (void); +DBUS_PRIVATE_EXPORT DBusAuth* _dbus_auth_ref (DBusAuth *auth); +DBUS_PRIVATE_EXPORT void _dbus_auth_unref (DBusAuth *auth); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_mechanisms (DBusAuth *auth, const char **mechanisms); +DBUS_PRIVATE_EXPORT DBusAuthState _dbus_auth_do_work (DBusAuth *auth); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_get_bytes_to_send (DBusAuth *auth, const DBusString **str); +DBUS_PRIVATE_EXPORT void _dbus_auth_bytes_sent (DBusAuth *auth, int bytes_sent); +DBUS_PRIVATE_EXPORT void _dbus_auth_get_buffer (DBusAuth *auth, DBusString **buffer); +DBUS_PRIVATE_EXPORT void _dbus_auth_return_buffer (DBusAuth *auth, DBusString *buffer); +DBUS_PRIVATE_EXPORT void _dbus_auth_get_unused_bytes (DBusAuth *auth, const DBusString **str); +DBUS_PRIVATE_EXPORT void _dbus_auth_delete_unused_bytes (DBusAuth *auth); dbus_bool_t _dbus_auth_needs_encoding (DBusAuth *auth); dbus_bool_t _dbus_auth_encode_data (DBusAuth *auth, @@ -67,9 +79,12 @@ dbus_bool_t _dbus_auth_needs_decoding (DBusAuth *auth); dbus_bool_t _dbus_auth_decode_data (DBusAuth *auth, const DBusString *encoded, DBusString *plaintext); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_credentials (DBusAuth *auth, DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT DBusCredentials* _dbus_auth_get_identity (DBusAuth *auth); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_context (DBusAuth *auth, const DBusString *context); const char* _dbus_auth_get_guid_from_server(DBusAuth *auth); diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h index 64ef336..4835732 100644 --- a/dbus/dbus-connection-internal.h +++ b/dbus/dbus-connection-internal.h @@ -46,9 +46,13 @@ typedef enum typedef void (* DBusPendingFdsChangeFunction) (void *data); +DBUS_PRIVATE_EXPORT void _dbus_connection_lock (DBusConnection *connection); +DBUS_PRIVATE_EXPORT void _dbus_connection_unlock (DBusConnection *connection); +DBUS_PRIVATE_EXPORT DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection); +DBUS_PRIVATE_EXPORT void _dbus_connection_unref_unlocked (DBusConnection *connection); void _dbus_connection_queue_received_message_link (DBusConnection *connection, DBusList *link); @@ -96,21 +100,26 @@ dbus_bool_t _dbus_connection_send_and_unlock (DBusConnection void _dbus_connection_queue_synthesized_message_link (DBusConnection *connection, DBusList *link); +DBUS_PRIVATE_EXPORT void _dbus_connection_test_get_locks (DBusConnection *conn, DBusMutex **mutex_loc, DBusMutex **dispatch_mutex_loc, DBusMutex **io_path_mutex_loc, DBusCondVar **dispatch_cond_loc, DBusCondVar **io_path_cond_loc); +DBUS_PRIVATE_EXPORT int _dbus_connection_get_pending_fds_count (DBusConnection *connection); +DBUS_PRIVATE_EXPORT void _dbus_connection_set_pending_fds_function (DBusConnection *connection, DBusPendingFdsChangeFunction callback, void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection, char **label_p); /* if DBUS_ENABLE_STATS */ +DBUS_PRIVATE_EXPORT void _dbus_connection_get_stats (DBusConnection *connection, dbus_uint32_t *in_messages, dbus_uint32_t *in_bytes, diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h index ab74eac..6bf6c2b 100644 --- a/dbus/dbus-credentials.h +++ b/dbus/dbus-credentials.h @@ -38,14 +38,21 @@ typedef enum { DBUS_CREDENTIAL_WINDOWS_SID } DBusCredentialType; +DBUS_PRIVATE_EXPORT DBusCredentials* _dbus_credentials_new_from_current_process (void); +DBUS_PRIVATE_EXPORT DBusCredentials* _dbus_credentials_new (void); +DBUS_PRIVATE_EXPORT void _dbus_credentials_ref (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT void _dbus_credentials_unref (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_add_pid (DBusCredentials *credentials, dbus_pid_t pid); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials *credentials, dbus_uid_t uid); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_add_windows_sid (DBusCredentials *credentials, const char *windows_sid); dbus_bool_t _dbus_credentials_add_linux_security_label (DBusCredentials *credentials, @@ -53,17 +60,24 @@ dbus_bool_t _dbus_credentials_add_linux_security_label (DBusCredentials dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials *credentials, void *audit_data, dbus_int32_t size); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_include (DBusCredentials *credentials, DBusCredentialType type); +DBUS_PRIVATE_EXPORT dbus_pid_t _dbus_credentials_get_pid (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_uid_t _dbus_credentials_get_unix_uid (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT const char* _dbus_credentials_get_windows_sid (DBusCredentials *credentials); const char * _dbus_credentials_get_linux_security_label (DBusCredentials *credentials); void * _dbus_credentials_get_adt_audit_data (DBusCredentials *credentials); dbus_int32_t _dbus_credentials_get_adt_audit_data_size (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_are_superset (DBusCredentials *credentials, DBusCredentials *possible_subset); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_are_empty (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_are_anonymous (DBusCredentials *credentials); dbus_bool_t _dbus_credentials_add_credentials (DBusCredentials *credentials, DBusCredentials *other_credentials); @@ -71,10 +85,14 @@ dbus_bool_t _dbus_credentials_add_credentials (DBusCredentials dbus_bool_t _dbus_credentials_add_credential (DBusCredentials *credentials, DBusCredentialType which, DBusCredentials *other_credentials); +DBUS_PRIVATE_EXPORT void _dbus_credentials_clear (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT DBusCredentials* _dbus_credentials_copy (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_same_user (DBusCredentials *credentials, DBusCredentials *other_credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_credentials_to_string_append (DBusCredentials *credentials, DBusString *string); diff --git a/dbus/dbus-file.h b/dbus/dbus-file.h index 24837f4..4fa30cd 100644 --- a/dbus/dbus-file.h +++ b/dbus/dbus-file.h @@ -40,6 +40,7 @@ DBUS_BEGIN_DECLS * File interface */ dbus_bool_t _dbus_file_exists (const char *file); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_file_get_contents (DBusString *str, const DBusString *filename, DBusError *error); @@ -53,6 +54,7 @@ dbus_bool_t _dbus_make_file_world_readable (const DBusString *filename, dbus_bool_t _dbus_create_file_exclusively (const DBusString *filename, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_delete_file (const DBusString *filename, DBusError *error); diff --git a/dbus/dbus-hash.h b/dbus/dbus-hash.h index 5aa183c..723d267 100644 --- a/dbus/dbus-hash.h +++ b/dbus/dbus-hash.h @@ -71,47 +71,66 @@ typedef enum DBUS_HASH_UINTPTR /**< Hash keys are integer capable to hold a pointer. */ } DBusHashType; +DBUS_PRIVATE_EXPORT DBusHashTable* _dbus_hash_table_new (DBusHashType type, DBusFreeFunction key_free_function, DBusFreeFunction value_free_function); DBusHashTable* _dbus_hash_table_ref (DBusHashTable *table); +DBUS_PRIVATE_EXPORT void _dbus_hash_table_unref (DBusHashTable *table); void _dbus_hash_table_remove_all (DBusHashTable *table); +DBUS_PRIVATE_EXPORT void _dbus_hash_iter_init (DBusHashTable *table, DBusHashIter *iter); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_iter_next (DBusHashIter *iter); +DBUS_PRIVATE_EXPORT void _dbus_hash_iter_remove_entry (DBusHashIter *iter); +DBUS_PRIVATE_EXPORT void* _dbus_hash_iter_get_value (DBusHashIter *iter); void _dbus_hash_iter_set_value (DBusHashIter *iter, void *value); +DBUS_PRIVATE_EXPORT int _dbus_hash_iter_get_int_key (DBusHashIter *iter); +DBUS_PRIVATE_EXPORT const char* _dbus_hash_iter_get_string_key (DBusHashIter *iter); +DBUS_PRIVATE_EXPORT uintptr_t _dbus_hash_iter_get_uintptr_key (DBusHashIter *iter); dbus_bool_t _dbus_hash_iter_lookup (DBusHashTable *table, void *key, dbus_bool_t create_if_not_found, DBusHashIter *iter); +DBUS_PRIVATE_EXPORT void* _dbus_hash_table_lookup_string (DBusHashTable *table, const char *key); +DBUS_PRIVATE_EXPORT void* _dbus_hash_table_lookup_int (DBusHashTable *table, int key); +DBUS_PRIVATE_EXPORT void* _dbus_hash_table_lookup_uintptr (DBusHashTable *table, uintptr_t key); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_string (DBusHashTable *table, const char *key); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_int (DBusHashTable *table, int key); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_remove_uintptr (DBusHashTable *table, uintptr_t key); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_string (DBusHashTable *table, char *key, void *value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_int (DBusHashTable *table, int key, void *value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_table_insert_uintptr (DBusHashTable *table, uintptr_t key, void *value); +DBUS_PRIVATE_EXPORT int _dbus_hash_table_get_n_entries (DBusHashTable *table); /* Preallocation */ @@ -119,9 +138,12 @@ int _dbus_hash_table_get_n_entries (DBusHashTable *table); /** A preallocated hash entry */ typedef struct DBusPreallocatedHash DBusPreallocatedHash; +DBUS_PRIVATE_EXPORT DBusPreallocatedHash *_dbus_hash_table_preallocate_entry (DBusHashTable *table); +DBUS_PRIVATE_EXPORT void _dbus_hash_table_free_preallocated_entry (DBusHashTable *table, DBusPreallocatedHash *preallocated); +DBUS_PRIVATE_EXPORT void _dbus_hash_table_insert_string_preallocated (DBusHashTable *table, DBusPreallocatedHash *preallocated, char *key, diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 8dea10f..d394680 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -35,9 +35,11 @@ DBUS_BEGIN_DECLS +DBUS_PRIVATE_EXPORT void _dbus_warn (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); +DBUS_PRIVATE_EXPORT void _dbus_warn_check_failed (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); @@ -89,17 +91,23 @@ void _dbus_warn_check_failed (const char *format, #endif #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS +DBUS_PRIVATE_EXPORT void _dbus_verbose_real (const char *file, const int line, const char *function, const char *format,...) _DBUS_GNUC_PRINTF (4, 5); # define _dbus_verbose(fmt,...) _dbus_verbose_real( __FILE__,__LINE__,__FUNCTION__,fmt, ## __VA_ARGS__) #else +DBUS_PRIVATE_EXPORT void _dbus_verbose_real (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); # define _dbus_verbose _dbus_verbose_real #endif +DBUS_PRIVATE_EXPORT void _dbus_verbose_reset_real (void); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_is_verbose_real (void); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_get_verbose (void); +DBUS_PRIVATE_EXPORT void _dbus_set_verbose (dbus_bool_t state); # define _dbus_verbose_reset _dbus_verbose_reset_real @@ -124,11 +132,13 @@ void _dbus_trace_ref (const char *obj_name, const char *env_var, int *enabled); +DBUS_PRIVATE_EXPORT const char* _dbus_strerror (int error_number); #ifdef DBUS_DISABLE_ASSERT #define _dbus_assert(condition) do { } while (0) #else +DBUS_PRIVATE_EXPORT void _dbus_real_assert (dbus_bool_t condition, const char *condition_text, const char *file, @@ -141,6 +151,7 @@ void _dbus_real_assert (dbus_bool_t condition, #ifdef DBUS_DISABLE_ASSERT #define _dbus_assert_not_reached(explanation) do { } while (0) #else +DBUS_PRIVATE_EXPORT void _dbus_real_assert_not_reached (const char *explanation, const char *file, int line) _DBUS_GNUC_NORETURN; @@ -153,6 +164,7 @@ void _dbus_real_assert_not_reached (const char *explanation, #define _dbus_return_val_if_fail(condition, val) #else +DBUS_PRIVATE_EXPORT extern const char *_dbus_return_if_fail_warning_format; #define _dbus_return_if_fail(condition) do { \ @@ -215,9 +227,11 @@ extern const char *_dbus_return_if_fail_warning_format; ((void*)_DBUS_ALIGN_VALUE(this, boundary)) +DBUS_PRIVATE_EXPORT char* _dbus_strdup (const char *str); void* _dbus_memdup (const void *mem, size_t n_bytes); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_array_contains (const char **array, const char *str); char** _dbus_dup_string_array (const char **array); @@ -259,12 +273,15 @@ dbus_bool_t _dbus_set_fd_nonblocking (int fd, void _dbus_verbose_bytes (const unsigned char *data, int len, int offset); +DBUS_PRIVATE_EXPORT void _dbus_verbose_bytes_of_string (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT extern const char *_dbus_no_memory_message; #define _DBUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message) +DBUS_PRIVATE_EXPORT void _dbus_set_error_valist (DBusError *error, const char *name, const char *format, @@ -278,9 +295,11 @@ void _dbus_set_fail_alloc_failures (int failures_per_failure); int _dbus_get_fail_alloc_failures (void); dbus_bool_t _dbus_decrement_fail_alloc_counter (void); dbus_bool_t _dbus_disable_mem_pools (void); +DBUS_PRIVATE_EXPORT int _dbus_get_malloc_blocks_outstanding (void); typedef dbus_bool_t (* DBusTestMemoryFunction) (void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_test_oom_handling (const char *description, DBusTestMemoryFunction func, void *data); @@ -297,6 +316,7 @@ dbus_bool_t _dbus_test_oom_handling (const char *description, #endif /* !DBUS_ENABLE_EMBEDDED_TESTS */ typedef void (* DBusShutdownFunction) (void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_register_shutdown_func (DBusShutdownFunction function, void *data); dbus_bool_t _dbus_register_shutdown_func_unlocked (DBusShutdownFunction function, @@ -335,6 +355,7 @@ void _dbus_unlock (DBusGlobalLock lock); #define _DBUS_LOCK(name) _dbus_lock (_DBUS_LOCK_##name) #define _DBUS_UNLOCK(name) _dbus_unlock (_DBUS_LOCK_##name) +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_threads_init_debug (void); dbus_bool_t _dbus_address_append_escaped (DBusString *escaped, @@ -359,7 +380,9 @@ union DBusGUID char as_bytes[DBUS_UUID_LENGTH_BYTES]; /**< guid as 16 single-byte values */ }; +DBUS_PRIVATE_EXPORT void _dbus_generate_uuid (DBusGUID *uuid); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_uuid_encode (const DBusGUID *uuid, DBusString *encoded); dbus_bool_t _dbus_read_uuid_file (const DBusString *filename, diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h index 910d738..9350a0d 100644 --- a/dbus/dbus-list.h +++ b/dbus/dbus-list.h @@ -37,52 +37,78 @@ struct DBusList DBusList *next; /**< Next list node. */ void *data; /**< Data stored at this element. */ }; +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_append (DBusList **list, void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_prepend (DBusList **list, void *data); dbus_bool_t _dbus_list_insert_before (DBusList **list, DBusList *before_this_link, void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_insert_after (DBusList **list, DBusList *after_this_link, void *data); +DBUS_PRIVATE_EXPORT void _dbus_list_insert_before_link (DBusList **list, DBusList *before_this_link, DBusList *link); +DBUS_PRIVATE_EXPORT void _dbus_list_insert_after_link (DBusList **list, DBusList *after_this_link, DBusList *link); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_remove (DBusList **list, void *data); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_remove_last (DBusList **list, void *data); +DBUS_PRIVATE_EXPORT void _dbus_list_remove_link (DBusList **list, DBusList *link); +DBUS_PRIVATE_EXPORT DBusList* _dbus_list_find_last (DBusList **list, void *data); +DBUS_PRIVATE_EXPORT void _dbus_list_clear (DBusList **list); +DBUS_PRIVATE_EXPORT DBusList* _dbus_list_get_first_link (DBusList **list); +DBUS_PRIVATE_EXPORT DBusList* _dbus_list_get_last_link (DBusList **list); +DBUS_PRIVATE_EXPORT void* _dbus_list_get_last (DBusList **list); +DBUS_PRIVATE_EXPORT void* _dbus_list_get_first (DBusList **list); +DBUS_PRIVATE_EXPORT void* _dbus_list_pop_first (DBusList **list); +DBUS_PRIVATE_EXPORT void* _dbus_list_pop_last (DBusList **list); +DBUS_PRIVATE_EXPORT DBusList* _dbus_list_pop_first_link (DBusList **list); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_copy (DBusList **list, DBusList **dest); +DBUS_PRIVATE_EXPORT int _dbus_list_get_length (DBusList **list); +DBUS_PRIVATE_EXPORT DBusList* _dbus_list_alloc_link (void *data); +DBUS_PRIVATE_EXPORT void _dbus_list_free_link (DBusList *link); +DBUS_PRIVATE_EXPORT void _dbus_list_unlink (DBusList **list, DBusList *link); +DBUS_PRIVATE_EXPORT void _dbus_list_append_link (DBusList **list, DBusList *link); +DBUS_PRIVATE_EXPORT void _dbus_list_prepend_link (DBusList **list, DBusList *link); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_length_is_one (DBusList **list); +DBUS_PRIVATE_EXPORT void _dbus_list_foreach (DBusList **list, DBusForeachFunction function, void *data); @@ -91,6 +117,7 @@ void _dbus_list_foreach (DBusList **list, #define _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev) /* if DBUS_ENABLE_STATS */ +DBUS_PRIVATE_EXPORT void _dbus_list_get_stats (dbus_uint32_t *in_use_p, dbus_uint32_t *in_free_list_p, dbus_uint32_t *allocated_p); diff --git a/dbus/dbus-macros.h b/dbus/dbus-macros.h index 8d6c300..a82d911 100644 --- a/dbus/dbus-macros.h +++ b/dbus/dbus-macros.h @@ -182,7 +182,9 @@ * platforms other than Windows. */ -#if defined(_WIN32) +#if defined(DBUS_EXPORT) + /* value forced by compiler command line, don't redefine */ +#elif defined(_WIN32) # if defined(DBUS_STATIC_BUILD) # define DBUS_EXPORT # elif defined(dbus_1_EXPORTS) @@ -190,10 +192,28 @@ # else # define DBUS_EXPORT __declspec(dllimport) # endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define DBUS_EXPORT __attribute__ ((__visibility__ ("default"))) #else #define DBUS_EXPORT #endif +#if defined(DBUS_PRIVATE_EXPORT) + /* value forced by compiler command line, don't redefine */ +#elif defined(_WIN32) +# if defined(DBUS_STATIC_BUILD) +# define DBUS_PRIVATE_EXPORT /* no decoration */ +# elif defined(dbus_1_EXPORTS) +# define DBUS_PRIVATE_EXPORT __declspec(dllexport) +# else +# define DBUS_PRIVATE_EXPORT __declspec(dllimport) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define DBUS_PRIVATE_EXPORT __attribute__ ((__visibility__ ("default"))) +#else +# define DBUS_PRIVATE_EXPORT /* no decoration */ +#endif + /** @} */ #endif /* DBUS_MACROS_H */ diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index 9df67cb..68ff348 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -148,6 +148,7 @@ #endif #ifndef _dbus_unpack_uint16 +DBUS_PRIVATE_EXPORT dbus_uint16_t _dbus_unpack_uint16 (int byte_order, const unsigned char *data); #endif @@ -156,6 +157,7 @@ void _dbus_pack_uint32 (dbus_uint32_t value, int byte_order, unsigned char *data); #ifndef _dbus_unpack_uint32 +DBUS_PRIVATE_EXPORT dbus_uint32_t _dbus_unpack_uint32 (int byte_order, const unsigned char *data); #endif @@ -201,18 +203,22 @@ void _dbus_marshal_skip_array (const DBusString *str, int element_type, int byte_order, int *pos); +DBUS_PRIVATE_EXPORT void _dbus_marshal_set_uint32 (DBusString *str, int pos, dbus_uint32_t value, int byte_order); +DBUS_PRIVATE_EXPORT dbus_uint32_t _dbus_marshal_read_uint32 (const DBusString *str, int pos, int byte_order, int *new_pos); int _dbus_type_get_alignment (int typecode); int _dbus_type_get_alignment (int typecode); +DBUS_PRIVATE_EXPORT const char* _dbus_type_to_string (int typecode); +DBUS_PRIVATE_EXPORT int _dbus_first_type_in_signature (const DBusString *str, int pos); diff --git a/dbus/dbus-marshal-byteswap.h b/dbus/dbus-marshal-byteswap.h index be2dd75..f66f2e2 100644 --- a/dbus/dbus-marshal-byteswap.h +++ b/dbus/dbus-marshal-byteswap.h @@ -27,6 +27,7 @@ #include #include +DBUS_PRIVATE_EXPORT void _dbus_marshal_byteswap (const DBusString *signature, int signature_start, int old_byte_order, diff --git a/dbus/dbus-marshal-header.h b/dbus/dbus-marshal-header.h index 350fe5c..c8c0112 100644 --- a/dbus/dbus-marshal-header.h +++ b/dbus/dbus-marshal-header.h @@ -78,6 +78,7 @@ void _dbus_header_set_serial (DBusHeader *header, dbus_uint32_t _dbus_header_get_serial (DBusHeader *header); void _dbus_header_update_lengths (DBusHeader *header, int body_len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_header_set_field_basic (DBusHeader *header, int field, int type, @@ -86,10 +87,12 @@ dbus_bool_t _dbus_header_get_field_basic (DBusHeader *header, int field, int type, void *value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_header_get_field_raw (DBusHeader *header, int field, const DBusString **str, int *pos); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_header_delete_field (DBusHeader *header, int field); void _dbus_header_toggle_flag (DBusHeader *header, @@ -121,6 +124,7 @@ dbus_bool_t _dbus_header_load (DBusHeader *header, int len); void _dbus_header_byteswap (DBusHeader *header, int new_order); +DBUS_PRIVATE_EXPORT char _dbus_header_get_byte_order (const DBusHeader *header); diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h index acbfd73..fa1d1ef 100644 --- a/dbus/dbus-marshal-recursive.h +++ b/dbus/dbus-marshal-recursive.h @@ -96,37 +96,48 @@ struct DBusArrayLenFixup int new_len; /**< the new value of the length in the written-out block */ }; +DBUS_PRIVATE_EXPORT void _dbus_type_reader_init (DBusTypeReader *reader, int byte_order, const DBusString *type_str, int type_pos, const DBusString *value_str, int value_pos); +DBUS_PRIVATE_EXPORT void _dbus_type_reader_init_types_only (DBusTypeReader *reader, const DBusString *type_str, int type_pos); +DBUS_PRIVATE_EXPORT int _dbus_type_reader_get_current_type (const DBusTypeReader *reader); +DBUS_PRIVATE_EXPORT int _dbus_type_reader_get_element_type (const DBusTypeReader *reader); int _dbus_type_reader_get_value_pos (const DBusTypeReader *reader); +DBUS_PRIVATE_EXPORT void _dbus_type_reader_read_basic (const DBusTypeReader *reader, void *value); int _dbus_type_reader_get_array_length (const DBusTypeReader *reader); +DBUS_PRIVATE_EXPORT void _dbus_type_reader_read_fixed_multi (const DBusTypeReader *reader, void *value, int *n_elements); void _dbus_type_reader_read_raw (const DBusTypeReader *reader, const unsigned char **value_location); +DBUS_PRIVATE_EXPORT void _dbus_type_reader_recurse (DBusTypeReader *reader, DBusTypeReader *subreader); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_reader_next (DBusTypeReader *reader); dbus_bool_t _dbus_type_reader_has_next (const DBusTypeReader *reader); +DBUS_PRIVATE_EXPORT void _dbus_type_reader_get_signature (const DBusTypeReader *reader, const DBusString **str_p, int *start_p, int *len_p); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_reader_set_basic (DBusTypeReader *reader, const void *value, const DBusTypeReader *realign_root); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_reader_delete (DBusTypeReader *reader, const DBusTypeReader *realign_root); @@ -136,6 +147,7 @@ dbus_bool_t _dbus_type_reader_equal_values (const DBusTypeReader *l void _dbus_type_signature_next (const char *signature, int *type_pos); +DBUS_PRIVATE_EXPORT void _dbus_type_writer_init (DBusTypeWriter *writer, int byte_order, DBusString *type_str, @@ -150,30 +162,36 @@ void _dbus_type_writer_add_types (DBusTypeWriter *write DBusString *type_str, int type_pos); void _dbus_type_writer_remove_types (DBusTypeWriter *writer); +DBUS_PRIVATE_EXPORT void _dbus_type_writer_init_values_only (DBusTypeWriter *writer, int byte_order, const DBusString *type_str, int type_pos, DBusString *value_str, int value_pos); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_writer_write_basic (DBusTypeWriter *writer, int type, const void *value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_writer_write_fixed_multi (DBusTypeWriter *writer, int element_type, const void *value, int n_elements); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_writer_recurse (DBusTypeWriter *writer, int container_type, const DBusString *contained_type, int contained_type_start, DBusTypeWriter *sub); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_writer_unrecurse (DBusTypeWriter *writer, DBusTypeWriter *sub); dbus_bool_t _dbus_type_writer_append_array (DBusTypeWriter *writer, const DBusString *contained_type, int contained_type_start, DBusTypeWriter *sub); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_type_writer_write_reader (DBusTypeWriter *writer, DBusTypeReader *reader); diff --git a/dbus/dbus-marshal-validate.h b/dbus/dbus-marshal-validate.h index 0643420..8ab024f 100644 --- a/dbus/dbus-marshal-validate.h +++ b/dbus/dbus-marshal-validate.h @@ -116,9 +116,11 @@ typedef enum DBUS_VALIDITY_LAST } DBusValidity; +DBUS_PRIVATE_EXPORT DBusValidity _dbus_validate_signature_with_reason (const DBusString *type_str, int type_pos, int len); +DBUS_PRIVATE_EXPORT DBusValidity _dbus_validate_body_with_reason (const DBusString *expected_signature, int expected_signature_start, int byte_order, @@ -129,24 +131,31 @@ DBusValidity _dbus_validate_body_with_reason (const DBusString *expected_si const char *_dbus_validity_to_error_message (DBusValidity validity); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_path (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_interface (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_member (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_error_name (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_bus_name (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_bus_namespace (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_validate_signature (const DBusString *str, int start, int len); diff --git a/dbus/dbus-mempool.h b/dbus/dbus-mempool.h index 6693eeb..bc465ac 100644 --- a/dbus/dbus-mempool.h +++ b/dbus/dbus-mempool.h @@ -32,10 +32,14 @@ DBUS_BEGIN_DECLS typedef struct DBusMemPool DBusMemPool; +DBUS_PRIVATE_EXPORT DBusMemPool* _dbus_mem_pool_new (int element_size, dbus_bool_t zero_elements); +DBUS_PRIVATE_EXPORT void _dbus_mem_pool_free (DBusMemPool *pool); +DBUS_PRIVATE_EXPORT void* _dbus_mem_pool_alloc (DBusMemPool *pool); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_mem_pool_dealloc (DBusMemPool *pool, void *element); diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h index e9a9ec0..4bb4d8b 100644 --- a/dbus/dbus-message-internal.h +++ b/dbus/dbus-message-internal.h @@ -50,6 +50,7 @@ typedef struct DBusMessageLoader DBusMessageLoader; void _dbus_message_get_network_data (DBusMessage *message, const DBusString **header, const DBusString **body); +DBUS_PRIVATE_EXPORT void _dbus_message_get_unix_fds (DBusMessage *message, const int **fds, unsigned *n_fds); @@ -63,34 +64,45 @@ void _dbus_message_add_counter_link (DBusMessage *message, void _dbus_message_remove_counter (DBusMessage *message, DBusCounter *counter); +DBUS_PRIVATE_EXPORT DBusMessageLoader* _dbus_message_loader_new (void); +DBUS_PRIVATE_EXPORT DBusMessageLoader* _dbus_message_loader_ref (DBusMessageLoader *loader); +DBUS_PRIVATE_EXPORT void _dbus_message_loader_unref (DBusMessageLoader *loader); +DBUS_PRIVATE_EXPORT void _dbus_message_loader_get_buffer (DBusMessageLoader *loader, DBusString **buffer); +DBUS_PRIVATE_EXPORT void _dbus_message_loader_return_buffer (DBusMessageLoader *loader, DBusString *buffer); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_message_loader_get_unix_fds (DBusMessageLoader *loader, int **fds, unsigned *max_n_fds); +DBUS_PRIVATE_EXPORT void _dbus_message_loader_return_unix_fds (DBusMessageLoader *loader, int *fds, unsigned n_fds); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_message_loader_queue_messages (DBusMessageLoader *loader); DBusMessage* _dbus_message_loader_peek_message (DBusMessageLoader *loader); +DBUS_PRIVATE_EXPORT DBusMessage* _dbus_message_loader_pop_message (DBusMessageLoader *loader); DBusList* _dbus_message_loader_pop_message_link (DBusMessageLoader *loader); void _dbus_message_loader_putback_message_link (DBusMessageLoader *loader, DBusList *link); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_message_loader_get_is_corrupted (DBusMessageLoader *loader); DBusValidity _dbus_message_loader_get_corruption_reason (DBusMessageLoader *loader); void _dbus_message_loader_set_max_message_size (DBusMessageLoader *loader, long size); +DBUS_PRIVATE_EXPORT long _dbus_message_loader_get_max_message_size (DBusMessageLoader *loader); void _dbus_message_loader_set_max_message_unix_fds(DBusMessageLoader *loader, diff --git a/dbus/dbus-message-private.h b/dbus/dbus-message-private.h index a611b09..50c41a8 100644 --- a/dbus/dbus-message-private.h +++ b/dbus/dbus-message-private.h @@ -133,6 +133,7 @@ struct DBusMessage #endif }; +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_message_iter_get_args_valist (DBusMessageIter *iter, DBusError *error, int first_arg_type, diff --git a/dbus/dbus-pending-call-internal.h b/dbus/dbus-pending-call-internal.h index 1875eea..393e660 100644 --- a/dbus/dbus-pending-call-internal.h +++ b/dbus/dbus-pending-call-internal.h @@ -51,10 +51,13 @@ void _dbus_pending_call_set_reply_serial_unlocked (DBusPendingCal dbus_bool_t _dbus_pending_call_set_timeout_error_unlocked (DBusPendingCall *pending, DBusMessage *message, dbus_uint32_t serial); +DBUS_PRIVATE_EXPORT DBusPendingCall* _dbus_pending_call_new_unlocked (DBusConnection *connection, int timeout_milliseconds, DBusTimeoutHandler timeout_handler); +DBUS_PRIVATE_EXPORT DBusPendingCall* _dbus_pending_call_ref_unlocked (DBusPendingCall *pending); +DBUS_PRIVATE_EXPORT void _dbus_pending_call_unref_and_unlock (DBusPendingCall *pending); dbus_bool_t _dbus_pending_call_set_data_unlocked (DBusPendingCall *pending, dbus_int32_t slot, diff --git a/dbus/dbus-pipe.h b/dbus/dbus-pipe.h index c2063b5..ca924cc 100644 --- a/dbus/dbus-pipe.h +++ b/dbus/dbus-pipe.h @@ -42,18 +42,25 @@ struct DBusPipe { int fd; }; +DBUS_PRIVATE_EXPORT void _dbus_pipe_init (DBusPipe *pipe, int fd); +DBUS_PRIVATE_EXPORT void _dbus_pipe_init_stdout (DBusPipe *pipe); +DBUS_PRIVATE_EXPORT int _dbus_pipe_write (DBusPipe *pipe, const DBusString *buffer, int start, int len, DBusError *error); +DBUS_PRIVATE_EXPORT int _dbus_pipe_close (DBusPipe *pipe, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_pipe_is_valid (DBusPipe *pipe); +DBUS_PRIVATE_EXPORT void _dbus_pipe_invalidate (DBusPipe *pipe); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_pipe_is_stdout_or_stderr (DBusPipe *pipe); #endif diff --git a/dbus/dbus-server-protected.h b/dbus/dbus-server-protected.h index e6dbd1e..44f53ee 100644 --- a/dbus/dbus-server-protected.h +++ b/dbus/dbus-server-protected.h @@ -99,6 +99,7 @@ dbus_bool_t _dbus_server_add_watch (DBusServer *server, DBusWatch *watch); void _dbus_server_remove_watch (DBusServer *server, DBusWatch *watch); +DBUS_PRIVATE_EXPORT void _dbus_server_toggle_all_watches (DBusServer *server, dbus_bool_t enabled); dbus_bool_t _dbus_server_add_timeout (DBusServer *server, @@ -109,7 +110,9 @@ void _dbus_server_toggle_timeout (DBusServer *server, DBusTimeout *timeout, dbus_bool_t enabled); +DBUS_PRIVATE_EXPORT void _dbus_server_ref_unlocked (DBusServer *server); +DBUS_PRIVATE_EXPORT void _dbus_server_unref_unlocked (DBusServer *server); typedef enum diff --git a/dbus/dbus-server-socket.h b/dbus/dbus-server-socket.h index 3aec712..44e11e8 100644 --- a/dbus/dbus-server-socket.h +++ b/dbus/dbus-server-socket.h @@ -35,6 +35,7 @@ DBusServer* _dbus_server_new_for_socket (int *fds, DBusNonceFile *noncefile); DBusServer* _dbus_server_new_for_autolaunch (const DBusString *address, DBusError *error); +DBUS_PRIVATE_EXPORT DBusServer* _dbus_server_new_for_tcp_socket (const char *host, const char *bind, const char *port, diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h index 44860fe..95a0309 100644 --- a/dbus/dbus-string.h +++ b/dbus/dbus-string.h @@ -67,57 +67,72 @@ struct DBusString #define _dbus_string_get_const_data_len(s,start,len) (((const char*)(((DBusString*)(s))->dummy1)) + (start)) #endif +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_init (DBusString *str); +DBUS_PRIVATE_EXPORT void _dbus_string_init_const (DBusString *str, const char *value); +DBUS_PRIVATE_EXPORT void _dbus_string_init_const_len (DBusString *str, const char *value, int len); dbus_bool_t _dbus_string_init_preallocated (DBusString *str, int allocate_size); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_init_from_string (DBusString *str, const DBusString *from); +DBUS_PRIVATE_EXPORT void _dbus_string_free (DBusString *str); void _dbus_string_lock (DBusString *str); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_compact (DBusString *str, int max_waste); #ifndef _dbus_string_get_data +DBUS_PRIVATE_EXPORT char* _dbus_string_get_data (DBusString *str); #endif /* _dbus_string_get_data */ #ifndef _dbus_string_get_const_data +DBUS_PRIVATE_EXPORT const char* _dbus_string_get_const_data (const DBusString *str); #endif /* _dbus_string_get_const_data */ char* _dbus_string_get_data_len (DBusString *str, int start, int len); #ifndef _dbus_string_get_const_data_len +DBUS_PRIVATE_EXPORT const char* _dbus_string_get_const_data_len (const DBusString *str, int start, int len); #endif #ifndef _dbus_string_set_byte +DBUS_PRIVATE_EXPORT void _dbus_string_set_byte (DBusString *str, int i, unsigned char byte); #endif #ifndef _dbus_string_get_byte +DBUS_PRIVATE_EXPORT unsigned char _dbus_string_get_byte (const DBusString *str, int start); #endif /* _dbus_string_get_byte */ +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_insert_bytes (DBusString *str, int i, int n_bytes, unsigned char byte); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_insert_byte (DBusString *str, int i, unsigned char byte); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_steal_data (DBusString *str, char **data_return); dbus_bool_t _dbus_string_steal_data_len (DBusString *str, char **data_return, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_copy_data (const DBusString *str, char **data_return); dbus_bool_t _dbus_string_copy_data_len (const DBusString *str, @@ -127,37 +142,49 @@ dbus_bool_t _dbus_string_copy_data_len (const DBusString *str, void _dbus_string_copy_to_buffer (const DBusString *str, char *buffer, int len); +DBUS_PRIVATE_EXPORT void _dbus_string_copy_to_buffer_with_nul (const DBusString *str, char *buffer, int avail_len); #ifndef _dbus_string_get_length +DBUS_PRIVATE_EXPORT int _dbus_string_get_length (const DBusString *str); #endif /* !_dbus_string_get_length */ +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_lengthen (DBusString *str, int additional_length); +DBUS_PRIVATE_EXPORT void _dbus_string_shorten (DBusString *str, int length_to_remove); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_set_length (DBusString *str, int length); dbus_bool_t _dbus_string_align_length (DBusString *str, int alignment); dbus_bool_t _dbus_string_alloc_space (DBusString *str, int extra_bytes); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append (DBusString *str, const char *buffer); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_len (DBusString *str, const char *buffer, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_int (DBusString *str, long value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_uint (DBusString *str, unsigned long value); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_byte (DBusString *str, unsigned char byte); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_printf (DBusString *str, const char *format, ...) _DBUS_GNUC_PRINTF (2, 3); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_printf_valist (DBusString *str, const char *format, va_list args); @@ -173,13 +200,16 @@ dbus_bool_t _dbus_string_insert_8_aligned (DBusString *str, dbus_bool_t _dbus_string_insert_alignment (DBusString *str, int *insert_at, int alignment); +DBUS_PRIVATE_EXPORT void _dbus_string_delete (DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_move (DBusString *source, int start, DBusString *dest, int insert_at); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_copy (const DBusString *source, int start, DBusString *dest, @@ -189,36 +219,44 @@ dbus_bool_t _dbus_string_move_len (DBusString *source, int len, DBusString *dest, int insert_at); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_copy_len (const DBusString *source, int start, int len, DBusString *dest, int insert_at); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_replace_len (const DBusString *source, int start, int len, DBusString *dest, int replace_at, int replace_len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_split_on_byte (DBusString *source, unsigned char byte, DBusString *tail); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_parse_int (const DBusString *str, int start, long *value_return, int *end_return); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_parse_uint (const DBusString *str, int start, unsigned long *value_return, int *end_return); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_find (const DBusString *str, int start, const char *substr, int *found); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_find_eol (const DBusString *str, int start, int *found, int *found_len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_find_to (const DBusString *str, int start, int end, @@ -228,62 +266,80 @@ dbus_bool_t _dbus_string_find_byte_backward (const DBusString *str, int start, unsigned char byte, int *found); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_find_blank (const DBusString *str, int start, int *found); +DBUS_PRIVATE_EXPORT void _dbus_string_skip_blank (const DBusString *str, int start, int *end); +DBUS_PRIVATE_EXPORT void _dbus_string_skip_white (const DBusString *str, int start, int *end); void _dbus_string_skip_white_reverse (const DBusString *str, int end, int *start); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_equal (const DBusString *a, const DBusString *b); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_equal_c_str (const DBusString *a, const char *c_str); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_equal_len (const DBusString *a, const DBusString *b, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_equal_substring (const DBusString *a, int a_start, int a_len, const DBusString *b, int b_start); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_starts_with_c_str (const DBusString *a, const char *c_str); dbus_bool_t _dbus_string_ends_with_c_str (const DBusString *a, const char *c_str); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_pop_line (DBusString *source, DBusString *dest); +DBUS_PRIVATE_EXPORT void _dbus_string_delete_first_word (DBusString *str); +DBUS_PRIVATE_EXPORT void _dbus_string_delete_leading_blanks (DBusString *str); +DBUS_PRIVATE_EXPORT void _dbus_string_chop_white (DBusString *str); dbus_bool_t _dbus_string_append_byte_as_hex (DBusString *str, unsigned char byte); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_hex_encode (const DBusString *source, int start, DBusString *dest, int insert_at); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_hex_decode (const DBusString *source, int start, int *end_return, DBusString *dest, int insert_at); +DBUS_PRIVATE_EXPORT void _dbus_string_tolower_ascii (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT void _dbus_string_toupper_ascii (const DBusString *str, int start, int len); dbus_bool_t _dbus_string_validate_ascii (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_validate_utf8 (const DBusString *str, int start, int len); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_validate_nul (const DBusString *str, int start, int len); diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h index df9902d..b26673c 100644 --- a/dbus/dbus-sysdeps-unix.h +++ b/dbus/dbus-sysdeps-unix.h @@ -40,11 +40,14 @@ DBUS_BEGIN_DECLS * @{ */ +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_close (int fd, DBusError *error); +DBUS_PRIVATE_EXPORT int _dbus_dup (int fd, DBusError *error); +DBUS_PRIVATE_EXPORT int _dbus_read (int fd, DBusString *buffer, @@ -131,17 +134,20 @@ dbus_bool_t _dbus_group_info_fill_gid (DBusGroupInfo *info, void _dbus_group_info_free (DBusGroupInfo *info); dbus_uid_t _dbus_getuid (void); +DBUS_PRIVATE_EXPORT dbus_uid_t _dbus_geteuid (void); dbus_bool_t _dbus_parse_uid (const DBusString *uid_str, dbus_uid_t *uid); +DBUS_PRIVATE_EXPORT void _dbus_close_all (void); dbus_bool_t _dbus_append_address_from_socket (int fd, DBusString *address, DBusError *error); +DBUS_PRIVATE_EXPORT void _dbus_fd_set_close_on_exec (int fd); /** @} */ diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h index 3efdf72..a536770 100644 --- a/dbus/dbus-sysdeps-win.h +++ b/dbus/dbus-sysdeps-win.h @@ -40,13 +40,16 @@ extern void *_dbus_win_get_dll_hmodule (void); void _dbus_win_set_errno (int err); +DBUS_PRIVATE_EXPORT const char* _dbus_win_error_from_last_error (void); dbus_bool_t _dbus_win_startup_winsock (void); void _dbus_win_warn_win_error (const char *message, unsigned long code); +DBUS_PRIVATE_EXPORT char * _dbus_win_error_string (int error_number); +DBUS_PRIVATE_EXPORT void _dbus_win_free_error_string (char *string); extern const char* _dbus_lm_strerror (int error_number); @@ -70,6 +73,7 @@ wchar_t *_dbus_win_utf8_to_utf16 (const char *str, char *_dbus_win_utf16_to_utf8 (const wchar_t *str, DBusError *error); +DBUS_PRIVATE_EXPORT void _dbus_win_set_error_from_win_error (DBusError *error, int code); dbus_bool_t @@ -80,14 +84,17 @@ _dbus_win_sid_to_name_and_domain (dbus_uid_t uid, dbus_bool_t _dbus_file_exists (const char *filename); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_get_config_file_name(DBusString *config_file, char *s); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_get_install_root(char *prefix, int len); void _dbus_threads_windows_init_global (void); void _dbus_threads_windows_ensure_ctor_linked (void); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_getsid(char **sid, dbus_pid_t process_id); #endif diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 5f2b867..e7a556b 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -91,7 +91,9 @@ typedef struct DBusPipe DBusPipe; void _dbus_abort (void) _DBUS_GNUC_NORETURN; dbus_bool_t _dbus_check_setuid (void); +DBUS_PRIVATE_EXPORT const char* _dbus_getenv (const char *varname); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_clearenv (void); char ** _dbus_get_environment (void); @@ -127,11 +129,14 @@ typedef unsigned long dbus_gid_t; * */ +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_close_socket (int fd, DBusError *error); +DBUS_PRIVATE_EXPORT int _dbus_read_socket (int fd, DBusString *buffer, int count); +DBUS_PRIVATE_EXPORT int _dbus_write_socket (int fd, const DBusString *buffer, int start, @@ -149,6 +154,7 @@ int _dbus_read_socket_with_unix_fds (int fd, int count, int *fds, int *n_fds); +DBUS_PRIVATE_EXPORT int _dbus_write_socket_with_unix_fds (int fd, const DBusString *buffer, int start, @@ -194,6 +200,7 @@ dbus_bool_t _dbus_send_credentials_socket (int server_fd, dbus_bool_t _dbus_credentials_add_from_user (DBusCredentials *credentials, const DBusString *username); dbus_bool_t _dbus_credentials_add_from_current_process (DBusCredentials *credentials); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_append_user_from_current_process (DBusString *str); dbus_bool_t _dbus_parse_unix_user_from_config (const DBusString *username, @@ -317,12 +324,15 @@ typedef struct short revents; /**< Events that occurred */ } DBusPollFD; +DBUS_PRIVATE_EXPORT int _dbus_poll (DBusPollFD *fds, int n_fds, int timeout_milliseconds); +DBUS_PRIVATE_EXPORT void _dbus_sleep_milliseconds (int milliseconds); +DBUS_PRIVATE_EXPORT void _dbus_get_monotonic_time (long *tv_sec, long *tv_usec); @@ -332,15 +342,19 @@ void _dbus_get_real_time (long *tv_sec, /** * directory interface */ +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_create_directory (const DBusString *filename, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_delete_directory (const DBusString *filename, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_concat_dir_and_file (DBusString *dir, const DBusString *next_component); dbus_bool_t _dbus_string_get_dirname (const DBusString *filename, DBusString *dirname); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_path_is_absolute (const DBusString *filename); dbus_bool_t _dbus_get_standard_session_servicedirs (DBusList **dirs); @@ -362,6 +376,7 @@ void _dbus_directory_close (DBusDirIter *iter); dbus_bool_t _dbus_check_dir_is_private_to_user (DBusString *dir, DBusError *error); +DBUS_PRIVATE_EXPORT const char* _dbus_get_tmpdir (void); /** @@ -373,10 +388,13 @@ void _dbus_generate_random_bytes_buffer (char *buffer, int n_bytes); dbus_bool_t _dbus_generate_random_bytes (DBusString *str, int n_bytes); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_generate_random_ascii (DBusString *str, int n_bytes); +DBUS_PRIVATE_EXPORT const char* _dbus_error_from_errno (int error_number); +DBUS_PRIVATE_EXPORT const char* _dbus_error_from_system_errno (void); int _dbus_save_socket_errno (void); @@ -387,13 +405,15 @@ dbus_bool_t _dbus_get_is_errno_enomem (int e); dbus_bool_t _dbus_get_is_errno_eintr (int e); dbus_bool_t _dbus_get_is_errno_epipe (int e); dbus_bool_t _dbus_get_is_errno_etoomanyrefs (int e); +DBUS_PRIVATE_EXPORT const char* _dbus_strerror_from_errno (void); void _dbus_disable_sigpipe (void); - +DBUS_PRIVATE_EXPORT void _dbus_exit (int code) _DBUS_GNUC_NORETURN; +DBUS_PRIVATE_EXPORT int _dbus_printf_string_upper_bound (const char *format, va_list args); @@ -416,6 +436,7 @@ typedef struct dbus_bool_t _dbus_stat (const DBusString *filename, DBusStat *statbuf, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_full_duplex_pipe (int *fd1, int *fd2, dbus_bool_t blocking, @@ -532,6 +553,7 @@ void _dbus_threads_lock_platform_specific (void); */ void _dbus_threads_unlock_platform_specific (void); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_split_paths_and_append (DBusString *dirs, const char *suffix, DBusList **dir_list); @@ -542,11 +564,13 @@ unsigned long _dbus_pid_for_log (void); * the PID file handling just needs a little more abstraction * in the bus daemon first. */ +DBUS_PRIVATE_EXPORT dbus_pid_t _dbus_getpid (void); dbus_bool_t _dbus_change_to_daemon_user (const char *user, DBusError *error); +DBUS_PRIVATE_EXPORT void _dbus_flush_caches (void); /* diff --git a/dbus/dbus-test.h b/dbus/dbus-test.h index f254388..71876a1 100644 --- a/dbus/dbus-test.h +++ b/dbus/dbus-test.h @@ -28,29 +28,72 @@ #include #include +/* Only things that are in libdbus-1.la and used from libdbus-internal.la + * need to have DBUS_PRIVATE_EXPORT. If you get + * + * warning: 'foo' redeclared without dllimport attribute: previous + * dllimport ignored [-Wattributes] + * + * then you have added too many. + */ + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_hash_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_list_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_marshal_test (void); + dbus_bool_t _dbus_marshal_recursive_test (void); dbus_bool_t _dbus_marshal_byteswap_test (void); dbus_bool_t _dbus_marshal_validate_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_misc_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_signature_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_mem_pool_test (void); + dbus_bool_t _dbus_string_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_address_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_server_test (void); + dbus_bool_t _dbus_message_test (const char *test_data_dir); dbus_bool_t _dbus_auth_test (const char *test_data_dir); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_sha_test (const char *test_data_dir); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_keyring_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_data_slot_test (void); + dbus_bool_t _dbus_sysdeps_test (void); dbus_bool_t _dbus_spawn_test (const char *test_data_dir); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_userdb_test (const char *test_data_dir); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_transport_unix_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_memory_test (void); + +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_object_tree_test (void); + dbus_bool_t _dbus_credentials_test (const char *test_data_dir); void dbus_internal_do_not_use_run_tests (const char *test_data_dir, diff --git a/dbus/dbus-threads-internal.h b/dbus/dbus-threads-internal.h index 64e8bac..076acd2 100644 --- a/dbus/dbus-threads-internal.h +++ b/dbus/dbus-threads-internal.h @@ -48,7 +48,9 @@ typedef struct DBusCMutex DBusCMutex; DBUS_BEGIN_DECLS +DBUS_PRIVATE_EXPORT void _dbus_rmutex_lock (DBusRMutex *mutex); +DBUS_PRIVATE_EXPORT void _dbus_rmutex_unlock (DBusRMutex *mutex); void _dbus_rmutex_new_at_location (DBusRMutex **location_p); void _dbus_rmutex_free_at_location (DBusRMutex **location_p); diff --git a/dbus/dbus-timeout.h b/dbus/dbus-timeout.h index d0a8af4..c652bb7 100644 --- a/dbus/dbus-timeout.h +++ b/dbus/dbus-timeout.h @@ -40,14 +40,18 @@ typedef struct DBusTimeoutList DBusTimeoutList; /** function to run when the timeout is handled */ typedef dbus_bool_t (* DBusTimeoutHandler) (void *data); +DBUS_PRIVATE_EXPORT DBusTimeout* _dbus_timeout_new (int interval, DBusTimeoutHandler handler, void *data, DBusFreeFunction free_data_function); DBusTimeout* _dbus_timeout_ref (DBusTimeout *timeout); +DBUS_PRIVATE_EXPORT void _dbus_timeout_unref (DBusTimeout *timeout); +DBUS_PRIVATE_EXPORT void _dbus_timeout_set_interval (DBusTimeout *timeout, int interval); +DBUS_PRIVATE_EXPORT void _dbus_timeout_set_enabled (DBusTimeout *timeout, dbus_bool_t enabled); diff --git a/dbus/dbus-userdb.h b/dbus/dbus-userdb.h index d6b72d8..53fc90b 100644 --- a/dbus/dbus-userdb.h +++ b/dbus/dbus-userdb.h @@ -56,6 +56,7 @@ DBusUserDatabase* _dbus_user_database_new (void); DBusUserDatabase* _dbus_user_database_ref (DBusUserDatabase *db); void _dbus_user_database_flush (DBusUserDatabase *db); void _dbus_user_database_unref (DBusUserDatabase *db); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_user_database_get_uid (DBusUserDatabase *db, dbus_uid_t uid, const DBusUserInfo **info, @@ -64,6 +65,7 @@ dbus_bool_t _dbus_user_database_get_gid (DBusUserDatabase *db, dbus_gid_t gid, const DBusGroupInfo **info, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_user_database_get_username (DBusUserDatabase *db, const DBusString *username, const DBusUserInfo **info, @@ -73,20 +75,27 @@ dbus_bool_t _dbus_user_database_get_groupname (DBusUserDatabase *db, const DBusGroupInfo **info, DBusError *error); +DBUS_PRIVATE_EXPORT DBusUserInfo* _dbus_user_database_lookup (DBusUserDatabase *db, dbus_uid_t uid, const DBusString *username, DBusError *error); +DBUS_PRIVATE_EXPORT DBusGroupInfo* _dbus_user_database_lookup_group (DBusUserDatabase *db, dbus_gid_t gid, const DBusString *groupname, DBusError *error); +DBUS_PRIVATE_EXPORT void _dbus_user_info_free_allocated (DBusUserInfo *info); +DBUS_PRIVATE_EXPORT void _dbus_group_info_free_allocated (DBusGroupInfo *info); #endif /* DBUS_USERDB_INCLUDES_PRIVATE */ +DBUS_PRIVATE_EXPORT DBusUserDatabase* _dbus_user_database_get_system (void); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_user_database_lock_system (void) _DBUS_GNUC_WARN_UNUSED_RESULT; +DBUS_PRIVATE_EXPORT void _dbus_user_database_unlock_system (void); void _dbus_user_database_flush_system (void); @@ -94,6 +103,7 @@ dbus_bool_t _dbus_get_user_id (const DBusString *username, dbus_uid_t *uid); dbus_bool_t _dbus_get_group_id (const DBusString *group_name, dbus_gid_t *gid); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_get_user_id_and_primary_group (const DBusString *username, dbus_uid_t *uid_p, dbus_gid_t *gid_p); @@ -102,13 +112,17 @@ dbus_bool_t _dbus_credentials_from_uid (dbus_uid_t user_id, dbus_bool_t _dbus_groups_from_uid (dbus_uid_t uid, dbus_gid_t **group_ids, int *n_group_ids); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_is_console_user (dbus_uid_t uid, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_is_a_number (const DBusString *str, unsigned long *num); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_username_from_current_process (const DBusString **username); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_homedir_from_current_process (const DBusString **homedir); dbus_bool_t _dbus_homedir_from_username (const DBusString *username, DBusString *homedir); diff --git a/dbus/dbus-uuidgen.h b/dbus/dbus-uuidgen.h index 9c1b859..9d12f2b 100644 --- a/dbus/dbus-uuidgen.h +++ b/dbus/dbus-uuidgen.h @@ -32,6 +32,7 @@ DBUS_BEGIN_DECLS +DBUS_PRIVATE_EXPORT dbus_bool_t dbus_internal_do_not_use_get_uuid (const char *filename, char **uuid_p, dbus_bool_t create_if_not_found, @@ -39,6 +40,7 @@ dbus_bool_t dbus_internal_do_not_use_get_uuid (const char *filename, dbus_bool_t dbus_internal_do_not_use_ensure_uuid (const char *filename, char **uuid_p, DBusError *error); +DBUS_PRIVATE_EXPORT dbus_bool_t dbus_internal_do_not_use_create_uuid (char **uuid_p); diff --git a/dbus/dbus-watch.h b/dbus/dbus-watch.h index 321740e..d80c83a 100644 --- a/dbus/dbus-watch.h +++ b/dbus/dbus-watch.h @@ -44,14 +44,18 @@ typedef dbus_bool_t (* DBusWatchHandler) (DBusWatch *watch, unsigned int flags, void *data); +DBUS_PRIVATE_EXPORT DBusWatch* _dbus_watch_new (int fd, unsigned int flags, dbus_bool_t enabled, DBusWatchHandler handler, void *data, DBusFreeFunction free_data_function); +DBUS_PRIVATE_EXPORT DBusWatch* _dbus_watch_ref (DBusWatch *watch); +DBUS_PRIVATE_EXPORT void _dbus_watch_unref (DBusWatch *watch); +DBUS_PRIVATE_EXPORT void _dbus_watch_invalidate (DBusWatch *watch); void _dbus_watch_sanitize_condition (DBusWatch *watch, unsigned int *condition); @@ -61,16 +65,21 @@ void _dbus_watch_set_handler (DBusWatch *watch, DBusFreeFunction free_data_function); +DBUS_PRIVATE_EXPORT DBusWatchList* _dbus_watch_list_new (void); +DBUS_PRIVATE_EXPORT void _dbus_watch_list_free (DBusWatchList *watch_list); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_watch_list_set_functions (DBusWatchList *watch_list, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_watch_list_add_watch (DBusWatchList *watch_list, DBusWatch *watch); +DBUS_PRIVATE_EXPORT void _dbus_watch_list_remove_watch (DBusWatchList *watch_list, DBusWatch *watch); void _dbus_watch_list_toggle_watch (DBusWatchList *watch_list, @@ -80,7 +89,9 @@ void _dbus_watch_list_toggle_all_watches (DBusWatchList *watch_li dbus_bool_t enabled); dbus_bool_t _dbus_watch_get_enabled (DBusWatch *watch); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_watch_get_oom_last_time (DBusWatch *watch); +DBUS_PRIVATE_EXPORT void _dbus_watch_set_oom_last_time (DBusWatch *watch, dbus_bool_t oom); -- 2.1.4