Skip to content

Commit

Permalink
Move LIBIMOBILEDEVICE_API to public headers
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Jan 31, 2024
1 parent f723a44 commit 63bbac5
Show file tree
Hide file tree
Showing 85 changed files with 680 additions and 642 deletions.
2 changes: 1 addition & 1 deletion common/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include <stdlib.h>
#include <time.h>

#include "src/idevice.h"
#include "debug.h"
#include "libimobiledevice/libimobiledevice.h"
#include "src/idevice.h"

#ifndef STRIP_DEBUG_CODE
#include "asprintf.h"
Expand Down
10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ else
fi

AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fsigned-char -fvisibility=hidden")
AC_SUBST(GLOBAL_CFLAGS)

case "$GLOBAL_CFLAGS" in
*-fvisibility=hidden*)
AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden])
esac
if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then
GLOBAL_CFLAGS+=" -DLIBIMOBILEDEVICE_STATIC"
fi

AC_SUBST(GLOBAL_CFLAGS)

# check for large file support
AC_SYS_LARGEFILE
Expand Down
8 changes: 4 additions & 4 deletions doxygen.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*

EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = LIBIMOBILEDEVICE_API

# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
Expand Down Expand Up @@ -2023,15 +2023,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2072,7 +2072,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = LIBIMOBILEDEVICE_API

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
46 changes: 23 additions & 23 deletions include/libimobiledevice/afc.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef afc_client_private *afc_client_t; /**< The client handle. */
* invalid, AFC_E_MUX_ERROR if the connection cannot be established,
* or AFC_E_NO_MEM if there is a memory allocation problem.
*/
afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t *client);
LIBIMOBILEDEVICE_API afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t *client);

/**
* Starts a new AFC service on the specified device and connects to it.
Expand All @@ -120,15 +120,15 @@ afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t serv
*
* @return AFC_E_SUCCESS on success, or an AFC_E_* error code otherwise.
*/
afc_error_t afc_client_start_service(idevice_t device, afc_client_t* client, const char* label);
LIBIMOBILEDEVICE_API afc_error_t afc_client_start_service(idevice_t device, afc_client_t* client, const char* label);

/**
* Frees up an AFC client. If the connection was created by the client itself,
* the connection will be closed.
*
* @param client The client to free.
*/
afc_error_t afc_client_free(afc_client_t client);
LIBIMOBILEDEVICE_API afc_error_t afc_client_free(afc_client_t client);

/**
* Get device information for a connected client. The device information
Expand All @@ -142,7 +142,7 @@ afc_error_t afc_client_free(afc_client_t client);
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_get_device_info(afc_client_t client, char ***device_information);
LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info(afc_client_t client, char ***device_information);

/**
* Gets a directory listing of the directory requested.
Expand All @@ -155,7 +155,7 @@ afc_error_t afc_get_device_info(afc_client_t client, char ***device_information)
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information);
LIBIMOBILEDEVICE_API afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information);

/**
* Gets information about a specific file.
Expand All @@ -168,7 +168,7 @@ afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***di
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information);
LIBIMOBILEDEVICE_API afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information);

/**
* Opens a file on the device.
Expand All @@ -180,15 +180,15 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***fil
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle);
LIBIMOBILEDEVICE_API afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle);

/**
* Closes a file on the device.
*
* @param client The client to close the file with.
* @param handle File handle of a previously opened file.
*/
afc_error_t afc_file_close(afc_client_t client, uint64_t handle);
LIBIMOBILEDEVICE_API afc_error_t afc_file_close(afc_client_t client, uint64_t handle);

/**
* Locks or unlocks a file on the device.
Expand All @@ -202,7 +202,7 @@ afc_error_t afc_file_close(afc_client_t client, uint64_t handle);
* AFC_LOCK_SH (shared lock), AFC_LOCK_EX (exclusive lock), or
* AFC_LOCK_UN (unlock).
*/
afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation);
LIBIMOBILEDEVICE_API afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation);

/**
* Attempts to the read the given number of bytes from the given file.
Expand All @@ -215,7 +215,7 @@ afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t op
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read);
LIBIMOBILEDEVICE_API afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read);

/**
* Writes a given number of bytes to a file.
Expand All @@ -228,7 +228,7 @@ afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written);
LIBIMOBILEDEVICE_API afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written);

/**
* Seeks to a given position of a pre-opened file on the device.
Expand All @@ -240,7 +240,7 @@ afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *dat
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence);
LIBIMOBILEDEVICE_API afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence);

/**
* Returns current position in a pre-opened file on the device.
Expand All @@ -251,7 +251,7 @@ afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset,
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position);
LIBIMOBILEDEVICE_API afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position);

/**
* Sets the size of a file on the device.
Expand All @@ -265,7 +265,7 @@ afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *positi
* @note This function is more akin to ftruncate than truncate, and truncate
* calls would have to open the file before calling this, sadly.
*/
afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize);
LIBIMOBILEDEVICE_API afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize);

