00001 /** 00002 * Copyright (C) 2009-2012 Palo Alto Research Center, Inc. 00003 * 00004 * This work is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU General Public License version 2 as published by the 00006 * Free Software Foundation. 00007 * This work is distributed in the hope that it will be useful, but WITHOUT ANY 00008 * WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00010 * for more details. You should have received a copy of the GNU General Public 00011 * License along with this program; if not, write to the 00012 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00013 * Boston, MA 02110-1301, USA. 00014 */ 00015 00016 /** 00017 * This module replaces ccnr_main on the android platform. It includes the 00018 * methods a JNI interface would use to start ccnd. 00019 */ 00020 00021 #include <stdarg.h> 00022 #include <android/log.h> 00023 #include <ccnr_private.h> 00024 00025 static int 00026 logger(void *loggerdata, const char *format, va_list ap) 00027 { 00028 __android_log_vprint(ANDROID_LOG_INFO, "CCNR", format, ap); 00029 } 00030 00031 int 00032 start_ccnr(void) 00033 { 00034 struct ccnr_handle *h = NULL; 00035 00036 h = r_init_create(&logger, NULL); 00037 if (h == NULL) { 00038 exit(1); 00039 } 00040 ccnr_msg(h, "r_init_create h=%p", h); 00041 r_dispatch_run(h); 00042 s = (h->running != 0); 00043 ccnr_msg(h, "exiting."); 00044 r_init_destroy(&h); 00045 return 0; 00046 }
1.6.3