diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-14 23:36:30 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-14 23:36:30 +0000 |
commit | 70cedacdde512d2ed5984eec242c55f3239b73fc (patch) | |
tree | 48694f38698e4ead3840305333816193c7fcd8a0 /rtp.c | |
parent | c60f8a2b8e1551244e674baff85cb1a4f2d5fd5b (diff) |
Merge slimey's Solaris compatibility (with small mods) (bug #2740)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4446 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-x | rtp.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -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) |