ccnr_proto.h

Go to the documentation of this file.
00001 /**
00002  * @file ccnr_proto.h
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 #ifndef CCNR_PROTO_DEFINED
00024 #define CCNR_PROTO_DEFINED
00025 
00026 #include "ccnr_private.h"
00027 
00028 #define REPO_SW "\xC1.R.sw"
00029 #define REPO_SWC "\xC1.R.sw-c"
00030 #define REPO_AF "\xC1.R.af"
00031 #define NAME_BE "\xC1.E.be"
00032 
00033 struct ccnr_parsed_policy {
00034     unsigned char version[7];
00035     int policy_version_offset;
00036     int local_name_offset;
00037     int global_prefix_offset;
00038     struct ccn_indexbuf *namespaces;
00039     struct ccn_charbuf *store;
00040 };
00041 
00042 #define CCNR_PIPELINE 4
00043 struct ccnr_expect_content {
00044     struct ccnr_handle *ccnr;
00045     int tries; /** counter so we can give up eventually */
00046     int done;
00047     ccnr_cookie keyfetch;
00048     intmax_t outstanding[CCNR_PIPELINE];
00049     intmax_t final;
00050     ccn_handler expect_complete;
00051 };
00052 
00053 
00054 void r_proto_init(struct ccnr_handle *ccnr);
00055 void r_proto_uri_listen(struct ccnr_handle *ccnr, struct ccn *ccn, const char *uri,
00056                         ccn_handler p, intptr_t intdata);
00057 int r_proto_append_repo_info(struct ccnr_handle *ccnr,
00058                              struct ccn_charbuf *rinfo,
00059                              struct ccn_charbuf *names,
00060                              const char *info);
00061 int r_proto_policy_append_basic(struct ccnr_handle *ccnr,
00062                                 struct ccn_charbuf *policy,
00063                                 const char *version, const char *local_name,
00064                                 const char *global_prefix);
00065 int r_proto_policy_append_namespace(struct ccnr_handle *ccnr,
00066                                     struct ccn_charbuf *policy,
00067                                     const char *namespace);
00068 enum ccn_upcall_res r_proto_expect_content(struct ccn_closure *selfp,
00069                                            enum ccn_upcall_kind kind,
00070                                            struct ccn_upcall_info *info);
00071 int
00072 r_proto_parse_policy(struct ccnr_handle *ccnr, const unsigned char *buf, size_t length,
00073                      struct ccnr_parsed_policy *pp);
00074 void r_proto_activate_policy(struct ccnr_handle *ccnr, struct ccnr_parsed_policy *pp);
00075 void r_proto_deactivate_policy(struct ccnr_handle *ccnr, struct ccnr_parsed_policy *pp);
00076 int r_proto_initiate_key_fetch(struct ccnr_handle *ccnr,
00077                                const unsigned char *msg,
00078                                struct ccn_parsed_ContentObject *pco,
00079                                int use_link,
00080                                ccnr_cookie a);
00081 #endif

Generated on Thu Feb 16 00:43:58 2012 for Content-Centric Networking in C by  doxygen 1.5.6