2023-08-12 11:06:14 +00:00
|
|
|
#ifndef OBS_STUDIO_PLUGIN_UNIX_SOCKET_CONTROL_SOCKET_H_
|
|
|
|
#define OBS_STUDIO_PLUGIN_UNIX_SOCKET_CONTROL_SOCKET_H_
|
|
|
|
|
|
|
|
// standard library includes
|
|
|
|
#include <stdint.h>
|
2023-08-12 12:59:52 +00:00
|
|
|
#include <threads.h>
|
2023-08-12 11:06:14 +00:00
|
|
|
|
|
|
|
// unix includes
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
|
2023-08-12 12:59:52 +00:00
|
|
|
// local includes
|
|
|
|
#include "common_constants.h"
|
2023-08-12 11:06:14 +00:00
|
|
|
|
|
|
|
typedef struct UnixSocketHandler {
|
|
|
|
/*
|
|
|
|
* All ones - invalid/cleaned-up instance
|
|
|
|
*/
|
|
|
|
uint64_t flags;
|
|
|
|
struct sockaddr_un name;
|
2023-08-12 12:59:52 +00:00
|
|
|
thrd_t *thread;
|
|
|
|
mtx_t *mutex;
|
|
|
|
/*
|
|
|
|
* ???? 0001 - thread should stop
|
|
|
|
*/
|
2023-08-13 04:31:04 +00:00
|
|
|
uint64_t ccflags;
|
2023-08-13 04:53:52 +00:00
|
|
|
char socket_filename[108];
|
2023-08-12 12:59:52 +00:00
|
|
|
|
2023-08-12 11:06:14 +00:00
|
|
|
int socket_descriptor;
|
|
|
|
} UnixSocketHandler;
|
|
|
|
|
2023-08-12 12:59:52 +00:00
|
|
|
void init_unix_socket_handler(UnixSocketHandler *handler);
|
2023-08-12 11:06:14 +00:00
|
|
|
void cleanup_unix_socket_handler(UnixSocketHandler *handler);
|
2023-08-13 05:19:10 +00:00
|
|
|
int is_unix_socket_handler_valid(const UnixSocketHandler *handler);
|
2023-08-12 11:06:14 +00:00
|
|
|
|
|
|
|
#endif
|