hop-2012/experiments/cmsg/meta.c

40 lines
888 B
C

/* Copyright (C) 2010, 2011 Tony Garnock-Jones. All rights reserved. */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
#include "cmsg_private.h"
#include "ref.h"
#include "sexp.h"
#include "hashtable.h"
#include "node.h"
#include "meta.h"
#include "messages.h"
void init_meta(void) {
sexp_t *args;
args = INCREF(sexp_cons(sexp_cstring("meta"), NULL));
new_node(lookup_node_class(cmsg_cstring_bytes("direct")), args, NULL);
DECREF(args, sexp_destructor);
}
void announce_subscription(sexp_t *source,
sexp_t *filter,
sexp_t *sink,
sexp_t *name,
int onoff)
{
post_node(cmsg_cstring_bytes("meta"),
sexp_data(source),
onoff
? message_subscribed(source, filter, sink, name)
: message_unsubscribed(source, filter, sink, name),
NULL);
}