hop-2012/main.c

50 lines
1.1 KiB
C
Raw Normal View History

2010-12-27 21:56:42 +00:00
/* Copyright (C) 2010 Tony Garnock-Jones. All rights reserved. */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <netinet/in.h>
#include <ucontext.h>
typedef unsigned char u_char;
#include <event.h>
#include "cmsg_private.h"
#include "harness.h"
#include "net.h"
#include "ref.h"
#include "sexp.h"
#include "hashtable.h"
#include "node.h"
static node_t *factory_construct(node_class_t *nc, sexp_t *args) {
return malloc(sizeof(node_t));
}
static void factory_handle_message(node_t *n, sexp_t *m) {
info("factory_handle_message\n");
}
static node_class_t factory_class = {
.name = "factory",
.construct = factory_construct,
.destroy = (node_destructor_fn_t) free,
.handle_message = factory_handle_message
};
static void init_factory(void) {
bind_node(cmsg_cstring_bytes("factory"), new_node(&factory_class, NULL));
}
2010-12-27 21:56:42 +00:00
int main(int argc, char *argv[]) {
info("cmsg, Copyright (C) 2010 Tony Garnock-Jones. All rights reserved.\n");
event_init();
info("Using libevent version %s\n", event_get_version());
init_node();
init_factory();
2010-12-27 21:56:42 +00:00
start_net(5671);
boot_harness();
return 0;
}