mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
46 lines
1.7 KiB
C
46 lines
1.7 KiB
C
#ifndef __SERVAL_DNA__MESHMB_H
|
|
#define __SERVAL_DNA__MESHMB_H
|
|
|
|
struct meshmb_feeds;
|
|
|
|
enum meshmb_send_status{
|
|
MESHMB_ERROR = -1,
|
|
MESHMB_OK = 0,
|
|
};
|
|
|
|
// details of a feed that you are following
|
|
struct meshmb_feed_details{
|
|
rhizome_bid_t bundle_id;
|
|
const char *name;
|
|
const char *last_message;
|
|
time_s_t timestamp;
|
|
};
|
|
|
|
struct rhizome_manifest_field_assignment;
|
|
int meshmb_send(const keyring_identity *id, const char *message, size_t message_len,
|
|
unsigned nassignments, const struct rhizome_manifest_field_assignment *assignments);
|
|
|
|
// feed tracking
|
|
int meshmb_open(keyring_identity *id, struct meshmb_feeds **feeds);
|
|
void meshmb_close(struct meshmb_feeds *feeds);
|
|
|
|
// re-write metadata if required
|
|
// returns -1 on failure, or a generation number that is incremented only if something has changed.
|
|
int meshmb_flush(struct meshmb_feeds *feeds);
|
|
|
|
// set / clear follow flag for this feed
|
|
int meshmb_follow(struct meshmb_feeds *feeds, rhizome_bid_t *bid);
|
|
int meshmb_ignore(struct meshmb_feeds *feeds, rhizome_bid_t *bid);
|
|
|
|
// enumerate feeds, starting from restart_from
|
|
typedef int (*meshmb_callback) (struct meshmb_feed_details *details, void *context);
|
|
int meshmb_enum(struct meshmb_feeds *feeds, rhizome_bid_t *restart_from, meshmb_callback callback, void *context);
|
|
|
|
// update metadata of all feeds based on current rhizome contents (optionally call after opening)
|
|
int meshmb_update(struct meshmb_feeds *feeds);
|
|
// update metadata of a single feed, eg because of a new bundle or when about to read a single ply.
|
|
// it is the callers reponsibility to supply a reader and close it
|
|
void meshmb_bundle_update(struct meshmb_feeds *feeds, rhizome_manifest *m, struct message_ply_read *reader);
|
|
|
|
#endif
|