btree_content.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
00024 #ifndef CCN_BTREE_CONTENT_DEFINED
00025 #define CCN_BTREE_CONTENT_DEFINED
00026
00027 #include <sys/types.h>
00028 #include <ccn/btree.h>
00029 #include <ccn/ccn.h>
00030 #include <ccn/charbuf.h>
00031
00032
00033
00034
00035 struct ccn_btree_content_payload {
00036 unsigned char magic[1];
00037 unsigned char ctype[3];
00038 unsigned char cobsz[4];
00039 unsigned char ncomp[2];
00040 unsigned char flags[1];
00041 unsigned char ttpad[1];
00042 unsigned char timex[6];
00043 unsigned char actim[6];
00044 unsigned char cobid[8];
00045 unsigned char ppkdg[32];
00046 };
00047 #define CCN_BT_CONTENT_MAGIC 0xC0
00048 #define CCN_RCFLAG_LASTBLOCK 0x80
00049 #define CCN_RCFLAG_STALE 0x01
00050
00051
00052
00053
00054 struct ccn_btree_content_entry {
00055 struct ccn_btree_content_payload ce;
00056 struct ccn_btree_entry_trailer trailer;
00057 };
00058
00059
00060 int ccn_btree_match_interest(struct ccn_btree_node *node, int ndx,
00061 const unsigned char *interest_msg,
00062 const struct ccn_parsed_interest *pi,
00063 struct ccn_charbuf *scratch);
00064
00065
00066 int ccn_btree_insert_content(struct ccn_btree_node *node, int ndx,
00067 uint_least64_t cobid,
00068 const unsigned char *content_object,
00069 struct ccn_parsed_ContentObject *pc,
00070 struct ccn_charbuf *flatname);
00071
00072
00073 uint_least64_t ccn_btree_content_cobid(struct ccn_btree_node *node, int ndx);
00074 int ccn_btree_content_set_cobid(struct ccn_btree_node *node, int ndx,
00075 uint_least64_t cobid);
00076
00077 int ccn_btree_content_cobsz(struct ccn_btree_node *node, int ndx);
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 int ccn_flatname_append_component(struct ccn_charbuf *dst,
00109 const unsigned char *comp, size_t size);
00110 int ccn_flatname_append_from_ccnb(struct ccn_charbuf *dst,
00111 const unsigned char *ccnb, size_t size,
00112 int skip, int count);
00113 int ccn_flatname_from_ccnb(struct ccn_charbuf *dst,
00114 const unsigned char *ccnb, size_t size);
00115
00116
00117 int ccn_name_append_flatname(struct ccn_charbuf *dst,
00118 const unsigned char *flatname, size_t size,
00119 int skip, int count);
00120 int ccn_uri_append_flatname(struct ccn_charbuf *uri,
00121 const unsigned char *flatname, size_t size,
00122 int includescheme);
00123
00124 int ccn_flatname_ncomps(const unsigned char *flatname, size_t size);
00125
00126
00127 int ccn_flatname_charbuf_compare(struct ccn_charbuf *a, struct ccn_charbuf *b);
00128 int ccn_flatname_compare(const unsigned char *a, size_t al,
00129 const unsigned char *b, size_t bl);
00130
00131
00132
00133
00134
00135 int ccn_flatname_next_comp(const unsigned char *flatname, size_t size);
00136
00137 #define CCNFLATDELIMSZ(rnc) ((rnc) & 3)
00138
00139 #define CCNFLATDATASZ(rnc) ((rnc) >> 2)
00140
00141 #define CCNFLATSKIP(rnc) (CCNFLATDELIMSZ(rnc) + CCNFLATDATASZ(rnc))
00142
00143 #endif