ccnr_proto.c File Reference

Part of ccnr - CCNx Repository Daemon. More...

Go to the source code of this file.

Defines

#define CCNR_MAX_RETRY   5
#define ENUMERATION_STATE_TICK_MICROSEC   1000000

Functions

static enum ccn_upcall_res r_proto_start_write (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info, int marker_comp)
static enum ccn_upcall_res r_proto_start_write_checked (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info, int marker_comp)
static enum ccn_upcall_res r_proto_begin_enumeration (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info, int marker_comp)
static enum ccn_upcall_res r_proto_continue_enumeration (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info, int marker_comp)
static enum ccn_upcall_res r_proto_bulk_import (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info, int marker_comp)
static int name_comp_equal_prefix (const unsigned char *data, const struct ccn_indexbuf *indexbuf, unsigned int i, const void *buf, size_t length)
 Compare a name component at index i to bytes in buf and return 1 if they are equal in the first length bytes.
PUBLIC enum ccn_upcall_res r_proto_answer_req (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
PUBLIC void r_proto_uri_listen (struct ccnr_handle *ccnr, struct ccn *ccn, const char *uri, ccn_handler p, intptr_t intdata)
PUBLIC void r_proto_init (struct ccnr_handle *ccnr)
PUBLIC void r_proto_activate_policy (struct ccnr_handle *ccnr, struct ccnr_parsed_policy *pp)
 Install the listener for the namespaces that the parsed policy says to serve.
PUBLIC void r_proto_deactivate_policy (struct ccnr_handle *ccnr, struct ccnr_parsed_policy *pp)
 Uninstall the listener for the namespaces that the parsed policy says to serve.
PUBLIC int r_proto_append_repo_info (struct ccnr_handle *ccnr, struct ccn_charbuf *rinfo, struct ccn_charbuf *names, const char *info)
 Construct a charbuf with an encoding of a RepositoryInfo.
static struct ccn_charbufr_proto_mktemplate (struct ccnr_expect_content *md, struct ccn_upcall_info *info)
PUBLIC enum ccn_upcall_res r_proto_expect_content (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static int r_proto_policy_update (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
static int r_proto_policy_complete (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static int r_proto_check_exclude (struct ccnr_handle *ccnr, struct ccn_upcall_info *info, struct ccn_charbuf *name)
 Returns 1 if the Exclude in the interest described by the info parameter would exclude the full name in name.
static int reap_enumerations (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
 Remove expired enumeration table entries.
static void reap_enumerations_needed (struct ccnr_handle *ccnr)
void r_proto_dump_enums (struct ccnr_handle *ccnr)
PUBLIC int r_proto_policy_append_basic (struct ccnr_handle *ccnr, struct ccn_charbuf *policy, const char *version, const char *local_name, const char *global_prefix)
PUBLIC int r_proto_policy_append_namespace (struct ccnr_handle *ccnr, struct ccn_charbuf *policy, const char *namespace)
PUBLIC int r_proto_parse_policy (struct ccnr_handle *ccnr, const unsigned char *buf, size_t length, struct ccnr_parsed_policy *pp)
 Parse a ccnb-encoded policy content object and fill in a ccn_parsed_policy structure as the result.
int r_proto_initiate_key_fetch (struct ccnr_handle *ccnr, const unsigned char *msg, struct ccn_parsed_ContentObject *pco, int use_link, ccnr_cookie a)
 Initiate a key fetch if necessary.


Detailed Description

Part of ccnr - CCNx Repository Daemon.

Definition in file ccnr_proto.c.


Define Documentation

#define CCNR_MAX_RETRY   5

Definition at line 55 of file ccnr_proto.c.

Referenced by r_proto_expect_content().

#define ENUMERATION_STATE_TICK_MICROSEC   1000000

Definition at line 916 of file ccnr_proto.c.

Referenced by reap_enumerations(), and reap_enumerations_needed().


Function Documentation

static int name_comp_equal_prefix ( const unsigned char *  data,
const struct ccn_indexbuf indexbuf,
unsigned int  i,
const void *  buf,
size_t  length 
) [static]

Compare a name component at index i to bytes in buf and return 1 if they are equal in the first length bytes.

The name component must contain at least length bytes for this comparison to return equality.

Returns:
1 for equality, 0 for inequality.

Definition at line 205 of file ccnr_proto.c.

Referenced by r_proto_answer_req().

PUBLIC void r_proto_activate_policy ( struct ccnr_handle ccnr,
struct ccnr_parsed_policy pp 
)

Install the listener for the namespaces that the parsed policy says to serve.

Normal usage is to deactivate the old policy and then activate the new one

Definition at line 249 of file ccnr_proto.c.

Referenced by r_init_create(), and r_proto_policy_update().

PUBLIC enum ccn_upcall_res r_proto_answer_req ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Definition at line 92 of file ccnr_proto.c.

Referenced by r_proto_activate_policy().

PUBLIC int r_proto_append_repo_info ( struct ccnr_handle ccnr,
struct ccn_charbuf rinfo,
struct ccn_charbuf names,
const char *  info 
)

Construct a charbuf with an encoding of a RepositoryInfo.

Definition at line 296 of file ccnr_proto.c.

Referenced by r_proto_bulk_import(), r_proto_start_write(), and r_proto_start_write_checked().

static enum ccn_upcall_res r_proto_begin_enumeration ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info,
int  marker_comp 
) [static]

Definition at line 968 of file ccnr_proto.c.

Referenced by r_proto_answer_req().

static enum ccn_upcall_res r_proto_bulk_import ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info,
int  marker_comp 
) [static]

Definition at line 1274 of file ccnr_proto.c.

Referenced by r_proto_answer_req().

static int r_proto_check_exclude ( struct ccnr_handle ccnr,
struct ccn_upcall_info info,
struct ccn_charbuf name 
) [static]

Returns 1 if the Exclude in the interest described by the info parameter would exclude the full name in name.

Definition at line 854 of file ccnr_proto.c.

Referenced by r_proto_begin_enumeration().

static enum ccn_upcall_res r_proto_continue_enumeration ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info,
int  marker_comp 
) [static]

Definition at line 1098 of file ccnr_proto.c.

Referenced by r_proto_answer_req(), and r_proto_begin_enumeration().

PUBLIC void r_proto_deactivate_policy ( struct ccnr_handle ccnr,
struct ccnr_parsed_policy pp 
)

Uninstall the listener for the namespaces that the parsed policy says to serve.

Definition at line 271 of file ccnr_proto.c.

Referenced by r_proto_policy_update().

void r_proto_dump_enums ( struct ccnr_handle ccnr  ) 

Definition at line 1256 of file ccnr_proto.c.

PUBLIC enum ccn_upcall_res r_proto_expect_content ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Definition at line 339 of file ccnr_proto.c.

Referenced by r_proto_initiate_key_fetch(), and r_proto_start_write().

PUBLIC void r_proto_init ( struct ccnr_handle ccnr  ) 

Definition at line 240 of file ccnr_proto.c.

Referenced by r_init_create().

int r_proto_initiate_key_fetch ( struct ccnr_handle ccnr,
const unsigned char *  msg,
struct ccn_parsed_ContentObject pco,
int  use_link,
ccnr_cookie  a 
)

Initiate a key fetch if necessary.

Returns:
-1 if error or no name, 0 if fetch was issued, 1 if already stored.

Definition at line 1454 of file ccnr_proto.c.

Referenced by r_proto_expect_content(), and r_sync_upcall_store().

static struct ccn_charbuf* r_proto_mktemplate ( struct ccnr_expect_content md,
struct ccn_upcall_info info 
) [static, read]

Definition at line 324 of file ccnr_proto.c.

Referenced by r_proto_expect_content(), and r_proto_start_write().

PUBLIC int r_proto_parse_policy ( struct ccnr_handle ccnr,
const unsigned char *  buf,
size_t  length,
struct ccnr_parsed_policy pp 
)

Parse a ccnb-encoded policy content object and fill in a ccn_parsed_policy structure as the result.

Definition at line 1426 of file ccnr_proto.c.

Referenced by load_policy(), and r_proto_policy_update().

PUBLIC int r_proto_policy_append_basic ( struct ccnr_handle ccnr,
struct ccn_charbuf policy,
const char *  version,
const char *  local_name,
const char *  global_prefix 
)

Definition at line 1394 of file ccnr_proto.c.

Referenced by load_policy().

PUBLIC int r_proto_policy_append_namespace ( struct ccnr_handle ccnr,
struct ccn_charbuf policy,
const char *  namespace 
)

Definition at line 1408 of file ccnr_proto.c.

Referenced by load_policy().

static int r_proto_policy_complete ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Definition at line 593 of file ccnr_proto.c.

Referenced by r_proto_start_write().

static int r_proto_policy_update ( struct ccn_schedule *  sched,
void *  clienth,
struct ccn_scheduled_event ev,
int  flags 
) [static]

Definition at line 484 of file ccnr_proto.c.

Referenced by r_proto_policy_complete().

static enum ccn_upcall_res r_proto_start_write ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info,
int  marker_comp 
) [static]

Definition at line 634 of file ccnr_proto.c.

Referenced by r_proto_answer_req(), and r_proto_start_write_checked().

static enum ccn_upcall_res r_proto_start_write_checked ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info,
int  marker_comp 
) [static]

Definition at line 754 of file ccnr_proto.c.

Referenced by r_proto_answer_req().

PUBLIC void r_proto_uri_listen ( struct ccnr_handle ccnr,
struct ccn *  ccn,
const char *  uri,
ccn_handler  p,
intptr_t  intdata 
)

Definition at line 220 of file ccnr_proto.c.

Referenced by r_proto_activate_policy(), and r_proto_deactivate_policy().

static int reap_enumerations ( struct ccn_schedule *  sched,
void *  clienth,
struct ccn_scheduled_event ev,
int  flags 
) [static]

Remove expired enumeration table entries.

Definition at line 921 of file ccnr_proto.c.

Referenced by reap_enumerations_needed().

static void reap_enumerations_needed ( struct ccnr_handle ccnr  )  [static]

Definition at line 958 of file ccnr_proto.c.

Referenced by r_proto_begin_enumeration().


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