Merge slimey's Solaris compatibility (with small mods) (bug #2740)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-12-14 23:36:30 +00:00
parent 0f205bb079
commit 9d40b8ee80
55 changed files with 1098 additions and 62 deletions

28
rtp.c
View File

@@ -1084,9 +1084,23 @@ int ast_rtp_senddigit(struct ast_rtp *rtp, char digit)
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 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
}
}
/* 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)