no message

git-svn-id: http://voip.null.ro/svn/yate@289 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-04-12 11:54:33 +00:00
parent 2ecff79783
commit 423ff587b8
5 changed files with 59 additions and 8 deletions

View File

@ -120,6 +120,15 @@ bool Socket::checkError(int retcode)
}
}
bool Socket::canRetry() const
{
#ifdef _WINDOWS
return (m_error == WSAEWOULDBLOCK);
#else
return (m_error == EAGAIN) || (m_error == EINTR);
#endif
}
bool Socket::listen(unsigned int backlog)
{
if ((backlog == 0) || (backlog > SOMAXCONN))
@ -151,4 +160,25 @@ bool Socket::setTOS(int tos)
#endif
}
bool Socket::setBlocking(bool block)
{
unsigned long flags = 1;
#ifdef _WINDOWS
if (block)
flags = 0;
return checkError(::ioctlsocket(m_handle,FIONBIO,(unsigned long *) &flags));
#else
flags = ::fcntl(m_handle,F_GETFL);
if (flags < 0) {
copyError();
return false;
}
if (block)
flags &= !O_NONBLOCK;
else
flags |= O_NONBLOCK;
return checkError(fcntl(m_handle,F_SETFL,flags);
#endif
}
/* vi: set ts=8 sw=4 sts=4 noet: */

View File

@ -583,7 +583,6 @@ void IAXConnection::handleEvent(iax_event *event)
char buf[2];
buf[0] = event->subclass;
buf[1] = 0;
m->addParam("driver","iax");
m->addParam("text",buf);
m->addParam("callerid",event->session->callerid);
m->addParam("calledid",event->session->dnid);

View File

@ -23,27 +23,24 @@
*/
extern "C" {
#include <libpri.h>
#include <sys/socket.h>
#include <netinet/in.h>
extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req);
#define __LINUX__
#include <linux/if_wanpipe.h>
#include <linux/if.h>
#include <linux/wanpipe.h>
#include <linux/sdla_bitstrm.h>
extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req);
};
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <telengine.h>
#include <telephony.h>
#include <stdio.h>

View File

@ -306,6 +306,18 @@ Package=<4>
###############################################################################
Project: "_wpchan"=.\_wpchan.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "_ysipchan"=.\_ysipchan.dsp - Package Owner=<4>
Package=<5>

View File

@ -2265,6 +2265,12 @@ public:
inline int error() const
{ return m_error; }
/**
* Check if the last error code indicates a retryable condition
* @return True if error was temporary and operation should be retried
*/
bool canRetry() const;
/**
* Check if this socket is valid
* @return True if the handle is valid, false if it's invalid
@ -2302,6 +2308,13 @@ public:
* @return True if operation was successfull, false if an error occured
*/
bool setTOS(int tos);
/**
* Set the blocking or non-blocking operation mode of the socket
* @param block True if I/O operations should block, false for non-blocking
* @return True if operation was successfull, false if an error occured
*/
bool setBlocking(bool block = true);
/**
* Start listening for incoming connections on the socket