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

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

#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <netdb.h>
#include <poll.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <ccn/bloom.h>
#include <ccn/ccn.h>
#include <ccn/ccn_private.h>
#include <ccn/charbuf.h>
#include <ccn/face_mgmt.h>
#include <ccn/hashtb.h>
#include <ccn/indexbuf.h>
#include <ccn/schedule.h>
#include <ccn/reg_mgmt.h>
#include <ccn/uri.h>
#include <sync/SyncBase.h>
#include "ccnr_private.h"
#include "ccnr_init.h"
#include "ccnr_dispatch.h"
#include "ccnr_forwarding.h"
#include "ccnr_internal_client.h"
#include "ccnr_io.h"
#include "ccnr_msg.h"
#include "ccnr_net.h"
#include "ccnr_proto.h"
#include "ccnr_sendq.h"
#include "ccnr_store.h"
#include "ccnr_sync.h"
#include "ccnr_util.h"

Defines

#define CCNR_CONFIG_PASSMASK   0x003
#define CCNR_CONFIG_IGNORELINE   0x100
#define CCNR_CONFIG_ERR   0x200

Functions

static int load_policy (struct ccnr_handle *ccnr)
 Load a link to the repo policy from the repoPolicy file and load the link target to extract the actual policy.
static int merge_files (struct ccnr_handle *h)
struct ccn_charbuf * r_init_read_config (struct ccnr_handle *h)
 Read the contents of the repository config file.
static int r_init_debug_getenv (struct ccnr_handle *h, const char *envname)
intmax_t r_init_confval (struct ccnr_handle *h, const char *key, intmax_t lo, intmax_t hi, intmax_t deflt)
 Get the specified numerical config value, subject to limits.
static void r_init_config_msg (struct ccnr_handle *h, int flags, int line, int chindex, const char *msg)
 Message helper for r_init_parse_config().
int r_init_parse_config (struct ccnr_handle *h, struct ccn_charbuf *config, int pass)
 Parse the buffered configuration found in config.
static int establish_min_send_bufsize (struct ccnr_handle *h, int fd, int minsize)
static int try_tcp_instead (int fd)
 If so configured, replace fd with a tcp socket.
PUBLIC struct ccnr_parsed_policy * ccnr_parsed_policy_create (void)
PUBLIC void ccnr_parsed_policy_destroy (struct ccnr_parsed_policy **ppp)
PUBLIC struct ccnr_handle * r_init_create (const char *progname, ccnr_logger logger, void *loggerdata)
 Create a new ccnr instance.
void r_init_fail (struct ccnr_handle *ccnr, int line, const char *culprit, int err)
PUBLIC void r_init_destroy (struct ccnr_handle **pccnr)
 Destroy the ccnr instance, releasing all associated resources.
int r_init_map_and_process_file (struct ccnr_handle *h, struct ccn_charbuf *filename, int add_content)
static struct ccn_charbuf * ccnr_init_policy_cob (struct ccnr_handle *ccnr, struct ccn *h, struct ccn_charbuf *basename, int freshness, struct ccn_charbuf *content)
PUBLIC struct ccn_charbuf * ccnr_init_policy_link_cob (struct ccnr_handle *ccnr, struct ccn *h, struct ccn_charbuf *targetname)
 should probably return a new cob, rather than reusing one.


Detailed Description

Part of ccnr - CCNx Repository Daemon.


Function Documentation

PUBLIC struct ccn_charbuf* ccnr_init_policy_link_cob ( struct ccnr_handle *  ccnr,
struct ccn *  h,
struct ccn_charbuf *  targetname 
) [read]

should probably return a new cob, rather than reusing one.

should publish link as: CCNRID_POLICY_URI("ccnx:/C1.M.S.localhost/C1.M.SRV/repository/POLICY)/C1.M.K<pubid>/<version>/00 should have key locator which is the key name of the repository

static int load_policy ( struct ccnr_handle *  ccnr  )  [static]

Load a link to the repo policy from the repoPolicy file and load the link target to extract the actual policy.

If a policy file does not exist a new one is created, with a link to a policy based either on the environment variable CCNR_GLOBAL_PREFIX or the system default value of ccnx:/parc.com/csl/ccn/Repos, plus the system defaults for other fields. This routine must be called after the btree code is initialized and capable of returning content objects. Sets the parsed_policy field of the handle to be the new policy.

PUBLIC struct ccnr_handle* r_init_create ( const char *  progname,
ccnr_logger  logger,
void *  loggerdata 
) [read]

Create a new ccnr instance.

Parameters:
progname - name of program binary, used for locating helpers
logger - logger function
loggerdata - data to pass to logger function

int r_init_parse_config ( struct ccnr_handle *  h,
struct ccn_charbuf *  config,
int  pass 
)

Parse the buffered configuration found in config.

The pass argument controls what is done with the result: 0 - silent check for syntax errors; 1 - check for syntax errors and warnings, logging the results, 2 - incorporate settings into environ.

Returns:
-1 if an error is found, otherwise the count of warnings.

struct ccn_charbuf* r_init_read_config ( struct ccnr_handle *  h  )  [read]

Read the contents of the repository config file.

Calls r_init_fail and returns NULL in case of error.

Returns:
unparsed content of config file in a newly allocated charbuf

static int try_tcp_instead ( int  fd  )  [static]

If so configured, replace fd with a tcp socket.

Returns:
new address family


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