[Asterisk-cvs] asterisk strcompat.c, NONE, 1.1 CREDITS, 1.28, 1.29 Makefile, 1.124, 1.125 acl.c, 1.30, 1.31 aesopt.h, 1.7, 1.8 ast_expr.y, 1.11, 1.12 asterisk.c, 1.130, 1.131 cli.c, 1.65, 1.66 logger.c, 1.51, 1.52 md5.c, 1.8, 1.9 mkdep, 1.4, 1.5 mkpkgconfig, 1.2, 1.3 rtp.c, 1.100, 1.101 say.c, 1.43, 1.44 utils.c, 1.22, 1.23

markster at lists.digium.com markster at lists.digium.com
Tue Dec 14 18:39:43 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv25047

Modified Files:
	CREDITS Makefile acl.c aesopt.h ast_expr.y asterisk.c cli.c 
	logger.c md5.c mkdep mkpkgconfig rtp.c say.c utils.c 
Added Files:
	strcompat.c 
Log Message:
Merge slimey's Solaris compatibility (with small mods) (bug #2740)


--- NEW FILE: strcompat.c ---
/* Compatibility functions for strsep and strtoq missing on Solaris */

#include <sys/types.h>
#include <stdio.h>

char* strsep(char** str, const char* delims)
{
    char* token;

    if (*str==NULL) {
        /* No more tokens */
        return NULL;
    }

    token=*str;
    while (**str!='\0') {
        if (strchr(delims,**str)!=NULL) {
            **str='\0';
            (*str)++;
            return token;
        }
        (*str)++;
    }
    /* There is no other token */
    *str=NULL;
    return token;
}


#define LONG_MIN        (-9223372036854775807L-1L)
                                        /* min value of a "long int" */
#define LONG_MAX        9223372036854775807L
                                        /* max value of a "long int" */

/*
 * Convert a string to a quad integer.
 *
 * Ignores `locale' stuff.  Assumes that the upper and lower case
 * alphabets and digits are each contiguous.
 */
uint64_t
strtoq(const char *nptr, char **endptr, int base)
{
        const char *s;
        uint64_t acc;
        unsigned char c;
        uint64_t qbase, cutoff;
        int neg, any, cutlim;

        /*
         * Skip white space and pick up leading +/- sign if any.
         * If base is 0, allow 0x for hex and 0 for octal, else
         * assume decimal; if base is already 16, allow 0x.
         */
        s = nptr;
        do {
                c = *s++;
        } while (isspace(c));
        if (c == '-') {
                neg = 1;
                c = *s++;
        } else {
                neg = 0;
                if (c == '+')
                        c = *s++;
        }
        if ((base == 0 || base == 16) &&
            c == '\0' && (*s == 'x' || *s == 'X')) {
                c = s[1];
                s += 2;
                base = 16;
        }
        if (base == 0)
                base = c == '\0' ? 8 : 10;

        /*
         * Compute the cutoff value between legal numbers and illegal
         * numbers.  That is the largest legal value, divided by the
         * base.  An input number that is greater than this value, if
         * followed by a legal input character, is too big.  One that
         * is equal to this value may be valid or not; the limit
         * between valid and invalid numbers is then based on the last
         * digit.  For instance, if the range for quads is
         * [-9223372036854775808..9223372036854775807] and the input base
         * is 10, cutoff will be set to 922337203685477580 and cutlim to
         * either 7 (neg==0) or 8 (neg==1), meaning that if we have
         * accumulated a value > 922337203685477580, or equal but the
         * next digit is > 7 (or 8), the number is too big, and we will
         * return a range error.
         *
         * Set any if any `digits' consumed; make it negative to indicate
         * overflow.
         */
        qbase = (unsigned)base;
        cutoff = neg ? (uint64_t)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX;
        cutlim = cutoff % qbase;
        cutoff /= qbase;
        for (acc = 0, any = 0;; c = *s++) {
                if (!isascii(c))
                        break;
                if (isdigit(c))
                        c -= '\0';
                else if (isalpha(c))
                        c -= isupper(c) ? 'A' - 10 : 'a' - 10;
                else
                        break;
                if (c >= base)
                        break;
                if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
                        any = -1;
                else {
                        any = 1;
                        acc *= qbase;
                        acc += c;
                }
        }
        if (any < 0) {
                acc = neg ? LONG_MIN : LONG_MAX;
        } else if (neg)
                acc = -acc;
        if (endptr != 0)
                *((const char **)endptr) = any ? s - 1 : nptr;
        return (acc);
}

