]> www.average.org Git - psmb.git/blob - include/psmb.h
cc320e093a557044848df900a1667d59c8d72d9a
[psmb.git] / include / psmb.h
1 #ifndef _PSMB_H
2
3 #include <stdlib.h>
4 #include <stdbool.h>
5
6 typedef struct _psmb_ctx psmb_ctx_t;
7 typedef struct _psmb_result psmb_result_t;
8
9 psmb_ctx_t *psmb_new(void);
10 psmb_ctx_t *psmb_new_mm(void *(*malloc)(size_t size),
11         void (*free)(void *ptr),
12         void *(*realloc)(void *ptr, size_t size));
13 psmb_result_t psmb_set_logf(psmb_ctx_t *ctx,
14         void (*logf)(void *log_priv, int priority, const char *format, ...),
15         void *log_priv);
16 psmb_result_t psmb_set_pmtu(psmb_ctx_t *ctx, unsigned int pmtu);
17 psmb_result_t psmb_set_port(psmb_ctx_t *ctx, unsigned short pmtu);
18 psmb_result_t psmb_set_mgrp(psmb_ctx_t *ctx, struct {unsigned char _uc[16];} pfx, unsigned char bits);
19 psmb_result_t psmb_open(psmb_ctx_t *ctx);
20 void psmb_destroy(psmb_ctx_t *ctx);
21 int psmb_getfd(psmb_ctx_t *ctx);
22 bool psmb_need_write_wait(psmb_result_t result);
23 psmb_result_t psmb_ev_rd(psmb_ctx_t *ctx);
24 psmb_result_t psmb_ev_wr(psmb_ctx_t *ctx);
25 psmb_result_t psmb_ev_ex(psmb_ctx_t *ctx);
26 psmb_result_t psmb_subscribe(psmb_ctx_t *ctx, char *channel);
27 psmb_result_t psmb_publish(psmb_ctx_t *ctx, char *channel,
28         void *data, size_t size);
29 bool psmb_message(psmb_ctx_t *ctx, char **channel,
30         void **data, size_t *size);
31
32 #endif