/**
* Deletes a file or directory.
Expand All @@ -275,7 +275,7 @@ afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t new
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_remove_path(afc_client_t client, const char *path);
LIBIMOBILEDEVICE_API afc_error_t afc_remove_path(afc_client_t client, const char *path);

/**
* Renames a file or directory on the device.
Expand All @@ -286,7 +286,7 @@ afc_error_t afc_remove_path(afc_client_t client, const char *path);
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to);
LIBIMOBILEDEVICE_API afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to);

/**
* Creates a directory on the device.
Expand All @@ -297,7 +297,7 @@ afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *t
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_make_directory(afc_client_t client, const char *path);
LIBIMOBILEDEVICE_API afc_error_t afc_make_directory(afc_client_t client, const char *path);

/**
* Sets the size of a file on the device without prior opening it.
Expand All @@ -308,7 +308,7 @@ afc_error_t afc_make_directory(afc_client_t client, const char *path);
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize);
LIBIMOBILEDEVICE_API afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize);

/**
* Creates a hard link or symbolic link on the device.
Expand All @@ -320,7 +320,7 @@ afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);
LIBIMOBILEDEVICE_API afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);

/**
* Sets the modification time of a file on the device.
Expand All @@ -331,7 +331,7 @@ afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const c
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime);
LIBIMOBILEDEVICE_API afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime);

/**
* Deletes a file or directory including possible contents.
Expand All @@ -343,7 +343,7 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path);
LIBIMOBILEDEVICE_API afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path);

/* Helper functions */

Expand All @@ -358,7 +358,7 @@ afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path);
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value);
LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value);

/**
* Frees up a char dictionary as returned by some AFC functions.
Expand All @@ -367,7 +367,7 @@ afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char *
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value.
*/
afc_error_t afc_dictionary_free(char **dictionary);
LIBIMOBILEDEVICE_API afc_error_t afc_dictionary_free(char **dictionary);

#ifdef __cplusplus
}
Expand Down
12 changes: 6 additions & 6 deletions include/libimobiledevice/bt_packet_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ typedef void (*bt_packet_logger_receive_cb_t)(uint8_t * data, uint16_t len, void
* @return BT_PACKET_LOGGER_E_SUCCESS on success, BT_PACKET_LOGGER_E_INVALID_ARG when
* client is NULL, or an BT_PACKET_LOGGER_E_* error code otherwise.
*/
bt_packet_logger_error_t bt_packet_logger_client_new(idevice_t device, lockdownd_service_descriptor_t service, bt_packet_logger_client_t * client);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_client_new(idevice_t device, lockdownd_service_descriptor_t service, bt_packet_logger_client_t * client);

/**
* Starts a new bt_packet_logger service on the specified device and connects to it.
Expand All @@ -85,7 +85,7 @@ bt_packet_logger_error_t bt_packet_logger_client_new(idevice_t device, lockdownd
* @return BT_PACKET_LOGGER_E_SUCCESS on success, or an BT_PACKET_LOGGER_E_* error
* code otherwise.
*/
bt_packet_logger_error_t bt_packet_logger_client_start_service(idevice_t device, bt_packet_logger_client_t * client, const char* label);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_client_start_service(idevice_t device, bt_packet_logger_client_t * client, const char* label);

/**
* Disconnects a bt_packet_logger client from the device and frees up the
Expand All @@ -96,7 +96,7 @@ bt_packet_logger_error_t bt_packet_logger_client_start_service(idevice_t device,
* @return BT_PACKET_LOGGER_E_SUCCESS on success, BT_PACKET_LOGGER_E_INVALID_ARG when
* client is NULL, or an BT_PACKET_LOGGER_E_* error code otherwise.
*/
bt_packet_logger_error_t bt_packet_logger_client_free(bt_packet_logger_client_t client);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_client_free(bt_packet_logger_client_t client);


/**
Expand All @@ -113,7 +113,7 @@ bt_packet_logger_error_t bt_packet_logger_client_free(bt_packet_logger_client_t
* invalid or BT_PACKET_LOGGER_E_UNKNOWN_ERROR when an unspecified
* error occurs or an hci capture has already been started.
*/
bt_packet_logger_error_t bt_packet_logger_start_capture(bt_packet_logger_client_t client, bt_packet_logger_receive_cb_t callback, void* user_data);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_start_capture(bt_packet_logger_client_t client, bt_packet_logger_receive_cb_t callback, void* user_data);

/**
* Stops capturing the hci interface from the device.
Expand All @@ -127,7 +127,7 @@ bt_packet_logger_error_t bt_packet_logger_start_capture(bt_packet_logger_client_
* invalid or BT_PACKET_LOGGER_E_UNKNOWN_ERROR when an unspecified
* error occurs or an hci capture has already been started.
*/
bt_packet_logger_error_t bt_packet_logger_stop_capture(bt_packet_logger_client_t client);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_stop_capture(bt_packet_logger_client_t client);

/* Receiving */

Expand All @@ -146,7 +146,7 @@ bt_packet_logger_error_t bt_packet_logger_stop_capture(bt_packet_logger_client_t
* occurs, or BT_PACKET_LOGGER_E_UNKNOWN_ERROR when an unspecified
* error occurs.
*/
bt_packet_logger_error_t bt_packet_logger_receive_with_timeout(bt_packet_logger_client_t client, char *data, uint32_t size, uint32_t *received, unsigned int timeout);
LIBIMOBILEDEVICE_API bt_packet_logger_error_t bt_packet_logger_receive_with_timeout(bt_packet_logger_client_t client, char *data, uint32_t size, uint32_t *received, unsigned int timeout);


#ifdef __cplusplus
Expand Down

0 comments on commit 63bbac5

Please sign in to comment.