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

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

#include <errno.h>
#include <fcntl.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/time.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <netinet/in.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 "ccnr_private.h"
#include "ccnr_io.h"
#include "ccnr_forwarding.h"
#include "ccnr_internal_client.h"
#include "ccnr_link.h"
#include "ccnr_msg.h"
#include "ccnr_sendq.h"
#include "ccnr_stats.h"

Functions

PUBLIC struct fdholder * r_io_fdholder_from_fd (struct ccnr_handle *h, unsigned filedesc)
 Looks up a fdholder based on its filedesc (private).
PUBLIC struct fdholder * ccnr_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 fdholder * r_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.


Function Documentation

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.

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.

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.

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.


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