00001 /** 00002 * @file ccnr_forwarding.c 00003 * 00004 * Part of ccnr - CCNx Repository Daemon. 00005 * 00006 */ 00007 00008 /* 00009 * Copyright (C) 2011 Palo Alto Research Center, Inc. 00010 * 00011 * This work is free software; you can redistribute it and/or modify it under 00012 * the terms of the GNU General Public License version 2 as published by the 00013 * Free Software Foundation. 00014 * This work is distributed in the hope that it will be useful, but WITHOUT ANY 00015 * WARRANTY; without even the implied warranty of MERCHANTABILITY or 00016 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00017 * for more details. You should have received a copy of the GNU General Public 00018 * License along with this program; if not, write to the 00019 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 00024 #include <errno.h> 00025 #include <fcntl.h> 00026 #include <limits.h> 00027 #include <netdb.h> 00028 #include <poll.h> 00029 #include <signal.h> 00030 #include <stddef.h> 00031 #include <stdint.h> 00032 #include <stdio.h> 00033 #include <stdlib.h> 00034 #include <string.h> 00035 #include <time.h> 00036 #include <unistd.h> 00037 #include <arpa/inet.h> 00038 #include <sys/time.h> 00039 #include <sys/socket.h> 00040 #include <sys/stat.h> 00041 #include <sys/types.h> 00042 #include <sys/un.h> 00043 #include <netinet/in.h> 00044 00045 #include <ccn/bloom.h> 00046 #include <ccn/ccn.h> 00047 #include <ccn/ccn_private.h> 00048 #include <ccn/charbuf.h> 00049 #include <ccn/face_mgmt.h> 00050 #include <ccn/hashtb.h> 00051 #include <ccn/indexbuf.h> 00052 #include <ccn/schedule.h> 00053 #include <ccn/reg_mgmt.h> 00054 #include <ccn/uri.h> 00055 00056 #include "ccnr_private.h" 00057 #include "ccnr_forwarding.h" 00058 00059 #include "ccnr_io.h" 00060 #include "ccnr_link.h" 00061 #include "ccnr_match.h" 00062 #include "ccnr_msg.h" 00063 #include "ccnr_stats.h" 00064 #include "ccnr_util.h" 00065 00066 PUBLIC void 00067 r_fwd_finalize_nameprefix(struct hashtb_enumerator *e) 00068 { 00069 struct ccnr_handle *h = hashtb_get_param(e->ht, NULL); 00070 struct nameprefix_entry *npe = e->data; 00071 struct propagating_entry *head = &npe->pe_head; 00072 if (head->next != NULL) { 00073 while (head->next != head) 00074 r_match_consume_interest(h, head->next); 00075 } 00076 ccn_indexbuf_destroy(&npe->forward_to); 00077 ccn_indexbuf_destroy(&npe->tap); 00078 while (npe->forwarding != NULL) { 00079 struct ccn_forwarding *f = npe->forwarding; 00080 npe->forwarding = f->next; 00081 free(f); 00082 } 00083 }