[Asterisk-cvs] asterisk/channels Makefile, 1.65, 1.66 chan_mgcp.c,
1.95, 1.96 chan_modem.c, 1.32, 1.33 chan_zap.c, 1.388,
1.389 iax2-parser.c, 1.30, 1.31
markster at lists.digium.com
markster at lists.digium.com
Tue Dec 14 18:39:44 CST 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25047/channels
Modified Files:
Makefile chan_mgcp.c chan_modem.c chan_zap.c iax2-parser.c
Log Message:
Merge slimey's Solaris compatibility (with small mods) (bug #2740)
Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/Makefile,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- Makefile 6 Nov 2004 21:33:01 -0000 1.65
+++ Makefile 14 Dec 2004 23:36:29 -0000 1.66
@@ -19,7 +19,7 @@
CHANNEL_LIBS=chan_modem.so chan_sip.so \
chan_modem_aopen.so \
- chan_modem_bestdata.so chan_modem_i4l.so \
+ chan_modem_bestdata.so \
chan_agent.so chan_mgcp.so chan_iax2.so \
chan_local.so chan_skinny.so chan_features.so
@@ -52,7 +52,13 @@
SOLINK+=-L/usr/local/lib
endif
ifneq (${OSARCH},Darwin)
-CHANNEL_LIBS+=chan_oss.so
+ifneq (${OSARCH},SunOS)
+CHANNEL_LIBS+=chan_oss.so chan_modem_i4l.so
+endif
+endif
+
+ifeq (${OSARCH},SunOS)
+SOLINK+=-lrt
endif
CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- chan_mgcp.c 17 Nov 2004 19:11:33 -0000 1.95
+++ chan_mgcp.c 14 Dec 2004 23:36:29 -0000 1.96
@@ -105,6 +105,10 @@
#define MAX_EXPIREY 3600
#define CANREINVITE 1
+#ifndef INADDR_NONE
+#define INADDR_NONE (in_addr_t)(-1)
+#endif
+
static char *desc = "Media Gateway Control Protocol (MGCP)";
static char *type = "MGCP";
static char *tdesc = "Media Gateway Control Protocol (MGCP)";
Index: chan_modem.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- chan_modem.c 26 Oct 2004 22:25:43 -0000 1.32
+++ chan_modem.c 14 Dec 2004 23:36:29 -0000 1.33
@@ -709,8 +709,19 @@
ast_log(LOG_WARNING, "Unable to get serial parameters on %s: %s\n", p->dev, strerror(errno));
return;
}
+#ifndef SOLARIS
cfmakeraw(&mode);
- cfsetspeed(&mode, B115200);
+#else
+ mode.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
+ |INLCR|IGNCR|ICRNL|IXON);
+ mode.c_oflag &= ~OPOST;
+ mode.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ mode.c_cflag &= ~(CSIZE|PARENB);
+ mode.c_cflag |= CS8;
+#endif
+
+ cfsetispeed(&mode, B115200);
+ cfsetospeed(&mode, B115200);
if (tcsetattr(p->fd, TCSANOW, &mode))
ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", p->dev, strerror(errno));
Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.388
retrieving revision 1.389
diff -u -d -r1.388 -r1.389
--- chan_zap.c 13 Dec 2004 15:11:36 -0000 1.388
+++ chan_zap.c 14 Dec 2004 23:36:29 -0000 1.389
@@ -42,7 +42,9 @@
#include <sys/signal.h>
#include <errno.h>
#include <stdlib.h>
+#ifndef SOLARIS
#include <stdint.h>
+#endif
#include <unistd.h>
#include <sys/ioctl.h>
#ifdef __linux__
Index: iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- iax2-parser.c 19 Nov 2004 21:52:25 -0000 1.30
+++ iax2-parser.c 14 Dec 2004 23:36:29 -0000 1.31
@@ -30,6 +30,22 @@
static int iframes = 0;
static int oframes = 0;
+#ifdef SOLARIS
+static unsigned int get_uint32(unsigned char *p)
+{
+ return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+}
+
+static unsigned short get_uint16(unsigned char *p)
+{
+ return (p[0] << 8) | p[1] ;
+}
+
+#else
+#define get_uint32(p) (*((unsigned int *)(p)))
+#define get_uint16(p) (*((unsigned short *)(p)))
+#endif
+
static void internaloutput(const char *str)
{
fputs(str, stdout);
@@ -67,7 +83,7 @@
static void dump_int(char *output, int maxlen, void *value, int len)
{
if (len == (int)sizeof(unsigned int))
- snprintf(output, maxlen, "%lu", (unsigned long)ntohl(*((unsigned int *)value)));
+ snprintf(output, maxlen, "%lu", (unsigned long)ntohl(get_uint32(value)));
else
snprintf(output, maxlen, "Invalid INT");
}
@@ -75,7 +91,7 @@
static void dump_short(char *output, int maxlen, void *value, int len)
{
if (len == (int)sizeof(unsigned short))
- snprintf(output, maxlen, "%d", ntohs(*((unsigned short *)value)));
+ snprintf(output, maxlen, "%d", ntohs(get_uint16(value)));
else
snprintf(output, maxlen, "Invalid SHORT");
}
@@ -105,8 +121,8 @@
{
char buf[256] = "";
if (len == (int)sizeof(unsigned int))
- snprintf(output, maxlen, "%lu (%s)", (unsigned long)ntohl(*((unsigned int *)value)),
- iax_provflags2str(buf, sizeof(buf), ntohl(*((unsigned int *)value))));
+ snprintf(output, maxlen, "%lu (%s)", (unsigned long)ntohl(get_uint32(value)),
+ iax_provflags2str(buf, sizeof(buf), ntohl(get_uint32(value))));
else
snprintf(output, maxlen, "Invalid INT");
}
@@ -550,14 +566,14 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
} else
- ies->capability = ntohl(*((unsigned int *)(data + 2)));
+ ies->capability = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FORMAT:
if (len != (int)sizeof(unsigned int)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
} else
- ies->format = ntohl(*((unsigned int *)(data + 2)));
+ ies->format = ntohl(get_uint32(data + 2));
break;
case IAX_IE_LANGUAGE:
ies->language = data + 2;
@@ -567,21 +583,21 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting version to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->version = ntohs(*((unsigned short *)(data + 2)));
+ ies->version = ntohs(get_uint16(data + 2));
break;
case IAX_IE_ADSICPE:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->adsicpe = ntohs(*((unsigned short *)(data + 2)));
+ ies->adsicpe = ntohs(get_uint16(data + 2));
break;
case IAX_IE_SAMPLINGRATE:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->samprate = ntohs(*((unsigned short *)(data + 2)));
+ ies->samprate = ntohs(get_uint16(data + 2));
break;
case IAX_IE_DNID:
ies->dnid = data + 2;
@@ -594,7 +610,7 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->authmethods = ntohs(*((unsigned short *)(data + 2)));
+ ies->authmethods = ntohs(get_uint16(data + 2));
break;
case IAX_IE_CHALLENGE:
ies->challenge = data + 2;
@@ -613,21 +629,21 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting refresh to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->refresh = ntohs(*((unsigned short *)(data + 2)));
+ ies->refresh = ntohs(get_uint16(data + 2));
break;
case IAX_IE_DPSTATUS:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting dpstatus to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->dpstatus = ntohs(*((unsigned short *)(data + 2)));
+ ies->dpstatus = ntohs(get_uint16(data + 2));
break;
case IAX_IE_CALLNO:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting callno to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->callno = ntohs(*((unsigned short *)(data + 2)));
+ ies->callno = ntohs(get_uint16(data + 2));
break;
case IAX_IE_CAUSE:
ies->cause = data + 2;
@@ -645,7 +661,7 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->msgcount = ntohs(*((unsigned short *)(data + 2)));
+ ies->msgcount = ntohs(get_uint16(data + 2));
break;
case IAX_IE_AUTOANSWER:
ies->autoanswer = 1;
@@ -658,21 +674,21 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
} else
- ies->transferid = ntohl(*((unsigned int *)(data + 2)));
+ ies->transferid = ntohl(get_uint32(data + 2));
break;
case IAX_IE_DATETIME:
if (len != (int)sizeof(unsigned int)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
} else
- ies->datetime = ntohl(*((unsigned int *)(data + 2)));
+ ies->datetime = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FIRMWAREVER:
if (len != (int)sizeof(unsigned short)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->firmwarever = ntohs(*((unsigned short *)(data + 2)));
+ ies->firmwarever = ntohs(get_uint16(data + 2));
break;
case IAX_IE_DEVICETYPE:
ies->devicetype = data + 2;
@@ -685,7 +701,7 @@
snprintf(tmp, (int)sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
} else
- ies->fwdesc = ntohl(*((unsigned int *)(data + 2)));
+ ies->fwdesc = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FWBLOCKDATA:
ies->fwdata = data + 2;
@@ -697,7 +713,7 @@
errorf(tmp);
} else {
ies->provverpres = 1;
- ies->provver = ntohl(*((unsigned int *)(data + 2)));
+ ies->provver = ntohl(get_uint32(data + 2));
}
break;
case IAX_IE_CALLINGPRES:
@@ -721,7 +737,7 @@
snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
errorf(tmp);
} else
- ies->calling_tns = ntohs(*((unsigned short *)(data + 2)));
+ ies->calling_tns = ntohs(get_uint16(data + 2));
break;
default:
snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
More information about the svn-commits
mailing list