2023-02-08 18:12:00 +01:00
|
|
|
/* PipeWire */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2020 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
2021-06-18 23:36:35 +02:00
|
|
|
|
|
|
|
|
#ifndef PULSER_SERVER_OPERATION_H
|
|
|
|
|
#define PULSER_SERVER_OPERATION_H
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include <spa/utils/list.h>
|
|
|
|
|
|
|
|
|
|
struct client;
|
|
|
|
|
|
|
|
|
|
struct operation {
|
|
|
|
|
struct spa_list link;
|
|
|
|
|
struct client *client;
|
|
|
|
|
uint32_t tag;
|
2022-02-17 16:56:21 +01:00
|
|
|
void (*callback) (void *data, struct client *client, uint32_t tag);
|
|
|
|
|
void *data;
|
2021-06-18 23:36:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int operation_new(struct client *client, uint32_t tag);
|
2022-02-17 16:56:21 +01:00
|
|
|
int operation_new_cb(struct client *client, uint32_t tag,
|
|
|
|
|
void (*callback) (void *data, struct client *client, uint32_t tag),
|
|
|
|
|
void *data);
|
2022-02-20 21:34:53 +01:00
|
|
|
struct operation *operation_find(struct client *client, uint32_t tag);
|
2021-06-18 23:36:35 +02:00
|
|
|
void operation_free(struct operation *o);
|
|
|
|
|
void operation_complete(struct operation *o);
|
|
|
|
|
|
2023-05-07 16:16:20 +02:00
|
|
|
static inline void operation_free_by_tag(struct client *client, uint32_t tag)
|
|
|
|
|
{
|
|
|
|
|
struct operation *o = operation_find(client, tag);
|
|
|
|
|
if (o)
|
|
|
|
|
operation_free(o);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-18 23:36:35 +02:00
|
|
|
#endif /* PULSER_SERVER_OPERATION_H */
|