]> www.average.org Git - psmb.git/blob - include/psmb.h
save errnos
[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_pmtu(psmb_ctx_t *ctx, unsigned int pmtu);
14 psmb_result_t psmb_set_port(psmb_ctx_t *ctx, unsigned short pmtu);
15 psmb_result_t psmb_set_mgrp(psmb_ctx_t *ctx, struct {unsigned char _uc[16];} pfx, unsigned char bits);
16 psmb_result_t psmb_open(psmb_ctx_t *ctx);
17 void psmb_destroy(psmb_ctx_t *ctx);
18 int psmb_getfd(psmb_ctx_t *ctx);
19 bool psmb_need_write_wait(psmb_result_t result);
20 psmb_result_t psmb_ev_rd(psmb_ctx_t *ctx);
21 psmb_result_t psmb_ev_wr(psmb_ctx_t *ctx);
22 psmb_result_t psmb_ev_ex(psmb_ctx_t *ctx);
23 psmb_result_t psmb_subscribe(psmb_ctx_t *ctx, char *channel);
24 psmb_result_t psmb_publish(psmb_ctx_t *ctx, char *channel,
25                                 void *data, size_t size);
26 bool psmb_message(psmb_ctx_t *ctx, char **channel,
27                                 void **data, size_t *size);
28
29 #endif