libmp/include/pool.h

42 lines
1.3 KiB
C

#pragma once
#include "mptp.h"
#include "types.h"
#include <stdbool.h>
#include <sys/socket.h>
#define POOL_INFO_SIZE "size"
#define POOL_INFO_PUBKEY "pubkey"
#define POOL_INFO_MAINTAINER "maintainer"
typedef struct lm_pool_thread_arg {
int sock;
struct sockaddr addr;
lm_mptp_t packet;
lm_pool_t *pool;
} lm_pool_thread_arg_t;
lm_pool_t *lm_pool_new(char *name, char *url);
void lm_pool_test(lm_pool_t *pool);
void lm_pool_free(lm_pool_t *pool);
lm_pkg_t *lm_pool_package_find(lm_pool_t *pool, char *name, char *version);
bool lm_pool_package_add(lm_pool_t *pool, lm_pkg_t *pkg);
bool lm_pool_package_get(lm_pool_t *pool, lm_pkg_t *pkg);
bool lm_pool_path_set_info(lm_pool_t *pool, char *info_path);
bool lm_pool_path_set_list(lm_pool_t *pool, char *list_path);
bool lm_pool_path_set_packages(lm_pool_t *pool, char *packaes_path);
bool lm_pool_path_is_empty(lm_pool_t *pool);
void lm_pool_path_free(lm_pool_t *pool);
bool lm_pool_info_load(lm_pool_t *pool);
bool lm_pool_info_get(lm_pool_t *pool);
void lm_pool_info_free(lm_pool_t *pool);
bool lm_pool_list_load(lm_pool_t *pool);
bool lm_pool_list_get(lm_pool_t *pool);
void lm_pool_serve(lm_pool_t *pool, lm_mptp_t *packet, int sock, struct sockaddr *addr);
void lm_pool_serve_thread(void *arg);