int setenv(const char *name, const char *value, int overwrite)
{
	unsigned char *buf;
	int buflen, ret;

	buflen = strlen(name) + strlen(value) + 2;
	if ((buf = malloc(buflen)) == NULL)
 		return -1;

	if (!overwrite && getenv(name))
		return 0;

	snprintf(buf, buflen, "%s=%s", name, value);
	ret = putenv(buf);

	free(buf);

	return ret;
}

Index: CREDITS
===================================================================
RCS file: /usr/cvsroot/asterisk/CREDITS,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- CREDITS	16 Oct 2004 22:34:57 -0000	1.28
+++ CREDITS	14 Dec 2004 23:36:29 -0000	1.29
@@ -64,6 +64,8 @@
 William Waites - syslog support, SIP NAT traversal for SIP-UA. ww at styx.org
 Rich Murphey - Porting to FreeBSD, NetBSD, OpenBSD, and Darwin.
 	rich at whiteoaklabs.com  http://whiteoaklabs.com
+Simon Lockhart - Porting to Solaris (based on work of Logan ???)	
+	simon at slimey.org
 
 === OTHER CONTRIBUTIONS ===
 John Todd - Monkey sounds and associated teletorture prompt

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- Makefile	11 Dec 2004 22:36:27 -0000	1.124
+++ Makefile	14 Dec 2004 23:36:29 -0000	1.125
@@ -55,6 +55,12 @@
 
 PWD=$(shell pwd)
 
+GREP=grep
+ifeq (${OSARCH},SunOS)
+GREP=/usr/xpg4/bin/grep
+M4=/usr/local/bin/m4
+endif
+
 ######### More GSM codec optimization
 ######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
 ######### which support MMX instructions.  This should be newer pentiums,
@@ -136,7 +142,7 @@
 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
 endif
 
-CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
+CFLAGS+=$(shell if uname -m | $(GREP) -q ppc; then echo "-fsigned-char"; fi)
 CFLAGS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "-DOSP_SUPPORT -I/usr/include/osp" ; fi)
 
 ifeq (${OSARCH},FreeBSD)
@@ -155,6 +161,10 @@
 ifeq (${OSARCH},OpenBSD)
 CFLAGS+=-pthread
 endif
+ifeq (${OSARCH},SunOS)
+CFLAGS+=-Wcast-align -DSOLARIS
+INCLUDE+=-Iinclude/solaris-compat -I/usr/local/ssl/include
+endif
 
 #Uncomment this to use the older DSP routines
 #CFLAGS+=-DOLD_DSP_ROUTINES
@@ -207,6 +217,9 @@
 ifeq (${OSARCH},OpenBSD)
 LIBS=-lcrypto -lpthread -lm -lncurses
 endif
+ifeq (${OSARCH},SunOS)
+LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L/usr/local/ssl/lib
+endif
 LIBS+=-lssl
 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
 	translate.o file.o say.o pbx.o cli.o md5.o term.o \
@@ -223,6 +236,11 @@
 ASTLINK=-Wl,-E 
 SOLINK=-shared -Xlinker -x
 endif
+ifeq (${OSARCH},SunOS)
+OBJS+=strcompat.o
+ASTLINK=
+SOLINK=-shared -fpic -L/usr/local/ssl/lib
+endif
 
 CC=gcc
 INSTALL=install
@@ -260,7 +278,7 @@
 .PHONY: _version
 
 _version: 
