OpenSS7 SS7 for the Common Man |
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |
||||||||||||||||||||||||||
Home | Overview | Status | News | Documentation | Resources | About | |||||||||||||||||||||
File /code/strss7/lib/libxnet/t_getmsg.c#ident "@(#) $RCSfile: t_getmsg.c,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2003/05/27 11:21:51 $" static char const ident[] = "$RCSfile: t_getmsg.c,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2003/05/27 11:21:51 $"; #include <unistd.h> #include <errno.h> #include <sys/stropts.h> #include <sys/poll.h> #include <sys/xti.h> #include <sys/tpi.h> #include "xti.h" /* * T_GETMSG - a version of getmsg with XTI errors */ int t_getmsg(int fd, struct strbuf *ctrl, struct strbuf *data, int *flags) { struct pollfd pfd; if (!flags) goto tproto; pfd.fd = fd; pfd.events = POLLIN | POLLRDNORM | POLLRDBAND | POLLMSG | POLLPRI; pfd.revents = 0; if (poll(&pfd, 1, -1) >= 0) { if (pfd.revents & (POLLNVAL | POLLERR | POLLHUP)) goto tproto; if (getmsg(fd, ctrl, data, flags) == 0) { struct T_error_ack *err; if (ctrl && ctrl->buf && ctrl->maxlen > sizeof(*err)) { err = (typeof(err)) ctrl->buf; if (err->PRIM_type == T_ERROR_ACK) { t_errno = err->TLI_error; if (t_errno == TSYSERR) errno = err->UNIX_error; goto error; } } return (0); } switch (errno) { case EISDIR: case EBADF: case ENODEV: case EIO: case EINVAL: case ENOSTR: goto tbadf; case EBADMSG: goto tproto; case EFAULT: case EAGAIN: case EINTR: goto tsyserr; } goto tsyserr; } switch (errno) { case EBADF: goto tbadf; case EINVAL: goto tproto; case ENOMEM: case EFAULT: case EINTR: goto tsyserr; } goto tsyserr; tbadf: t_errno = TBADF; goto error; tproto: t_errno = TPROTO; goto error; tsyserr: t_errno = TSYSERR; goto error; error: return (-1); }
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |