]> git.ipfire.org Git - pakfire.git/commitdiff
client: Create a new type for the client
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 10:26:45 +0000 (10:26 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 10:26:45 +0000 (10:26 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
18 files changed:
src/cli/lib/auth.c
src/cli/lib/client-build.c
src/cli/lib/pakfire.c
src/cli/lib/pakfire.h
src/cli/lib/repo_create.c
src/cli/lib/repo_delete.c
src/cli/lib/repo_list.c
src/cli/lib/repo_show.c
src/cli/lib/upload_create.c
src/cli/lib/upload_delete.c
src/cli/lib/upload_list.c
src/pakfire/builder.c
src/pakfire/builder.h
src/pakfire/client.c
src/pakfire/client.h
src/pakfire/daemon.c
src/pakfire/job.c
src/pakfire/job.h

index 714d149097b2d3e95be661064c49c538660cf11b..8b75ff928971d945cf552708d2a2a9bb78edff37 100644 (file)
@@ -51,7 +51,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        int* r = data;
 
        // If we get here, we set the status to zero
@@ -63,7 +63,7 @@ static int ready_callback(struct pakfire_client* client, void* data) {
 int cli_auth(void* data, int argc, char* argv[]) {
        struct cli_global_args* global_args = data;
        struct cli_local_args local_args = {};
-       struct pakfire_client* client = NULL;
+       pakfire_client* client = NULL;
        int status = 1;
        int r;
 
index a29390a1c818422e33e254420266478748154a3a..2a1495e5a2959e4e77ac325891cceb876755b508 100644 (file)
@@ -121,7 +121,7 @@ static int build_callback(struct pakfire_xfer* xfer,
 }
 
 // Called when an upload was successful
-static int upload_callback(struct pakfire_client* client,
+static int upload_callback(pakfire_client* client,
                pakfire_client_upload_status status, const char* path, const char* uuid, void* data) {
        struct cli_local_args* local_args = data;
        int r;
@@ -140,7 +140,7 @@ static int upload_callback(struct pakfire_client* client,
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        struct cli_local_args* local_args = data;
        int r;
 
@@ -148,7 +148,7 @@ static int ready_callback(struct pakfire_client* client, void* data) {
 
        // Upload all packages
        for (unsigned int i = 0; i < local_args->num_packages; i++) {
-               r = pakfire_client_upload(client, local_args->packages[i], NULL,
+               r = pakfire_client_upload_create(client, local_args->packages[i], NULL,
                                upload_callback, local_args);
                if (r < 0) {
                        fprintf(stderr, "Failed to create upload %s: %s\n",
index 7cbb6d814c238ac0959e161e01da5add3524c6b2..eedcdfa101a337bbdd060976fc44f2106990ffc2 100644 (file)
@@ -145,14 +145,14 @@ struct auth_credentials {
        char password[NAME_MAX];
 };
 
-static int auth_callback(struct pakfire_client* client, void* data) {
+static int auth_callback(pakfire_client* client, void* data) {
        const struct auth_credentials* creds = data;
 
        // Authenticate!
        return pakfire_client_auth_user(client, creds->password);
 }
 
-int cli_setup_client(struct pakfire_client** client, struct cli_global_args* args) {
+int cli_setup_client(pakfire_client** client, struct cli_global_args* args) {
        static struct auth_credentials creds = {};
        struct pakfire_config* config = NULL;
        const char* username = NULL;
@@ -207,7 +207,7 @@ ERROR:
 }
 
 int cli_run_client(struct cli_global_args* args, pakfire_client_ready_callback callback, void* data) {
-       struct pakfire_client* client = NULL;
+       pakfire_client* client = NULL;
        int r;
 
        // Create a new client
index 8a2230fc497eabc0adda868c224f3e2989d3f51f..3f194054cdb2e0e055498974b6012f18593ec671 100644 (file)
@@ -49,7 +49,7 @@ struct cli_global_args {
 int cli_setup_config(struct pakfire_config** config, struct cli_global_args* args);
 int cli_setup_pakfire(struct pakfire** pakfire, struct cli_global_args* args);
 int cli_setup_build(struct pakfire_build** build, struct cli_global_args* args, int flags);
-int cli_setup_client(struct pakfire_client** client, struct cli_global_args* args);
+int cli_setup_client(pakfire_client** client, struct cli_global_args* args);
 int cli_run_client(struct cli_global_args* args, pakfire_client_ready_callback callback, void* data);
 
 #endif /* PAKFIRE_CLI_PAKFIRE_H */
index 55847f92efd1cc6e0a1c03ab2699e781a4d70421..e1692cab760f431091f7bd3c1036cae26f36c4e0 100644 (file)
@@ -73,7 +73,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        const struct cli_local_args* local_args = data;
 
        // Create the repository
index 4dd35070892ff574a5bf70bfc5edabae202e1996..903c685328773468b7433efe348567ee588af71c 100644 (file)
@@ -68,7 +68,7 @@ static int response_callback(struct pakfire_xfer* xfer,
        return response->error;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        struct cli_local_args* local_args = data;
 
        // Delete the repository
index a155c5a1b9dd28c90389cd30f86be2bac9717f91..ff3af4c1f0fd7580c343de193e891283eefc65b5 100644 (file)
@@ -52,7 +52,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        const struct cli_local_args* local_args = data;
 
        // XXX Needs a callback
index 7ee79353d7b0f425d537c8bf1141c05d5edb6d48..eac616f14307b9d62a9c059351f07fc6524b7332 100644 (file)
@@ -58,7 +58,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        const struct cli_local_args* local_args = data;
 
        // XXX Needs a callback
index 42f2f1965df10287b1ccf842c13da0e5cf8d646d..3a72d2590a7c56117ffbae8a928ce8c22e4ab354 100644 (file)
@@ -55,7 +55,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int upload_callback(struct pakfire_client* client,
+static int upload_callback(pakfire_client* client,
                pakfire_client_upload_status status, const char* path, const char* uuid, void* data) {
        switch (status) {
                case PAKFIRE_CLIENT_UPLOAD_SUCCESSFUL:
@@ -69,13 +69,13 @@ static int upload_callback(struct pakfire_client* client,
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        const struct cli_local_args* local_args = data;
        int r;
 
        // Create all uploads
        for (unsigned int i = 0; i < local_args->num_files; i++) {
-               r = pakfire_client_upload(client, local_args->files[i], NULL, upload_callback, NULL);
+               r = pakfire_client_upload_create(client, local_args->files[i], NULL, upload_callback, NULL);
                if (r < 0)
                        return r;
        }
index 79e65aeedf11eb61f63cd9e597087f933afc29ad..627bc645f2b40d05a76aa1dacdcdd0529e7bd32c 100644 (file)
@@ -60,7 +60,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        const struct cli_local_args* local_args = data;
        int r;
 
index b3bbdc821adb127591f958b93a5c94fb96560db6..cc40788d3624167e5d75868e18c90d5e090fd25c 100644 (file)
@@ -35,7 +35,7 @@ static int list_callback(struct pakfire_xfer* xfer,
        return cli_dump_json(response->data);
 }
 
-static int ready_callback(struct pakfire_client* client, void* data) {
+static int ready_callback(pakfire_client* client, void* data) {
        return pakfire_client_list_uploads(client, list_callback, data);
 }
 
index 4fd3eddc66a9cf30f67f3335248786bd3849ec3e..67ca28c1cd735b2430ac0f543243cc03c2e2e390 100644 (file)
@@ -48,7 +48,7 @@ struct pakfire_builder {
        sd_event* loop;
 
        // Client
-       struct pakfire_client* client;
+       pakfire_client* client;
 
        // Control Connection
        struct pakfire_xfer* control;
@@ -82,7 +82,7 @@ static void pakfire_builder_free(struct pakfire_builder* self) {
 }
 
 int pakfire_builder_create(struct pakfire_builder** builder,
-               pakfire_ctx* ctx, struct pakfire_client* client) {
+               pakfire_ctx* ctx, pakfire_client* client) {
        struct pakfire_builder* self = NULL;
        int r;
 
index 05e86ea9f61e62bf600f68cb9d08a228bf92e2b3..adfc6a0f9d485241c7785835f7356e5dbb06dbf2 100644 (file)
@@ -32,7 +32,7 @@ struct pakfire_builder;
 #include <pakfire/xfer.h>
 
 int pakfire_builder_create(struct pakfire_builder** builder,
-       pakfire_ctx* ctx, struct pakfire_client* client);
+       pakfire_ctx* ctx, pakfire_client* client);
 
 struct pakfire_builder* pakfire_builder_ref(struct pakfire_builder* self);
 struct pakfire_builder* pakfire_builder_unref(struct pakfire_builder* self);
index ddc53877b6af0bec4ef2556bd1c753b0685ddc55..2c3caed293bce8cf017b034cd1fd0f938b3c0f64 100644 (file)
 #include <pakfire/util.h>
 #include <pakfire/xfer.h>
 
-struct pakfire_client_upload {
+typedef struct pakfire_client_upload {
        STAILQ_ENTRY(pakfire_client_upload) nodes;
 
        // Client
-       struct pakfire_client* client;
+       pakfire_client* client;
 
        // UUID
        char uuid[UUID_STR_LEN];
@@ -69,7 +69,7 @@ struct pakfire_client_upload {
        // Callback
        pakfire_client_upload_callback callback;
        void* data;
-};
+} pakfire_client_upload;
 
 struct pakfire_client {
        pakfire_ctx* ctx;
@@ -114,10 +114,10 @@ struct pakfire_client {
 };
 
 static int pakfire_client_xfer_create(struct pakfire_xfer** xfer,
-       struct pakfire_client* self, const char* url, ...) __attribute__((format(printf, 3, 4)));
+       pakfire_client* self, const char* url, ...) __attribute__((format(printf, 3, 4)));
 
 static int pakfire_client_xfer_create(struct pakfire_xfer** xfer,
-               struct pakfire_client* self, const char* url, ...) {
+               pakfire_client* self, const char* url, ...) {
        struct pakfire_xfer* x = NULL;
        va_list args;
        int r;
@@ -150,7 +150,7 @@ ERROR:
 }
 
 // Called when the client has been initialized for the first time
-static int pakfire_client_ready(struct pakfire_client* self) {
+static int pakfire_client_ready(pakfire_client* self) {
        int r;
 
        // Call the callback only once
@@ -169,12 +169,12 @@ static int pakfire_client_ready(struct pakfire_client* self) {
 static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
        const pakfire_xfer_response* response, void* data);
 
-static int pakfire_client_auth_required(struct pakfire_client* self);
+static int pakfire_client_auth_required(pakfire_client* self);
 
 /*
        Triggers a refresh of the access and refresh tokens
 */
-static int pakfire_client_auth_refresh(struct pakfire_client* self) {
+static int pakfire_client_auth_refresh(pakfire_client* self) {
        struct pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
        int r;
@@ -234,13 +234,13 @@ ERROR:
 }
 
 static int pakfire_client_refresh_timer(sd_event_source* event, uint64_t usec, void* data) {
-       struct pakfire_client* self = data;
+       pakfire_client* self = data;
 
        // Refresh the authentication tokens
        return pakfire_client_auth_refresh(self);
 }
 
-static int pakfire_client_set_access_token(struct pakfire_client* self, const char* token) {
+static int pakfire_client_set_access_token(pakfire_client* self, const char* token) {
        time_t expires_at = -1;
        int r;
 
@@ -277,7 +277,7 @@ static int pakfire_client_set_access_token(struct pakfire_client* self, const ch
        return 0;
 }
 
-static int pakfire_client_set_refresh_token(struct pakfire_client* self, const char* token) {
+static int pakfire_client_set_refresh_token(pakfire_client* self, const char* token) {
        time_t expires_at = -1;
        int r;
 
@@ -314,7 +314,7 @@ static int pakfire_client_set_refresh_token(struct pakfire_client* self, const c
        return 0;
 }
 
-static int pakfire_client_store_read(struct pakfire_client* self) {
+static int pakfire_client_store_read(pakfire_client* self) {
        struct json_object* store = NULL;
        const char* refresh_token = NULL;
        const char* access_token = NULL;
@@ -385,7 +385,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_client_store_write(struct pakfire_client* self) {
+static int pakfire_client_store_write(pakfire_client* self) {
        struct json_object* store = NULL;
        char path[PATH_MAX];
        int r;
@@ -427,7 +427,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_client_xfer_auth(struct pakfire_client* self, struct pakfire_xfer* xfer) {
+static int pakfire_client_xfer_auth(pakfire_client* self, struct pakfire_xfer* xfer) {
        int r;
 
        // Fail if not authenticated
@@ -448,7 +448,7 @@ static int pakfire_client_xfer_auth(struct pakfire_client* self, struct pakfire_
        This function is being called when the client needs authentication and
        does not have any credentials whatsoever.
 */
-static int pakfire_client_auth_required(struct pakfire_client* self) {
+static int pakfire_client_auth_required(pakfire_client* self) {
        // Call the authentication callback
        if (self->auth.callback)
                return self->auth.callback(self, self->auth.data);
@@ -459,7 +459,7 @@ static int pakfire_client_auth_required(struct pakfire_client* self) {
 }
 
 static int pakfire_client_init(sd_event_source* event, void* data) {
-       struct pakfire_client* self = data;
+       pakfire_client* self = data;
 
        DEBUG(self->ctx, "Initializing client...\n");
 
@@ -467,10 +467,10 @@ static int pakfire_client_init(sd_event_source* event, void* data) {
        return pakfire_client_store_read(self);
 }
 
-static void pakfire_client_upload_free(struct pakfire_client_upload* upload);
+static void pakfire_client_upload_free(pakfire_client_upload* upload);
 
-static void pakfire_client_free(struct pakfire_client* self) {
-       struct pakfire_client_upload* upload = NULL;
+static void pakfire_client_free(pakfire_client* self) {
+       pakfire_client_upload* upload = NULL;
 
        // Store any credentials
        pakfire_client_store_write(self);
@@ -500,9 +500,9 @@ static void pakfire_client_free(struct pakfire_client* self) {
        free(self);
 }
 
-int pakfire_client_create(struct pakfire_client** client,
+int pakfire_client_create(pakfire_client** client,
                pakfire_ctx* ctx, const char* url, const char* principal) {
-       struct pakfire_client* self = NULL;
+       pakfire_client* self = NULL;
        char hostname[HOST_NAME_MAX];
        int r;
 
@@ -571,13 +571,13 @@ ERROR:
        return r;
 }
 
-struct pakfire_client* pakfire_client_ref(struct pakfire_client* self) {
+pakfire_client* pakfire_client_ref(pakfire_client* self) {
        ++self->nrefs;
 
        return self;
 }
 
-struct pakfire_client* pakfire_client_unref(struct pakfire_client* self) {
+pakfire_client* pakfire_client_unref(pakfire_client* self) {
        if (--self->nrefs > 0)
                return self;
 
@@ -585,25 +585,25 @@ struct pakfire_client* pakfire_client_unref(struct pakfire_client* self) {
        return NULL;
 }
 
-const char* pakfire_client_get_url(struct pakfire_client* self) {
+const char* pakfire_client_get_url(pakfire_client* self) {
        return self->url;
 }
 
 // Run
 
-void pakfire_client_set_ready_callback(struct pakfire_client* self,
+void pakfire_client_set_ready_callback(pakfire_client* self,
                pakfire_client_ready_callback callback, void* data) {
        self->ready.callback = callback;
        self->ready.data     = data;
 }
 
-int pakfire_client_run(struct pakfire_client* self) {
+int pakfire_client_run(pakfire_client* self) {
        return pakfire_httpclient_run(self->httpclient, NULL);
 }
 
 // Authenticate
 
-int pakfire_client_set_auth_callback(struct pakfire_client* self,
+int pakfire_client_set_auth_callback(pakfire_client* self,
                pakfire_client_auth_callback callback, void* data) {
        self->auth.callback = callback;
        self->auth.data     = data;
@@ -613,7 +613,7 @@ int pakfire_client_set_auth_callback(struct pakfire_client* self,
 
 static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
-       struct pakfire_client* self = data;
+       pakfire_client* self = data;
        const char* refresh_token = NULL;
        const char* access_token = NULL;
        int r;
@@ -655,7 +655,7 @@ static int pakfire_client_auth_response(struct pakfire_xfer* xfer,
        return pakfire_client_ready(self);
 }
 
-int pakfire_client_auth_user(struct pakfire_client* self, const char* password) {
+int pakfire_client_auth_user(pakfire_client* self, const char* password) {
        struct pakfire_xfer* xfer = NULL;
        struct {
                char* username;
@@ -711,7 +711,7 @@ ERROR:
 }
 
 #if 0
-int pakfire_client_auth_builder(struct pakfire_client* self,
+int pakfire_client_auth_builder(pakfire_client* self,
                const char* username, const char* password) {
        struct pakfire_xfer* xfer = NULL;
        char hostname[HOST_NAME_MAX];
@@ -782,7 +782,7 @@ ERROR:
 
 // Builder
 
-int pakfire_client_builder(struct pakfire_builder** builder, struct pakfire_client* self) {
+int pakfire_client_builder(struct pakfire_builder** builder, pakfire_client* self) {
        struct pakfire_builder* b = NULL;
        int r;
 
@@ -802,7 +802,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_builder_connect(struct pakfire_client* self, struct pakfire_builder* builder) {
+int pakfire_client_builder_connect(pakfire_client* self, struct pakfire_builder* builder) {
        struct pakfire_xfer* xfer = NULL;
        int r;
 
@@ -838,7 +838,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_builder_disconnected(struct pakfire_client* self, struct pakfire_xfer* xfer) {
+int pakfire_client_builder_disconnected(pakfire_client* self, struct pakfire_xfer* xfer) {
        int r;
 
        // Remove the connection from the client
@@ -851,7 +851,7 @@ int pakfire_client_builder_disconnected(struct pakfire_client* self, struct pakf
 
 // Build
 
-int pakfire_client_build(struct pakfire_client* self, const char* upload, const char* repo,
+int pakfire_client_build(pakfire_client* self, const char* upload, const char* repo,
                const char** arches, int flags, pakfire_xfer_response_callback callback, void* data) {
        struct pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
@@ -921,8 +921,8 @@ ERROR:
 
 // Uploads
 
-static void pakfire_client_upload_free(struct pakfire_client_upload* upload) {
-       struct pakfire_client* client = upload->client;
+static void pakfire_client_upload_free(pakfire_client_upload* upload) {
+       pakfire_client* client = upload->client;
 
        // Remove the upload from the queue (if present)
        if (client)
@@ -935,10 +935,10 @@ static void pakfire_client_upload_free(struct pakfire_client_upload* upload) {
        free(upload);
 }
 
-static int pakfire_client_upload_create(struct pakfire_client_upload** upload,
-               struct pakfire_client* client, const char* path, const char* filename,
+static int __pakfire_client_upload_create(pakfire_client_upload** upload,
+               pakfire_client* client, const char* path, const char* filename,
                pakfire_client_upload_callback callback, void* data) {
-       struct pakfire_client_upload* self = NULL;
+       pakfire_client_upload* self = NULL;
        char basename[NAME_MAX];
        int r;
 
@@ -1019,7 +1019,7 @@ ERROR:
 static int pakfire_upload_payload_callback(struct pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
        pakfire_client_upload_status s = PAKFIRE_CLIENT_UPLOAD_SUCCESSFUL;
-       struct pakfire_client_upload* upload = data;
+       pakfire_client_upload* upload = data;
        int r = 0;
 
        // Determine the status
@@ -1042,8 +1042,8 @@ static int pakfire_upload_payload_callback(struct pakfire_xfer* xfer,
        return r;
 }
 
-static int pakfire_client_upload_payload(struct pakfire_client_upload* upload) {
-       struct pakfire_client* self = upload->client;
+static int pakfire_client_upload_payload(pakfire_client_upload* upload) {
+       pakfire_client* self = upload->client;
        struct pakfire_xfer* xfer = NULL;
        int r;
 
@@ -1086,7 +1086,7 @@ ERROR:
 
 static int pakfire_client_upload_response(struct pakfire_xfer* xfer,
                const pakfire_xfer_response* response, void* data) {
-       struct pakfire_client_upload* self = data;
+       pakfire_client_upload* self = data;
        const char* uuid = NULL;
        int r;
 
@@ -1108,16 +1108,16 @@ static int pakfire_client_upload_response(struct pakfire_xfer* xfer,
        return -EINVAL;
 }
 
-int pakfire_client_upload(struct pakfire_client* self,
+int pakfire_client_upload_create(pakfire_client* self,
                const char* path, const char* filename, pakfire_client_upload_callback callback, void* data) {
-       struct pakfire_client_upload* upload = NULL;
+       pakfire_client_upload* upload = NULL;
        struct json_object* request = NULL;
        char* hexdigest_blake2b512 = NULL;
        struct pakfire_xfer* xfer = NULL;
        int r;
 
        // Create a new upload
-       r = pakfire_client_upload_create(&upload, self, path, filename, callback, data);
+       r = __pakfire_client_upload_create(&upload, self, path, filename, callback, data);
        if (r < 0) {
                ERROR(self->ctx, "Failed to create a new upload: %s\n", strerror(-r));
                goto ERROR;
@@ -1184,7 +1184,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_list_uploads(struct pakfire_client* self,
+int pakfire_client_list_uploads(pakfire_client* self,
                pakfire_client_list_uploads_callback callback, void* data) {
        struct pakfire_xfer* xfer = NULL;
        int r;
@@ -1216,7 +1216,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_delete_upload(struct pakfire_client* self, const char* uuid) {
+int pakfire_client_delete_upload(pakfire_client* self, const char* uuid) {
        struct pakfire_xfer* xfer = NULL;
        int r;
 
@@ -1249,7 +1249,7 @@ ERROR:
 
 // Repositories
 
-int pakfire_client_list_repos(struct pakfire_client* self, const char* distro) {
+int pakfire_client_list_repos(pakfire_client* self, const char* distro) {
        struct pakfire_xfer* xfer = NULL;
        int r;
 
@@ -1281,7 +1281,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_get_repo(struct pakfire_client* self,
+int pakfire_client_get_repo(pakfire_client* self,
                const char* distro, const char* name) {
        struct pakfire_xfer* xfer = NULL;
        int r;
@@ -1314,7 +1314,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_create_repo(struct pakfire_client* self,
+int pakfire_client_create_repo(pakfire_client* self,
                const char* distro, const char* name, const char* description) {
        struct pakfire_xfer* xfer = NULL;
        struct json_object* request = NULL;
@@ -1372,7 +1372,7 @@ ERROR:
        return r;
 }
 
-int pakfire_client_delete_repo(struct pakfire_client* self, const char* distro,
+int pakfire_client_delete_repo(pakfire_client* self, const char* distro,
                const char* name, pakfire_xfer_response_callback callback, void* data) {
        struct pakfire_xfer* xfer = NULL;
        int r;
@@ -1412,7 +1412,7 @@ ERROR:
 /*
        This is called when a job has finished.
 */
-int pakfire_client_job_finished(struct pakfire_client* self,
+int pakfire_client_job_finished(pakfire_client* self,
                const char* job_id, const char* logfile, char** packages) {
        struct json_object* request = NULL;
        struct pakfire_xfer* xfer = NULL;
index ec4d073c1bae6f5bb2619b1b9e9b976aa97a3318..aa8d03d7f6158076a64944cb706f857ea7f1c333 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef PAKFIRE_CLIENT_H
 #define PAKFIRE_CLIENT_H
 
-struct pakfire_client;
+typedef struct pakfire_client pakfire_client;
 
 #include <json.h>
 
@@ -30,22 +30,22 @@ struct pakfire_client;
 #include <pakfire/ctx.h>
 #include <pakfire/xfer.h>
 
-int pakfire_client_create(struct pakfire_client** client,
+int pakfire_client_create(pakfire_client** client,
        pakfire_ctx* ctx, const char* url, const char* principal);
 
-struct pakfire_client* pakfire_client_ref(struct pakfire_client* client);
-struct pakfire_client* pakfire_client_unref(struct pakfire_client* client);
+pakfire_client* pakfire_client_ref(pakfire_client* client);
+pakfire_client* pakfire_client_unref(pakfire_client* client);
 
-const char* pakfire_client_get_url(struct pakfire_client* client);
+const char* pakfire_client_get_url(pakfire_client* client);
 
 // Run!
 
-typedef int (*pakfire_client_ready_callback)(struct pakfire_client* client, void* data);
+typedef int (*pakfire_client_ready_callback)(pakfire_client* client, void* data);
 
-void pakfire_client_set_ready_callback(struct pakfire_client* self,
+void pakfire_client_set_ready_callback(pakfire_client* self,
        pakfire_client_ready_callback callback, void* data);
 
-int pakfire_client_run(struct pakfire_client* self);
+int pakfire_client_run(pakfire_client* self);
 
 // Authentication
 
@@ -55,20 +55,20 @@ typedef enum {
 } pakfire_client_auth_status;
 
 typedef int (*pakfire_client_auth_callback)
-       (struct pakfire_client* client, void* data);
+       (pakfire_client* client, void* data);
 
-int pakfire_client_set_auth_callback(struct pakfire_client* client,
+int pakfire_client_set_auth_callback(pakfire_client* client,
        pakfire_client_auth_callback callback, void* data);
 
-int pakfire_client_auth_user(struct pakfire_client* client, const char* password);
+int pakfire_client_auth_user(pakfire_client* client, const char* password);
 
 // Builder
 
-int pakfire_client_builder(struct pakfire_builder** builder, struct pakfire_client* self);
+int pakfire_client_builder(struct pakfire_builder** builder, pakfire_client* self);
 
 // Low-level functions
-int pakfire_client_builder_connect(struct pakfire_client* self, struct pakfire_builder* builder);
-int pakfire_client_builder_disconnected(struct pakfire_client* self, struct pakfire_xfer* xfer);
+int pakfire_client_builder_connect(pakfire_client* self, struct pakfire_builder* builder);
+int pakfire_client_builder_disconnected(pakfire_client* self, struct pakfire_xfer* xfer);
 
 // Builds
 
@@ -76,7 +76,7 @@ typedef enum pakfire_client_build_flags {
        PAKFIRE_CLIENT_DISABLE_TESTS = (1 << 0),
 } pakfire_client_build_flags_t;
 
-int pakfire_client_build(struct pakfire_client* client, const char* upload, const char* repo,
+int pakfire_client_build(pakfire_client* client, const char* upload, const char* repo,
        const char** arches, int flags, pakfire_xfer_response_callback callback, void* data);
 
 // Uploads
@@ -87,31 +87,31 @@ typedef enum {
 } pakfire_client_upload_status;
 
 typedef int (*pakfire_client_upload_callback)
-       (struct pakfire_client* client, pakfire_client_upload_status status,
+       (pakfire_client* client, pakfire_client_upload_status status,
        const char* path, const char* uuid, void* data);
 
-int pakfire_client_upload(struct pakfire_client* client,
+int pakfire_client_upload_create(pakfire_client* client,
        const char* path, const char* filename, pakfire_client_upload_callback callback, void* data);
 
 typedef pakfire_xfer_response_callback pakfire_client_list_uploads_callback;
 
-int pakfire_client_list_uploads(struct pakfire_client* client,
+int pakfire_client_list_uploads(pakfire_client* client,
                pakfire_client_list_uploads_callback callback, void* data);
-int pakfire_client_delete_upload(struct pakfire_client* client, const char* uuid);
+int pakfire_client_delete_upload(pakfire_client* client, const char* uuid);
 
 // Repositories
 
-int pakfire_client_list_repos(struct pakfire_client* client, const char* distro);
-int pakfire_client_get_repo(struct pakfire_client* client,
+int pakfire_client_list_repos(pakfire_client* client, const char* distro);
+int pakfire_client_get_repo(pakfire_client* client,
        const char* distro, const char* name);
-int pakfire_client_create_repo(struct pakfire_client* client,
+int pakfire_client_create_repo(pakfire_client* client,
        const char* distro, const char* name, const char* description);
-int pakfire_client_delete_repo(struct pakfire_client* client, const char* distro,
+int pakfire_client_delete_repo(pakfire_client* client, const char* distro,
        const char* name, pakfire_xfer_response_callback callback, void* data);
 
 // Jobs
 
-int pakfire_client_job_finished(struct pakfire_client* self,
+int pakfire_client_job_finished(pakfire_client* self,
        const char* job_id, const char* logfile, char** packages);
 
 #endif /* PAKFIRE_CLIENT_H */
index 804a348a608457df42780db9910a233f36f1f356..1d8fc4af45f519ac52695a333ff97bac6f03900a 100644 (file)
@@ -38,7 +38,7 @@ struct pakfire_daemon {
        int nrefs;
 
        // Pakfire Client
-       struct pakfire_client* client;
+       pakfire_client* client;
 
        // Builder
        struct pakfire_builder* builder;
@@ -148,7 +148,7 @@ static int pakfire_daemon_release_inhibit_shutdown(struct pakfire_daemon* self)
 /*
        Called when the client is ready and we can start making connections...
 */
-static int pakfire_daemon_ready(struct pakfire_client* client, void* data) {
+static int pakfire_daemon_ready(pakfire_client* client, void* data) {
        struct pakfire_daemon* self = data;
 
        // Connect the control connection
index 01d639bf711232471b1a74eee42a3904ab08400f..ad1842b6dfecbacce958b03f4eb5891d298fdd64 100644 (file)
@@ -58,7 +58,7 @@ struct pakfire_job {
        struct pakfire_builder* builder;
 
        // Client
-       struct pakfire_client* client;
+       pakfire_client* client;
 
        // Event Loop
        sd_event* loop;
@@ -295,7 +295,7 @@ static int pakfire_job_finished(struct pakfire_job* self) {
        return pakfire_builder_job_finished(self->builder, self);
 }
 
-static int pakfire_job_package_uploaded(struct pakfire_client* client,
+static int pakfire_job_package_uploaded(pakfire_client* client,
                pakfire_client_upload_status status, const char* path, const char* uuid, void* data) {
        struct pakfire_job* self = data;
        int r;
@@ -360,7 +360,7 @@ static int pakfire_job_upload_packages(struct pakfire_job* self) {
                        continue;
 
                // Upload the package
-               r = pakfire_client_upload(self->client, entry->fts_path, entry->fts_name,
+               r = pakfire_client_upload_create(self->client, entry->fts_path, entry->fts_name,
                                pakfire_job_package_uploaded, self);
                if (r < 0)
                        goto ERROR;
@@ -379,7 +379,7 @@ ERROR:
 /*
        Called when the log file has been uploaded...
 */
-static int pakfire_job_logfile_uploaded(struct pakfire_client* client,
+static int pakfire_job_logfile_uploaded(pakfire_client* client,
                pakfire_client_upload_status status, const char* path, const char* uuid, void* data) {
        struct pakfire_job* self = data;
 
@@ -505,7 +505,7 @@ static int pakfire_job_exited(sd_event_source* s, const siginfo_t* si, void* dat
        }
 
        // Upload the log file
-       r = pakfire_client_upload(job->client, path, filename, pakfire_job_logfile_uploaded, job);
+       r = pakfire_client_upload_create(job->client, path, filename, pakfire_job_logfile_uploaded, job);
        if (r < 0) {
                ERROR(job->ctx, "Could not upload the log file: %s\n", strerror(-r));
                goto ERROR;
@@ -857,7 +857,7 @@ int pakfire_job_stream_logs(struct pakfire_job* self) {
 }
 
 int pakfire_job_create(struct pakfire_job** job, pakfire_ctx* ctx,
-               struct pakfire_client* client, struct pakfire_builder* builder, json_object* data) {
+               pakfire_client* client, struct pakfire_builder* builder, json_object* data) {
        struct pakfire_job* j = NULL;
        char* p = NULL;
        int r;
index 576c6dd63fef67bdef3aa7f39ef36dc1aabc5fbb..888e421f40d8eac00d6e4a60495a41ce4d895a7b 100644 (file)
@@ -30,7 +30,7 @@
 struct pakfire_job;
 
 int pakfire_job_create(struct pakfire_job** worker, pakfire_ctx* ctx,
-       struct pakfire_client* client, struct pakfire_builder* builder, json_object* data);
+       pakfire_client* client, struct pakfire_builder* builder, json_object* data);
 
 struct pakfire_job* pakfire_job_ref(struct pakfire_job* worker);
 struct pakfire_job* pakfire_job_unref(struct pakfire_job* worker);