Skip to content

Commit

Permalink
Move IDEVICE_ACTIVATION_API to public header
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Dec 2, 2024
1 parent 5235448 commit 82c858e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 72 deletions.
10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ esac
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)

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+=" -DIDEVICE_ACTIVATION_STATIC"
fi

AC_SUBST(GLOBAL_CFLAGS)

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

Expand Down
70 changes: 40 additions & 30 deletions include/libideviceactivation.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ extern "C" {
#include <libimobiledevice/lockdown.h>
#include <plist/plist.h>

#ifndef IDEVICE_ACTIVATION_API
#ifdef IDEVICE_ACTIVATION_STATIC
#define IDEVICE_ACTIVATION_API
#elif defined(_WIN32)
#define IDEVICE_ACTIVATION_API __declspec(dllimport)
#else
#define IDEVICE_ACTIVATION_API
#endif
#endif

typedef enum {
IDEVICE_ACTIVATION_E_SUCCESS = 0,
IDEVICE_ACTIVATION_E_INCOMPLETE_INFO = -1,
Expand All @@ -55,44 +65,44 @@ typedef idevice_activation_response* idevice_activation_response_t;

/* Interface */

void idevice_activation_set_debug_level(int level);
IDEVICE_ACTIVATION_API void idevice_activation_set_debug_level(int level);

idevice_activation_error_t idevice_activation_request_new(idevice_activation_client_type_t activation_type, idevice_activation_request_t* request);
idevice_activation_error_t idevice_activation_request_new_from_lockdownd(idevice_activation_client_type_t activation_type, lockdownd_client_t lockdown, idevice_activation_request_t* request);
idevice_activation_error_t idevice_activation_drm_handshake_request_new(idevice_activation_client_type_t client_type, idevice_activation_request_t* request);
void idevice_activation_request_free(idevice_activation_request_t request);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new(idevice_activation_client_type_t activation_type, idevice_activation_request_t* request);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new_from_lockdownd(idevice_activation_client_type_t activation_type, lockdownd_client_t lockdown, idevice_activation_request_t* request);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_drm_handshake_request_new(idevice_activation_client_type_t client_type, idevice_activation_request_t* request);
IDEVICE_ACTIVATION_API void idevice_activation_request_free(idevice_activation_request_t request);

void idevice_activation_request_get_fields(idevice_activation_request_t request, plist_t* fields);
void idevice_activation_request_set_fields(idevice_activation_request_t request, plist_t fields);
void idevice_activation_request_set_fields_from_response(idevice_activation_request_t request, const idevice_activation_response_t response);
void idevice_activation_request_set_field(idevice_activation_request_t request, const char* key, const char* value);
void idevice_activation_request_get_field(idevice_activation_request_t request, const char* key, char** value);
IDEVICE_ACTIVATION_API void idevice_activation_request_get_fields(idevice_activation_request_t request, plist_t* fields);
IDEVICE_ACTIVATION_API void idevice_activation_request_set_fields(idevice_activation_request_t request, plist_t fields);
IDEVICE_ACTIVATION_API void idevice_activation_request_set_fields_from_response(idevice_activation_request_t request, const idevice_activation_response_t response);
IDEVICE_ACTIVATION_API void idevice_activation_request_set_field(idevice_activation_request_t request, const char* key, const char* value);
IDEVICE_ACTIVATION_API void idevice_activation_request_get_field(idevice_activation_request_t request, const char* key, char** value);

void idevice_activation_request_get_url(idevice_activation_request_t request, const char** url);
void idevice_activation_request_set_url(idevice_activation_request_t request, const char* url);
IDEVICE_ACTIVATION_API void idevice_activation_request_get_url(idevice_activation_request_t request, const char** url);
IDEVICE_ACTIVATION_API void idevice_activation_request_set_url(idevice_activation_request_t request, const char* url);

idevice_activation_error_t idevice_activation_response_new(idevice_activation_response_t* response);
idevice_activation_error_t idevice_activation_response_new_from_html(const char* content, idevice_activation_response_t* response);
idevice_activation_error_t idevice_activation_response_to_buffer(idevice_activation_response_t response, char** buffer, size_t* size);
void idevice_activation_response_free(idevice_activation_response_t response);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_response_new(idevice_activation_response_t* response);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_response_new_from_html(const char* content, idevice_activation_response_t* response);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_response_to_buffer(idevice_activation_response_t response, char** buffer, size_t* size);
IDEVICE_ACTIVATION_API void idevice_activation_response_free(idevice_activation_response_t response);

void idevice_activation_response_get_field(idevice_activation_response_t response, const char* key, char** value);
void idevice_activation_response_get_fields(idevice_activation_response_t response, plist_t* fields);
void idevice_activation_response_get_label(idevice_activation_response_t response, const char* key, char** value);
void idevice_activation_response_get_placeholder(idevice_activation_response_t response, const char* key, char **value);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_field(idevice_activation_response_t response, const char* key, char** value);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_fields(idevice_activation_response_t response, plist_t* fields);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_label(idevice_activation_response_t response, const char* key, char** value);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_placeholder(idevice_activation_response_t response, const char* key, char **value);

void idevice_activation_response_get_title(idevice_activation_response_t response, const char** title);
void idevice_activation_response_get_description(idevice_activation_response_t response, const char** description);
void idevice_activation_response_get_activation_record(idevice_activation_response_t response, plist_t* activation_record);
void idevice_activation_response_get_headers(idevice_activation_response_t response, plist_t* headers);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_title(idevice_activation_response_t response, const char** title);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_description(idevice_activation_response_t response, const char** description);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_activation_record(idevice_activation_response_t response, plist_t* activation_record);
IDEVICE_ACTIVATION_API void idevice_activation_response_get_headers(idevice_activation_response_t response, plist_t* headers);

int idevice_activation_response_is_activation_acknowledged(idevice_activation_response_t response);
int idevice_activation_response_is_authentication_required(idevice_activation_response_t response);
int idevice_activation_response_field_requires_input(idevice_activation_response_t response, const char* key);
int idevice_activation_response_field_secure_input(idevice_activation_response_t response, const char* key);
int idevice_activation_response_has_errors(idevice_activation_response_t response);
IDEVICE_ACTIVATION_API int idevice_activation_response_is_activation_acknowledged(idevice_activation_response_t response);
IDEVICE_ACTIVATION_API int idevice_activation_response_is_authentication_required(idevice_activation_response_t response);
IDEVICE_ACTIVATION_API int idevice_activation_response_field_requires_input(idevice_activation_response_t response, const char* key);
IDEVICE_ACTIVATION_API int idevice_activation_response_field_secure_input(idevice_activation_response_t response, const char* key);
IDEVICE_ACTIVATION_API int idevice_activation_response_has_errors(idevice_activation_response_t response);

idevice_activation_error_t idevice_activation_send_request(idevice_activation_request_t request, idevice_activation_response_t* response);
IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_send_request(idevice_activation_request_t request, idevice_activation_response_t* response);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 82c858e

Please sign in to comment.