ccnr_init.c File Reference

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

Go to the source code of this file.

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_charbufr_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_policyccnr_parsed_policy_create (void)
PUBLIC void ccnr_parsed_policy_destroy (struct ccnr_parsed_policy **ppp)
PUBLIC struct ccnr_handler_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_charbufccnr_init_policy_cob (struct ccnr_handle *ccnr, struct ccn *h, struct ccn_charbuf *basename, int freshness, struct ccn_charbuf *content)
PUBLIC struct ccn_charbufccnr_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.

Definition in file ccnr_init.c.


Define Documentation

#define CCNR_CONFIG_ERR   0x200

Definition at line 184 of file ccnr_init.c.

Referenced by r_init_config_msg(), and r_init_parse_config().

#define CCNR_CONFIG_IGNORELINE   0x100

Definition at line 183 of file ccnr_init.c.

Referenced by r_init_config_msg(), and r_init_parse_config().

#define CCNR_CONFIG_PASSMASK   0x003

Definition at line 182 of file ccnr_init.c.

Referenced by r_init_config_msg().


Function Documentation

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 
) [static, read]

Definition at line 774 of file ccnr_init.c.

Referenced by load_policy().

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

Definition at line 817 of file ccnr_init.c.

Referenced by load_policy(), and r_proto_policy_update().

PUBLIC struct ccnr_parsed_policy* ccnr_parsed_policy_create ( void   )  [read]

Definition at line 428 of file ccnr_init.c.

Referenced by load_policy(), and r_proto_policy_update().

PUBLIC void ccnr_parsed_policy_destroy ( struct ccnr_parsed_policy **  ppp  ) 

Definition at line 438 of file ccnr_init.c.

Referenced by r_proto_policy_update().

static int establish_min_send_bufsize ( struct ccnr_handle h,
int  fd,
int  minsize 
) [static]

Definition at line 360 of file ccnr_init.c.

Referenced by r_init_create().

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.

Definition at line 874 of file ccnr_init.c.

Referenced by r_init_create().

static int merge_files ( struct ccnr_handle h  )  [static]

Definition at line 732 of file ccnr_init.c.

Referenced by r_init_create().

static void r_init_config_msg ( struct ccnr_handle h,
int  flags,
int  line,
int  chindex,
const char *  msg 
) [static]

Message helper for r_init_parse_config().

Definition at line 189 of file ccnr_init.c.

Referenced by r_init_parse_config().

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.

Definition at line 157 of file ccnr_init.c.

Referenced by r_init_create(), and r_store_init().

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

Definition at line 458 of file ccnr_init.c.

Referenced by main(), and start_ccnr().

static int r_init_debug_getenv ( struct ccnr_handle h,
const char *  envname 
) [static]

Definition at line 135 of file ccnr_init.c.

Referenced by r_init_create(), and r_init_parse_config().

PUBLIC void r_init_destroy ( struct ccnr_handle **  pccnr  ) 

Destroy the ccnr instance, releasing all associated resources.

Definition at line 618 of file ccnr_init.c.

Referenced by main(), r_init_create(), and start_ccnr().

void r_init_fail ( struct ccnr_handle ccnr,
int  line,
const char *  culprit,
int  err 
)

Definition at line 607 of file ccnr_init.c.

Referenced by load_policy(), r_init_create(), r_init_read_config(), and r_store_init().

int r_init_map_and_process_file ( struct ccnr_handle h,
struct ccn_charbuf filename,
int  add_content 
)

Definition at line 668 of file ccnr_init.c.

Referenced by merge_files(), and r_proto_bulk_import().

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.

Definition at line 218 of file ccnr_init.c.

Referenced by r_init_create().

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

Definition at line 87 of file ccnr_init.c.

Referenced by r_init_create().

static int try_tcp_instead ( int  fd  )  [static]

If so configured, replace fd with a tcp socket.

Returns:
new address family

Definition at line 388 of file ccnr_init.c.

Referenced by r_init_create().


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