CCNx-Android-Services/jni/csrc/ccnr/ccnr_proto.c File Reference

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

#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <ccn/ccn.h>
#include <ccn/charbuf.h>
#include <ccn/ccn_private.h>
#include <ccn/schedule.h>
#include <ccn/sockaddrutil.h>
#include <ccn/uri.h>
#include <ccn/coding.h>
#include <sync/SyncBase.h>
#include "ccnr_private.h"
#include "ccnr_proto.h"
#include "ccnr_dispatch.h"
#include "ccnr_forwarding.h"
#include "ccnr_init.h"
#include "ccnr_io.h"
#include "ccnr_msg.h"
#include "ccnr_sendq.h"
#include "ccnr_store.h"
#include "ccnr_sync.h"
#include "ccnr_util.h"

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_charbuf * r_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.


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.

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

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.


Generated on Thu Feb 16 00:45:13 2012 for CCNx for Android by  doxygen 1.5.6