-	if [ -d CVS ] && ! [ -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
+	if [ -d CVS ] && [ ! -f .version ]; then echo $(ASTERISKVERSION) > .version; fi 
 
 .version: _version
 
@@ -311,7 +329,7 @@
 	rm -f *.o *.so asterisk .depend
 	rm -f build.h 
 	rm -f ast_expr.c
-	@if [ -e editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
+	@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
 	@if [ -d mpg123-0.59r ]; then make -C mpg123-0.59r clean; fi
 	$(MAKE) -C db1-ast clean
 	$(MAKE) -C stdtime clean
@@ -320,7 +338,7 @@
 	sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
 	for x in sounds/digits/*.gsm; do \
-		if grep -q "^%`basename $$x`%" sounds.txt; then \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
 		else \
 			echo "No description for $$x"; \
@@ -329,7 +347,7 @@
 	done
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
 	for x in sounds/letters/*.gsm; do \
-		if grep -q "^%`basename $$x`%" sounds.txt; then \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
 		else \
 			echo "No description for $$x"; \
@@ -338,7 +356,7 @@
 	done
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
 	for x in sounds/phonetic/*.gsm; do \
-		if grep -q "^%`basename $$x`%" sounds.txt; then \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
 		else \
 			echo "No description for $$x"; \
@@ -346,7 +364,7 @@
 		fi; \
 	done
 	for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-*; do \
-		if grep -q "^%`basename $$x`%" sounds.txt; then \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
@@ -476,7 +494,7 @@
 		echo "Skipping asterisk.conf creation"; \
 	fi
 	for x in sounds/demo-*; do \
-		if grep -q "^%`basename $$x`%" sounds.txt; then \
+		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \

Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- acl.c	3 Dec 2004 23:34:44 -0000	1.30
+++ acl.c	14 Dec 2004 23:36:29 -0000	1.31
@@ -38,6 +38,11 @@
 AST_MUTEX_DEFINE_STATIC(routeseq_lock);
 #endif
 
+#if defined (SOLARIS)
+#include <sys/sockio.h>
+#endif
+
+
 
 struct ast_ha {
 	/* Host access rule */

Index: aesopt.h
===================================================================
RCS file: /usr/cvsroot/asterisk/aesopt.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- aesopt.h	31 Aug 2004 13:32:11 -0000	1.7
+++ aesopt.h	14 Dec 2004 23:36:29 -0000	1.8
@@ -156,6 +156,8 @@
 #  include <sys/endian.h>
 #elif defined( BSD ) && ( BSD >= 199103 ) || defined(__APPLE__)
 #  include <machine/endian.h>
+#elif defined ( SOLARIS )
+#  include <solaris-compat/compat.h>
 #elif defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
 #  include <endian.h>
 #if !defined(__APPLE__)

Index: ast_expr.y
===================================================================
RCS file: /usr/cvsroot/asterisk/ast_expr.y,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ast_expr.y	10 Dec 2004 23:01:48 -0000	1.11
+++ ast_expr.y	14 Dec 2004 23:36:29 -0000	1.12
@@ -13,7 +13,11 @@
 #include <string.h>
 #include <locale.h>
 #include <ctype.h>
+#ifndef SOLARIS
 #include <err.h>
+#else
+typedef uint64_t quad_t;
+#endif
 #include <errno.h>
 #include <regex.h>
 #include <limits.h>
@@ -39,6 +43,10 @@
 
 /* #define ast_log fprintf
 #define LOG_WARNING stderr */
+
+#ifdef SOLARIS
+#define __P(p) p
+#endif
   
 enum valtype {
 	integer, numeric_string, string

Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- asterisk.c	11 Nov 2004 14:43:18 -0000	1.130
+++ asterisk.c	14 Dec 2004 23:36:29 -0000	1.131
@@ -53,10 +53,15 @@
 #include <grp.h>
 #include <pwd.h>
 
-#if  defined(__FreeBSD__) || defined( __NetBSD__ )
+#if  defined(__FreeBSD__) || defined( __NetBSD__ ) || defined(SOLARIS)
 #include <netdb.h>
 #endif
 
+#ifndef AF_LOCAL
+#define AF_LOCAL AF_UNIX
+#define PF_LOCAL PF_UNIX
+#endif
+
 #define AST_MAX_CONNECTS 128
 #define NUM_MSGS 64
 
@@ -315,7 +320,7 @@
 
 static void *listener(void *unused)
 {
-	struct sockaddr_un sun;
+	struct sockaddr_un sunaddr;
 	int s;
 	int len;
 	int x;
@@ -335,8 +340,8 @@
 				ast_log(LOG_WARNING, "poll returned error: %s\n", strerror(errno));
 			continue;
 		}
-		len = sizeof(sun);
-		s = accept(ast_socket, (struct sockaddr *)&sun, &len);
+		len = sizeof(sunaddr);
+		s = accept(ast_socket, (struct sockaddr *)&sunaddr, &len);
 		if (s < 0) {
 			if (errno != EINTR)
 				ast_log(LOG_WARNING, "Accept returned %d: %s\n", s, strerror(errno));
@@ -377,7 +382,7 @@
 
 static int ast_makesocket(void)
 {
-	struct sockaddr_un sun;
+	struct sockaddr_un sunaddr;
 	int res;
 	int x;
 	for (x=0;x<AST_MAX_CONNECTS;x++)	
@@ -388,10 +393,10 @@
 		ast_log(LOG_WARNING, "Unable to create control socket: %s\n", strerror(errno));
 		return -1;
 	}		
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_LOCAL;
-	strncpy(sun.sun_path, (char *)ast_config_AST_SOCKET, sizeof(sun.sun_path)-1);
-	res = bind(ast_socket, (struct sockaddr *)&sun, sizeof(sun));
+	memset(&sunaddr, 0, sizeof(sunaddr));
+	sunaddr.sun_family = AF_LOCAL;
+	strncpy(sunaddr.sun_path, (char *)ast_config_AST_SOCKET, sizeof(sunaddr.sun_path)-1);
+	res = bind(ast_socket, (struct sockaddr *)&sunaddr, sizeof(sunaddr));
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to bind socket to %s: %s\n", (char *)ast_config_AST_SOCKET, strerror(errno));
 		close(ast_socket);
@@ -412,17 +417,17 @@
 
 static int ast_tryconnect(void)
 {
-	struct sockaddr_un sun;
+	struct sockaddr_un sunaddr;
 	int res;
 	ast_consock = socket(PF_LOCAL, SOCK_STREAM, 0);
 	if (ast_consock < 0) {
 		ast_log(LOG_WARNING, "Unable to create socket: %s\n", strerror(errno));
 		return 0;
 	}
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_LOCAL;
-	strncpy(sun.sun_path, (char *)ast_config_AST_SOCKET, sizeof(sun.sun_path)-1);
-	res = connect(ast_consock, (struct sockaddr *)&sun, sizeof(sun));
+	memset(&sunaddr, 0, sizeof(sunaddr));
+	sunaddr.sun_family = AF_LOCAL;
+	strncpy(sunaddr.sun_path, (char *)ast_config_AST_SOCKET, sizeof(sunaddr.sun_path)-1);
+	res = connect(ast_consock, (struct sockaddr *)&sunaddr, sizeof(sunaddr));
 	if (res) {
 		close(ast_consock);
 		ast_consock = -1;

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cli.c	7 Dec 2004 20:38:43 -0000	1.65
+++ cli.c	14 Dec 2004 23:36:29 -0000	1.66
@@ -47,7 +47,12 @@
 
 	va_list ap;
 	va_start(ap, fmt);
+#ifdef SOLARIS
+        stuff = (char *)malloc(10240);
+        vsnprintf(stuff, 10240, fmt, ap);
+#else
 	res = vasprintf(&stuff, fmt, ap);
+#endif
 	va_end(ap);
 	if (res == -1) {
 		ast_log(LOG_ERROR, "Out of memory\n");

Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- logger.c	17 Nov 2004 19:27:47 -0000	1.51
+++ logger.c	14 Dec 2004 23:36:29 -0000	1.52
@@ -136,7 +136,9 @@
 {
 	struct logchannel *chan;
 	char *facility;
+#ifndef SOLARIS
 	CODE *cptr;
+#endif
 
 	if (ast_strlen_zero(channel))
 		return NULL;
@@ -155,6 +157,8 @@
 		    if(!facility++ || !facility) {
 			facility = "local0";
 		    }
+
+#ifndef SOLARIS
 		    /*
 		     * Walk through the list of facilitynames (defined in sys/syslog.h)
 		     * to see if we can find the one we have been given
@@ -168,6 +172,46 @@
 			}
 			cptr++;
 		    }
+#else
+		    chan->facility = -1;
+		    if (!strcasecmp(facility, "kern")) 
+			chan->facility = LOG_KERN;
+		    else if (!strcasecmp(facility, "USER")) 
+			chan->facility = LOG_USER;
+		    else if (!strcasecmp(facility, "MAIL")) 
+			chan->facility = LOG_MAIL;
+		    else if (!strcasecmp(facility, "DAEMON")) 
+			chan->facility = LOG_DAEMON;
+		    else if (!strcasecmp(facility, "AUTH")) 
+			chan->facility = LOG_AUTH;
+		    else if (!strcasecmp(facility, "SYSLOG")) 
+			chan->facility = LOG_SYSLOG;
+		    else if (!strcasecmp(facility, "LPR")) 
+			chan->facility = LOG_LPR;
+		    else if (!strcasecmp(facility, "NEWS")) 
+			chan->facility = LOG_NEWS;
+		    else if (!strcasecmp(facility, "UUCP")) 
+			chan->facility = LOG_UUCP;
+		    else if (!strcasecmp(facility, "CRON")) 
+			chan->facility = LOG_CRON;
+		    else if (!strcasecmp(facility, "LOCAL0")) 
+			chan->facility = LOG_LOCAL0;
+		    else if (!strcasecmp(facility, "LOCAL1")) 
+			chan->facility = LOG_LOCAL1;
+		    else if (!strcasecmp(facility, "LOCAL2")) 
+			chan->facility = LOG_LOCAL2;
+		    else if (!strcasecmp(facility, "LOCAL3")) 
+			chan->facility = LOG_LOCAL3;
+		    else if (!strcasecmp(facility, "LOCAL4")) 
+			chan->facility = LOG_LOCAL4;
+		    else if (!strcasecmp(facility, "LOCAL5")) 
+			chan->facility = LOG_LOCAL5;
+		    else if (!strcasecmp(facility, "LOCAL6")) 
+			chan->facility = LOG_LOCAL6;
+		    else if (!strcasecmp(facility, "LOCAL7")) 
+			chan->facility = LOG_LOCAL7;
+#endif
+
 		    if (0 > chan->facility) {
 			fprintf(stderr, "Logger Warning: bad syslog facility in logger.conf\n");
 			free(chan);

Index: md5.c
===================================================================
RCS file: /usr/cvsroot/asterisk/md5.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- md5.c	31 Aug 2004 13:32:11 -0000	1.8
+++ md5.c	14 Dec 2004 23:36:29 -0000	1.9
@@ -8,6 +8,9 @@
 #  include <sys/endian.h>
 #elif defined( BSD ) && ( BSD >= 199103 ) || defined(__APPLE__)
 #  include <machine/endian.h>
+#elif defined( __sparc__ ) && defined( SOLARIS )
+#  define BIG_ENDIAN 4321
+#  define BYTE_ORDER BIG_ENDIAN
 #else
 #  include <endian.h>
 #endif

Index: mkdep
===================================================================
RCS file: /usr/cvsroot/asterisk/mkdep,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mkdep	23 May 2004 17:17:27 -0000	1.4
+++ mkdep	14 Dec 2004 23:36:29 -0000	1.5
@@ -1,4 +1,4 @@
-#!/bin/sh -
+#!/bin/bash -
 #
 #	$OpenBSD: mkdep.gcc.sh,v 1.8 1998/09/02 06:40:07 deraadt Exp $
 #	$NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $

Index: mkpkgconfig
===================================================================
RCS file: /usr/cvsroot/asterisk/mkpkgconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mkpkgconfig	11 Nov 2004 20:57:49 -0000	1.2
+++ mkpkgconfig	14 Dec 2004 23:36:29 -0000	1.3
@@ -2,7 +2,7 @@
 PPATH=$1
 ## Make sure we were called from Makefile
 
-if [ "x$ASTERISKVERSIONNUM" == "x" ]; then
+if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
   echo " ** Do not call this script directly"
   exit
 fi

Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- rtp.c	9 Dec 2004 14:54:13 -0000	1.100
+++ rtp.c	14 Dec 2004 23:36:29 -0000	1.101
@@ -1084,9 +1084,23 @@
 	return 0;
 }
 
+#ifdef SOLARIS
+static void put_uint32(unsigned char *buf, int i)
+{
+  unsigned char *c = (unsigned char *)&i;
+
+  buf[0] = (i>>24) & 0xff;
+  buf[1] = (i>>16) & 0xff;
+  buf[2] = (i>>8)  & 0xff;
+  buf[3] = i       & 0xff;
+}
+#else
+#define put_uint32(p,v) ((*((unsigned int *)(p))) = (v))
+#endif
+
 static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec)
 {
-	unsigned int *rtpheader;
+	unsigned char *rtpheader;
 	char iabuf[INET_ADDRSTRLEN];
 	int hdrlen = 12;
 	int res;
@@ -1165,10 +1179,14 @@
 		}
 	}
 	/* Get a pointer to the header */
-	rtpheader = (unsigned int *)(f->data - hdrlen);
-	rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++) | (mark << 23));
-	rtpheader[1] = htonl(rtp->lastts);
-	rtpheader[2] = htonl(rtp->ssrc); 
+	rtpheader = (unsigned char *)(f->data - hdrlen);
+
+	put_uint32(rtpheader, htonl((2 << 30) | (codec << 16) | (rtp->seqno) | (mark << 23)));
+	put_uint32(rtpheader + 4, htonl(rtp->lastts));
+	put_uint32(rtpheader + 8, htonl(rtp->ssrc)); 
+
+	rtp->seqno++;
+
 	if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
 		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
 		if (res <0) 

Index: say.c
===================================================================
RCS file: /usr/cvsroot/asterisk/say.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- say.c	13 Nov 2004 16:13:07 -0000	1.43
+++ say.c	14 Dec 2004 23:36:29 -0000	1.44
@@ -28,6 +28,10 @@
 #include "asterisk.h"
 #include <stdio.h>
 
+#ifdef SOLARIS
+#include <iso/limits_iso.h>
+#endif
+
 
 /* Forward declaration */
 static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang);

Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- utils.c	17 Oct 2004 22:13:05 -0000	1.22
+++ utils.c	14 Dec 2004 23:36:29 -0000	1.23
@@ -168,10 +168,17 @@
 	}
 	if (!s || !*s)
 		return NULL;
+#ifdef SOLARIS
+	result = gethostbyname_r(host, &hp->hp, hp->buf, sizeof(hp->buf), &herrno);
+
+	if (!result || !hp->hp.h_addr_list || !hp->hp.h_addr_list[0])
+		return NULL;
+#else
 	res = gethostbyname_r(host, &hp->hp, hp->buf, sizeof(hp->buf), &result, &herrno);
 
 	if (res || !result || !hp->hp.h_addr_list || !hp->hp.h_addr_list[0])
 		return NULL;
+#endif
 	return &hp->hp;
 }
 




More information about the svn-commits mailing list