ccnr_proto.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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;
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