X-Git-Url: http://www.average.org/gitweb/?p=psmb.git;a=blobdiff_plain;f=include%2Fpsmb.h;h=c5869ecd783e1aa5532acfaade7b5010f260cded;hp=cc320e093a557044848df900a1667d59c8d72d9a;hb=df69e51a863610a5bfb6eee594418e0412954d8b;hpb=0e17b577419dd949124a0ca44c335c4ca929e928;ds=sidebyside diff --git a/include/psmb.h b/include/psmb.h index cc320e0..c5869ec 100644 --- a/include/psmb.h +++ b/include/psmb.h @@ -2,9 +2,10 @@ #include #include +#include typedef struct _psmb_ctx psmb_ctx_t; -typedef struct _psmb_result psmb_result_t; +typedef struct _psmb_result { int code; } psmb_result_t; psmb_ctx_t *psmb_new(void); psmb_ctx_t *psmb_new_mm(void *(*malloc)(size_t size), @@ -15,18 +16,23 @@ psmb_result_t psmb_set_logf(psmb_ctx_t *ctx, void *log_priv); psmb_result_t psmb_set_pmtu(psmb_ctx_t *ctx, unsigned int pmtu); psmb_result_t psmb_set_port(psmb_ctx_t *ctx, unsigned short pmtu); -psmb_result_t psmb_set_mgrp(psmb_ctx_t *ctx, struct {unsigned char _uc[16];} pfx, unsigned char bits); +psmb_result_t psmb_set_mgrp(psmb_ctx_t *ctx, struct in6_addr prefix, + unsigned char prefixlen); psmb_result_t psmb_open(psmb_ctx_t *ctx); void psmb_destroy(psmb_ctx_t *ctx); int psmb_getfd(psmb_ctx_t *ctx); +bool psmb_success(psmb_result_t result); +bool psmb_message_waiting(psmb_result_t result); bool psmb_need_write_wait(psmb_result_t result); psmb_result_t psmb_ev_rd(psmb_ctx_t *ctx); psmb_result_t psmb_ev_wr(psmb_ctx_t *ctx); psmb_result_t psmb_ev_ex(psmb_ctx_t *ctx); psmb_result_t psmb_subscribe(psmb_ctx_t *ctx, char *channel); +psmb_result_t psmb_unsubscribe(psmb_ctx_t *ctx, char *channel); psmb_result_t psmb_publish(psmb_ctx_t *ctx, char *channel, void *data, size_t size); -bool psmb_message(psmb_ctx_t *ctx, char **channel, +psmb_result_t psmb_get_message(psmb_ctx_t *ctx, char **channel, void **data, size_t *size); +psmb_result_t psmb_acknowledge(psmb_ctx_t *ctx); #endif