ccnd_main.c

Go to the documentation of this file.
00001 /**
00002  * @file ccnd_main.c
00003  *
00004  * A CCNx program.
00005  *
00006  * Copyright (C) 2009-2011 Palo Alto Research Center, Inc.
00007  *
00008  * This work is free software; you can redistribute it and/or modify it under
00009  * the terms of the GNU General Public License version 2 as published by the
00010  * Free Software Foundation.
00011  * This work is distributed in the hope that it will be useful, but WITHOUT ANY
00012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
00014  * for more details. You should have received a copy of the GNU General Public
00015  * License along with this program; if not, write to the
00016  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include <signal.h>
00021 #include <stddef.h>
00022 #include <stdarg.h>
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 
00026 #include "ccnd_private.h"
00027 
00028 static int
00029 stdiologger(void *loggerdata, const char *format, va_list ap)
00030 {
00031     FILE *fp = (FILE *)loggerdata;
00032     return(vfprintf(fp, format, ap));
00033 }
00034 
00035 int
00036 main(int argc, char **argv)
00037 {
00038     struct ccnd_handle *h;
00039     
00040     if (argc > 1) {
00041         fprintf(stderr, "%s", ccnd_usage_message);
00042         exit(1);
00043     }
00044     signal(SIGPIPE, SIG_IGN);
00045     h = ccnd_create(argv[0], stdiologger, stderr);
00046     if (h == NULL)
00047         exit(1);
00048     ccnd_run(h);
00049     ccnd_msg(h, "exiting.");
00050     ccnd_destroy(&h);
00051     exit(0);
00052 }
Generated on Fri May 13 16:27:01 2011 for Content-Centric Networking in C by  doxygen 1.6.3