ccnr_io.c File Reference

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

Go to the source code of this file.

Functions

PUBLIC struct fdholderr_io_fdholder_from_fd (struct ccnr_handle *h, unsigned filedesc)
 Looks up a fdholder based on its filedesc (private).
PUBLIC struct fdholderccnr_r_io_fdholder_from_fd (struct ccnr_handle *h, unsigned filedesc)
 Looks up a fdholder based on its filedesc.
PUBLIC int r_io_enroll_face (struct ccnr_handle *h, struct fdholder *fdholder)
 Assigns the filedesc for a nacent fdholder, calls r_io_register_new_face() if successful.
static void close_fd (int *pfd)
 Close an open file descriptor quietly.
void ccnr_close_fd (struct ccnr_handle *h, unsigned filedesc, int *pfd)
 Close an open file descriptor, and grumble about it.
static void init_face_flags (struct ccnr_handle *h, struct fdholder *fdholder, int setflags)
 Initialize the fdholder flags based upon the addr information and the provided explicit setflags.
PUBLIC struct fdholderr_io_record_fd (struct ccnr_handle *h, int fd, void *who, socklen_t wholen, int setflags)
 Make a new fdholder corresponding to the fd.
PUBLIC int r_io_accept_connection (struct ccnr_handle *h, int listener_fd)
 Accept an incoming DGRAM_STREAM connection, creating a new fdholder.
PUBLIC int r_io_open_repo_data_file (struct ccnr_handle *h, const char *name, int output)
PUBLIC int r_io_repo_data_file_fd (struct ccnr_handle *h, unsigned repofile, int output)
PUBLIC void r_io_shutdown_client_fd (struct ccnr_handle *h, int fd)
PUBLIC int r_io_destroy_face (struct ccnr_handle *h, unsigned filedesc)
 Destroys the fdholder identified by filedesc.
PUBLIC void r_io_register_new_face (struct ccnr_handle *h, struct fdholder *fdholder)
 Called when a fdholder is first created, and (perhaps) a second time in the case that a fdholder transitions from the undecided state.
static int handle_send_error (struct ccnr_handle *h, int errnum, struct fdholder *fdholder, const void *data, size_t size)
 Handle errors after send() or sendto().
static int sending_fd (struct ccnr_handle *h, struct fdholder *fdholder)
PUBLIC void r_io_send (struct ccnr_handle *h, struct fdholder *fdholder, const void *data, size_t size, off_t *offsetp)
 Send data to the fdholder.
PUBLIC void r_io_prepare_poll_fds (struct ccnr_handle *h)
 Set up the array of fd descriptors for the poll(2) call.
PUBLIC void r_io_shutdown_all (struct ccnr_handle *h)
 Shutdown all open fds.


Detailed Description

Part of ccnr - CCNx Repository Daemon.

Definition in file ccnr_io.c.


Function Documentation

void ccnr_close_fd ( struct ccnr_handle h,
unsigned  filedesc,
int *  pfd 
)

Close an open file descriptor, and grumble about it.

Definition at line 146 of file ccnr_io.c.

PUBLIC struct fdholder* ccnr_r_io_fdholder_from_fd ( struct ccnr_handle h,
unsigned  filedesc 
) [read]

Looks up a fdholder based on its filedesc.

Definition at line 86 of file ccnr_io.c.

Referenced by ccnr_collect_stats(), and post_face_notice().

static void close_fd ( int *  pfd  )  [static]

Close an open file descriptor quietly.

Definition at line 134 of file ccnr_io.c.

static int handle_send_error ( struct ccnr_handle h,
int  errnum,
struct fdholder fdholder,
const void *  data,
size_t  size 
) [static]

Handle errors after send() or sendto().

Returns:
-1 if error has been dealt with, or 0 to defer sending.

Definition at line 392 of file ccnr_io.c.

static void init_face_flags ( struct ccnr_handle h,
struct fdholder fdholder,
int  setflags 
) [static]

Initialize the fdholder flags based upon the addr information and the provided explicit setflags.

Definition at line 170 of file ccnr_io.c.

PUBLIC int r_io_accept_connection ( struct ccnr_handle h,
int  listener_fd 
)

Accept an incoming DGRAM_STREAM connection, creating a new fdholder.

Returns:
fd of new socket, or -1 for an error.

Definition at line 250 of file ccnr_io.c.

Referenced by r_dispatch_process_input().

PUBLIC int r_io_destroy_face ( struct ccnr_handle h,
unsigned  filedesc 
)

Destroys the fdholder identified by filedesc.

Returns:
0 for success, -1 for failure.

Definition at line 369 of file ccnr_io.c.

Referenced by ccnr_stats_handle_http_connection().

PUBLIC int r_io_enroll_face ( struct ccnr_handle h,
struct fdholder fdholder 
)

Assigns the filedesc for a nacent fdholder, calls r_io_register_new_face() if successful.

Definition at line 96 of file ccnr_io.c.

Referenced by r_init_create(), and r_io_record_fd().

PUBLIC struct fdholder* r_io_fdholder_from_fd ( struct ccnr_handle h,
unsigned  filedesc 
) [read]

PUBLIC int r_io_open_repo_data_file ( struct ccnr_handle h,
const char *  name,
int  output 
)

Definition at line 273 of file ccnr_io.c.

Referenced by r_init_map_and_process_file(), r_io_repo_data_file_fd(), and r_store_init().

PUBLIC void r_io_prepare_poll_fds ( struct ccnr_handle h  ) 

Set up the array of fd descriptors for the poll(2) call.

Definition at line 506 of file ccnr_io.c.

Referenced by r_dispatch_run().

PUBLIC struct fdholder* r_io_record_fd ( struct ccnr_handle h,
int  fd,
void *  who,
socklen_t  wholen,
int  setflags 
) [read]

Make a new fdholder corresponding to the fd.

Definition at line 214 of file ccnr_io.c.

Referenced by r_init_create(), r_io_accept_connection(), r_io_open_repo_data_file(), r_net_listen_on_address(), and r_net_listen_on_wildcards().

PUBLIC void r_io_register_new_face ( struct ccnr_handle h,
struct fdholder fdholder 
)

Called when a fdholder is first created, and (perhaps) a second time in the case that a fdholder transitions from the undecided state.

Definition at line 380 of file ccnr_io.c.

Referenced by process_input_message(), and r_io_enroll_face().

PUBLIC int r_io_repo_data_file_fd ( struct ccnr_handle h,
unsigned  repofile,
int  output 
)

Definition at line 312 of file ccnr_io.c.

Referenced by r_store_content_read().

PUBLIC void r_io_send ( struct ccnr_handle h,
struct fdholder fdholder,
const void *  data,
size_t  size,
off_t *  offsetp 
)

Send data to the fdholder.

No direct error result is provided; the fdholder state is updated as needed.

Definition at line 425 of file ccnr_io.c.

Referenced by ccnr_stats_handle_http_connection(), r_io_send(), r_link_stuff_and_send(), and send_http_response().

PUBLIC void r_io_shutdown_all ( struct ccnr_handle h  ) 

Shutdown all open fds.

Definition at line 546 of file ccnr_io.c.

Referenced by r_init_destroy().

PUBLIC void r_io_shutdown_client_fd ( struct ccnr_handle h,
int  fd 
)

static int sending_fd ( struct ccnr_handle h,
struct fdholder fdholder 
) [static]

Definition at line 414 of file ccnr_io.c.


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