tsend.c File Reference

#include <string.h>
#include <errno.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include "dprint.h"

Include dependency graph for tsend.c:

Go to the source code of this file.

Defines

#define TSEND_ERR_CHECK(f_name)
#define TSEND_INIT
#define TSEND_POLL(f_name)

Functions

int tsend_dgram (int fd, char *buf, unsigned int len, const struct sockaddr *to, socklen_t tolen, int timeout)
 sends on dgram fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR
int tsend_dgram_ev (int fd, const struct iovec *v, int count, int timeout)
 sends on connected datagram fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR
int tsend_stream (int fd, char *buf, unsigned int len, int timeout)
 sends on fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR


Define Documentation

#define TSEND_ERR_CHECK ( f_name   ) 

Definition at line 74 of file tsend.c.

Referenced by tsend_dgram(), tsend_dgram_ev(), and tsend_stream().

#define TSEND_INIT

Value:

int n; \
   struct pollfd pf; \
   pf.fd=fd; \
   pf.events=POLLOUT

Definition at line 42 of file tsend.c.

Referenced by tsend_dgram(), tsend_dgram_ev(), and tsend_stream().

#define TSEND_POLL ( f_name   ) 

Definition at line 48 of file tsend.c.

Referenced by tsend_dgram(), tsend_dgram_ev(), and tsend_stream().


Function Documentation

int tsend_dgram ( int  fd,
char *  buf,
unsigned int  len,
const struct sockaddr *  to,
socklen_t  tolen,
int  timeout 
)

sends on dgram fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR

Returns:
-1 on error, or number of bytes written (if less than len => couldn't send all) bugs: signals will reset the timer

Definition at line 129 of file tsend.c.

References TSEND_ERR_CHECK, TSEND_INIT, and TSEND_POLL.

int tsend_dgram_ev ( int  fd,
const struct iovec *  v,
int  count,
int  timeout 
)

sends on connected datagram fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR

Returns:
-1 on error, or number of bytes written (if less than len => couldn't send all) bugs: signals will reset the timer

Definition at line 151 of file tsend.c.

References TSEND_ERR_CHECK, TSEND_INIT, and TSEND_POLL.

Referenced by write_to_unixsock().

int tsend_stream ( int  fd,
char *  buf,
unsigned int  len,
int  timeout 
)

sends on fd (which must be O_NONBLOCK); if it cannot send any data in timeout milliseconds it will return ERROR

Returns:
-1 on error, or number of bytes written (if less than len => couldn't send all) bugs: signals will reset the timer

Definition at line 92 of file tsend.c.

References MSG_NOSIGNAL, TSEND_ERR_CHECK, TSEND_INIT, and TSEND_POLL.


Generated on Thu May 24 20:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6