Go to the source code of this file.
Defines | |
#define | USAGE |
#define | PIT_LIMIT 10 |
Number of pending interests we will keep. | |
#define | CS_LIMIT 3 |
Number of generated data items we will hold. | |
#define | VER_LIMIT 5 |
Max number of received versions to track. | |
#define | FATAL(res) fatal(__LINE__, res) |
#define | DB(st, ccnb) debug_logger(st, __LINE__, ccnb) |
Functions | |
static enum ccn_upcall_res | incoming_interest (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info) |
Interest handler. | |
static enum ccn_upcall_res | incoming_content (struct ccn_closure *, enum ccn_upcall_kind, struct ccn_upcall_info *) |
static void | fatal (int lineno, int val) |
Print cryptic message and exit. | |
static void | initialize (struct ccnxchat_state *st, struct ccn_charbuf *basename) |
Initialization at startup. | |
struct ccn_charbuf * | adjust_regprefix (struct ccn_charbuf *name) |
Return a newly-allocated Name buffer with one Component chopped off. | |
static int | namecompare (const void *a, const void *b) |
Comparison operator for sorting the excl list with qsort. | |
static void | stampnow (struct ccn_charbuf *c) |
Append a numeric timestamp to a charbuf. | |
static void | seed_random (void) |
Seed the pseudo-random numbers. | |
static void | usage (void) |
Usage. | |
unsigned short | wrappednow (void) |
Wrapped time - (normally) 16-bit unsigned; millisecond units. | |
static int | wait_for_input_or_timeout (struct ccn *h, int fd) |
Wait until input on fd is ready or ccn_run needs to be called. | |
static void | read_input (struct ccnxchat_state *st) |
Read a line of standard input into payload. | |
static void | generate_new_data (struct ccnxchat_state *st) |
Collect some new data and when ready, place it in store. | |
static int | matchbox (struct ccnxchat_state *st) |
Match PIT entries against the store. | |
static int | send_matching_data (struct ccnxchat_state *st) |
Send data that has been matched. | |
static void | toss_in_cs (struct ccnxchat_state *st, const unsigned char *p, size_t size) |
Insert a ccnb-encoded ContentObject into our content store. | |
static void | toss_in_pit (struct ccnxchat_state *st, const unsigned char *p, struct ccn_parsed_interest *pi) |
Insert a ccnb-encoded Interest message into our pending interest table. | |
static void | age_cs (struct ccnxchat_state *st) |
Remove already-sent entries from the content store. | |
static void | age_pit (struct ccnxchat_state *st) |
Get rid of PIT entries that have timed out or been consumed. | |
static void | debug_logger (struct ccnxchat_state *st, int lineno, struct ccn_charbuf *ccnb) |
Debugging aid. | |
static int | append_interest_details (struct ccn_charbuf *c, const unsigned char *ccnb, size_t size) |
static void | generate_cob (struct ccnxchat_state *st) |
Generate a content object containing the current payload. | |
static void | add_info_exclusion (struct ccnxchat_state *, struct ccn_upcall_info *) |
static void | add_uri_exclusion (struct ccnxchat_state *, const char *) |
static void | add_ver_exclusion (struct ccnxchat_state *, struct ccn_charbuf **) |
static void | display_the_content (struct ccnxchat_state *, struct ccn_upcall_info *) |
static void | express_interest (struct ccnxchat_state *) |
static void | init_ver_exclusion (struct ccnxchat_state *) |
static void | prune_oldest_exclusion (struct ccnxchat_state *) |
static int | append_full_user_name (struct ccn_charbuf *) |
static int | chat_main (int argc, char **argv) |
Main entry point for chat. | |
static void | add_cob_exclusion (struct ccnxchat_state *st, struct ccn_charbuf *cob) |
static void | parseopts (int argc, char **argv) |
static int | robo_chat (int argc, char **argv) |
classic unix fork/exec to hook up an automatic responder | |
int | main (int argc, char **argv) |
Variables | |
static const char * | progname |
Global progam name for messages. | |
struct { | |
int debug | |
int echo | |
int freshness | |
int robotname | |
int quiet | |
int verbose | |
const char * basename | |
const char * responder | |
} | option |
Global option info. |
#define CS_LIMIT 3 |
Number of generated data items we will hold.
Definition at line 58 of file ccnc.c.
Referenced by generate_new_data(), and toss_in_cs().
#define DB | ( | st, | |||
ccnb | ) | debug_logger(st, __LINE__, ccnb) |
Definition at line 139 of file ccnc.c.
Referenced by adjust_regprefix(), age_cs(), age_pit(), display_the_content(), generate_cob(), incoming_content(), matchbox(), and toss_in_pit().
#define FATAL | ( | res | ) | fatal(__LINE__, res) |
Definition at line 136 of file ccnc.c.
Referenced by chat_main(), generate_cob(), send_matching_data(), toss_in_cs(), and toss_in_pit().
#define PIT_LIMIT 10 |
Number of pending interests we will keep.
Definition at line 49 of file ccnc.c.
Referenced by toss_in_pit().
#define USAGE |
"[-hdi:nqr:vx:] ccnx:/chat/room - community text chat" "\n" \ " -h - help" "\n" \ " -d - debug mode - no input editing" "\n" \ " -i n - print n bytes of signer's public key digest in hex" "\n" \ " -n - no echo of own output" "\n" \ " -q - no automatic greeting or farwell" "\n" \ " -r command - hook up to input and output of responder command" "\n" \ " -v - verbose trace of what is happening" "\n" \ " -x sec - set freshness"
Definition at line 31 of file ccnc.c.
Referenced by usage().
#define VER_LIMIT 5 |
Max number of received versions to track.
Definition at line 60 of file ccnc.c.
Referenced by add_ver_exclusion().
static void add_cob_exclusion | ( | struct ccnxchat_state * | st, | |
struct ccn_charbuf * | cob | |||
) | [static] |
Definition at line 401 of file ccnc.c.
Referenced by generate_new_data().
static void add_info_exclusion | ( | struct ccnxchat_state * | st, | |
struct ccn_upcall_info * | info | |||
) | [static] |
Definition at line 369 of file ccnc.c.
Referenced by incoming_content().
static void add_uri_exclusion | ( | struct ccnxchat_state * | st, | |
const char * | uri | |||
) | [static] |
Definition at line 391 of file ccnc.c.
Referenced by init_ver_exclusion().
static void add_ver_exclusion | ( | struct ccnxchat_state * | st, | |
struct ccn_charbuf ** | c | |||
) | [static] |
Definition at line 324 of file ccnc.c.
Referenced by add_cob_exclusion(), add_info_exclusion(), and add_uri_exclusion().
struct ccn_charbuf * adjust_regprefix | ( | struct ccn_charbuf * | name | ) | [read] |
static void age_cs | ( | struct ccnxchat_state * | st | ) | [static] |
Remove already-sent entries from the content store.
Definition at line 699 of file ccnc.c.
Referenced by chat_main().
static void age_pit | ( | struct ccnxchat_state * | st | ) | [static] |
Get rid of PIT entries that have timed out or been consumed.
Definition at line 722 of file ccnc.c.
Referenced by chat_main(), and toss_in_pit().
static int append_full_user_name | ( | struct ccn_charbuf * | c | ) | [static] |
Definition at line 1013 of file ccnc.c.
Referenced by chat_main().
static int append_interest_details | ( | struct ccn_charbuf * | c, | |
const unsigned char * | ccnb, | |||
size_t | size | |||
) | [static] |
Definition at line 950 of file ccnc.c.
Referenced by debug_logger().
static int chat_main | ( | int | argc, | |
char ** | argv | |||
) | [static] |
Main entry point for chat.
Definition at line 145 of file ccnc.c.
Referenced by main(), and robo_chat().
static void debug_logger | ( | struct ccnxchat_state * | st, | |
int | lineno, | |||
struct ccn_charbuf * | ccnb | |||
) | [static] |
Debugging aid.
Prints some internal state to stderr. If non-NULL, ccnb should be a ccnb-encoded Name, Interest, or ContentObject.
Definition at line 927 of file ccnc.c.
Referenced by chat_main().
static void display_the_content | ( | struct ccnxchat_state * | st, | |
struct ccn_upcall_info * | info | |||
) | [static] |
Definition at line 282 of file ccnc.c.
Referenced by incoming_content().
static void express_interest | ( | struct ccnxchat_state * | st | ) | [static] |
Definition at line 438 of file ccnc.c.
Referenced by chat_main().
static void fatal | ( | int | lineno, | |
int | val | |||
) | [static] |
static void generate_cob | ( | struct ccnxchat_state * | st | ) | [static] |
Generate a content object containing the current payload.
The standard versioning and segmentation profiles are used. It is assumed that the payload fits into one content object.
Definition at line 473 of file ccnc.c.
Referenced by generate_new_data().
static void generate_new_data | ( | struct ccnxchat_state * | st | ) | [static] |
Collect some new data and when ready, place it in store.
Definition at line 575 of file ccnc.c.
Referenced by chat_main(), and incoming_interest().
static enum ccn_upcall_res incoming_content | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) | [static] |
static enum ccn_upcall_res incoming_interest | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) | [static] |
static void init_ver_exclusion | ( | struct ccnxchat_state * | st | ) | [static] |
Definition at line 431 of file ccnc.c.
Referenced by chat_main().
static void initialize | ( | struct ccnxchat_state * | st, | |
struct ccn_charbuf * | basename | |||
) | [static] |
Initialization at startup.
If there is a command line argument, it is interpreted as a URI relative to basename, and basename is updated accordingly.
basename is a Name in ccnb encoding.
Definition at line 840 of file ccnc.c.
Referenced by chat_main().
static int matchbox | ( | struct ccnxchat_state * | st | ) | [static] |
Match PIT entries against the store.
This implementation relies on both tables being relatively small, since it can look at all n x m combinations.
Definition at line 645 of file ccnc.c.
Referenced by chat_main(), and incoming_interest().
static int namecompare | ( | const void * | a, | |
const void * | b | |||
) | [static] |
Comparison operator for sorting the excl list with qsort.
For convenience, the items in the excl array are charbufs containing ccnb-encoded Names of one component each. (This is not the most efficient representation.)
Definition at line 760 of file ccnc.c.
Referenced by add_ver_exclusion().
static void parseopts | ( | int | argc, | |
char ** | argv | |||
) | [static] |
static void prune_oldest_exclusion | ( | struct ccnxchat_state * | st | ) | [static] |
Definition at line 356 of file ccnc.c.
Referenced by incoming_content().
static void read_input | ( | struct ccnxchat_state * | st | ) | [static] |
Read a line of standard input into payload.
Definition at line 530 of file ccnc.c.
Referenced by chat_main().
static int robo_chat | ( | int | argc, | |
char ** | argv | |||
) | [static] |
static void seed_random | ( | void | ) | [static] |
static int send_matching_data | ( | struct ccnxchat_state * | st | ) | [static] |
static void stampnow | ( | struct ccn_charbuf * | c | ) | [static] |
Append a numeric timestamp to a charbuf.
Definition at line 886 of file ccnc.c.
Referenced by debug_logger().
static void toss_in_cs | ( | struct ccnxchat_state * | st, | |
const unsigned char * | p, | |||
size_t | size | |||
) | [static] |
Insert a ccnb-encoded ContentObject into our content store.
Definition at line 591 of file ccnc.c.
Referenced by generate_new_data().
static void toss_in_pit | ( | struct ccnxchat_state * | st, | |
const unsigned char * | p, | |||
struct ccn_parsed_interest * | pi | |||
) | [static] |
Insert a ccnb-encoded Interest message into our pending interest table.
Definition at line 606 of file ccnc.c.
Referenced by incoming_interest().
static int wait_for_input_or_timeout | ( | struct ccn * | h, | |
int | fd | |||
) | [static] |
Wait until input on fd is ready or ccn_run needs to be called.
Definition at line 501 of file ccnc.c.
Referenced by chat_main().
unsigned short wrappednow | ( | void | ) |
Wrapped time - (normally) 16-bit unsigned; millisecond units.
Definition at line 900 of file ccnc.c.
Referenced by age_pit(), debug_logger(), and toss_in_pit().
const char* basename |
Definition at line 780 of file ccnc.c.
Referenced by load_policy(), and process_file().
int debug |
Definition at line 774 of file ccnc.c.
Referenced by addNameFromCompare(), AddSegRequest(), AddUpdateName(), CallMe(), ccn_fetch_close(), ccn_fetch_open(), ccn_fetch_read(), ccns_root_advise_response(), ccns_send_root_advise_interest(), CompareAction(), findAndDeleteRoot(), HeartbeatAction(), ie_next_usec(), MakeNodeFromNames(), NeedSegment(), newNodeCommon(), nodeFromNodes(), noteHash(), noteRemoteHash(), RemSegRequest(), SendDeltasReply(), SyncAddName(), SyncHandleSlice(), SyncInterestArrived(), SyncNotifyContent(), SyncRegisterInterest(), SyncRemoteFetchResponse(), SyncRootAdviseResponse(), SyncSendRootAdviseInterest(), SyncShutdown(), SyncStartCompareAction(), SyncStartContentFetch(), SyncStartHeartbeat(), SyncStartNodeFetch(), SyncStartSliceEnum(), SyncTreeMergeNames(), TryNodeSplit(), and UpdateAction().
struct { ... } option [static] |
Global option info.
Referenced by initialize(), main(), parseopts(), and robo_chat().
const char* progname [static] |