[svn-commits] branch oej/securertp-trunk r33172 - in
/team/oej/securertp-trunk: ./ channels...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Fri Jun 9 02:19:50 MST 2006
Author: oej
Date: Fri Jun 9 04:19:50 2006
New Revision: 33172
URL: http://svn.digium.com/view/asterisk?rev=33172&view=rev
Log:
Update to trunk
Modified:
team/oej/securertp-trunk/ (props changed)
team/oej/securertp-trunk/channels/chan_sip.c
team/oej/securertp-trunk/include/asterisk.h
team/oej/securertp-trunk/include/asterisk/rtp.h
team/oej/securertp-trunk/rtp.c
Propchange: team/oej/securertp-trunk/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/securertp-trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun 9 04:19:50 2006
@@ -1,1 +1,1 @@
-/trunk:1-33127
+/trunk:1-33169
Modified: team/oej/securertp-trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/securertp-trunk/channels/chan_sip.c?rev=33172&r1=33171&r2=33172&view=diff
==============================================================================
--- team/oej/securertp-trunk/channels/chan_sip.c (original)
+++ team/oej/securertp-trunk/channels/chan_sip.c Fri Jun 9 04:19:50 2006
@@ -4155,7 +4155,7 @@
int sendonly = 0;
int numberofports;
struct ast_channel *bridgepeer = NULL;
- struct ast_rtp newaudiortp, newvideortp; /* Buffers for codec handling */
+ struct ast_rtp *newaudiortp, *newvideortp; /* Buffers for codec handling */
int newjointcapability; /* Negotiated capability */
int newpeercapability;
int newnoncodeccapability;
@@ -4170,10 +4170,13 @@
}
/* Initialize the temporary RTP structures we use to evaluate the offer from the peer */
- memset(&newaudiortp, 0, sizeof(newaudiortp));
- memset(&newvideortp, 0, sizeof(newvideortp));
- ast_rtp_pt_default(&newaudiortp);
- ast_rtp_pt_default(&newvideortp);
+ newaudiortp = alloca(ast_rtp_alloc_size());
+ memset(newaudiortp, 0, ast_rtp_alloc_size());
+ ast_rtp_pt_default(newaudiortp);
+
+ newvideortp = alloca(ast_rtp_alloc_size());
+ memset(newvideortp, 0, ast_rtp_alloc_size());
+ ast_rtp_pt_default(newvideortp);
/* Update our last rtprx when we receive an SDP, too */
p->lastrtprx = p->lastrtptx = time(NULL); /* XXX why both ? */
@@ -4216,7 +4219,7 @@
numberofmediastreams++;
if (p->vrtp)
- ast_rtp_pt_clear(&newvideortp); /* Must be cleared in case no m=video line exists */
+ ast_rtp_pt_clear(newvideortp); /* Must be cleared in case no m=video line exists */
numberofports = 1;
if ((sscanf(m, "audio %d/%d RTP/%4s %n", &x, &numberofports, protocol, &len) == 3) ||
(sscanf(m, "audio %d RTP/%4s %n", &x, protocol, &len) == 2)) {
@@ -4234,7 +4237,7 @@
/* Found audio stream in this media definition */
portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */
- ast_rtp_pt_clear(&newaudiortp);
+ ast_rtp_pt_clear(newaudiortp);
for (codecs = m + len; !ast_strlen_zero(codecs); codecs = ast_skip_blanks(codecs + len)) {
if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
ast_log(LOG_WARNING, "Error in codec string '%s'\n", codecs);
@@ -4242,7 +4245,7 @@
}
if (debug)
ast_verbose("Found RTP audio format %d\n", codec);
- ast_rtp_set_m_type(&newaudiortp, codec);
+ ast_rtp_set_m_type(newaudiortp, codec);
}
} else if ((sscanf(m, "video %d/%d RTP/%4s %n", &x, &numberofports, protocol, &len) == 3) ||
(sscanf(m, "video %d RTP/%4s %n", &x, protocol, &len) == 2)) {
@@ -4267,7 +4270,7 @@
}
if (debug)
ast_verbose("Found RTP video format %d\n", codec);
- ast_rtp_set_m_type(&newvideortp, codec);
+ ast_rtp_set_m_type(newvideortp, codec);
}
} else
ast_log(LOG_WARNING, "Unsupported SDP media type in offer: %s\n", m);
@@ -4371,9 +4374,9 @@
ast_verbose("Found description format %s for ID %d\n", mimeSubtype, codec);
/* Note: should really look at the 'freq' and '#chans' params too */
- ast_rtp_set_rtpmap_type(&newaudiortp, codec, "audio", mimeSubtype);
+ ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype);
if (p->vrtp)
- ast_rtp_set_rtpmap_type(&newvideortp, codec, "video", mimeSubtype);
+ ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype);
if (secure_audio && !(p->srtp && p->srtp->a_crypto)) {
ast_log(LOG_WARNING, "Can't provide secure audio requested in SDP offer\n");
@@ -4386,8 +4389,8 @@
}
/* Now gather all of the codecs that we are asked for: */
- ast_rtp_get_current_formats(&newaudiortp, &peercapability, &peernoncodeccapability);
- ast_rtp_get_current_formats(&newvideortp, &vpeercapability, &vpeernoncodeccapability);
+ ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability);
+ ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability);
newjointcapability = p->capability & (peercapability | vpeercapability);
newpeercapability = (peercapability | vpeercapability);
@@ -4421,15 +4424,9 @@
p->peercapability = newpeercapability; /* The other sides capability in latest offer */
p->noncodeccapability = newnoncodeccapability; /* DTMF capabilities */
- {
- int i;
- /* Copy payload types from source to destination */
- for (i=0; i < MAX_RTP_PT; ++i) {
- p->rtp->current_RTP_PT[i]= newaudiortp.current_RTP_PT[i];
- if (p->vrtp)
- p->vrtp->current_RTP_PT[i]= newvideortp.current_RTP_PT[i];
- }
- }
+ ast_rtp_pt_copy(p->rtp, newaudiortp);
+ if (p->vrtp)
+ ast_rtp_pt_copy(p->vrtp, newvideortp);
if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO) {
ast_clear_flag(&p->flags[0], SIP_DTMF);
Modified: team/oej/securertp-trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/team/oej/securertp-trunk/include/asterisk.h?rev=33172&r1=33171&r2=33172&view=diff
==============================================================================
--- team/oej/securertp-trunk/include/asterisk.h (original)
+++ team/oej/securertp-trunk/include/asterisk.h Fri Jun 9 04:19:50 2006
@@ -53,8 +53,8 @@
int ast_set_priority(int); /*!< Provided by asterisk.c */
int load_modules(const int preload_only); /*!< Provided by module.c */
int load_pbx(void); /*!< Provided by pbx.c */
-int init_logger(void) /*!< Provided by logger.c */;
-void close_logger(void) /*!< Provided by logger.c */;
+int init_logger(void); /*!< Provided by logger.c */
+void close_logger(void); /*!< Provided by logger.c */
int reload_logger(int); /*!< Provided by logger.c */
int init_framer(void); /*!< Provided by frame.c */
int term_init(void); /*!< Provided by term.c */
Modified: team/oej/securertp-trunk/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/securertp-trunk/include/asterisk/rtp.h?rev=33172&r1=33171&r2=33172&view=diff
==============================================================================
--- team/oej/securertp-trunk/include/asterisk/rtp.h (original)
+++ team/oej/securertp-trunk/include/asterisk/rtp.h Fri Jun 9 04:19:50 2006
@@ -139,60 +139,11 @@
int code;
};
-/*! \brief RTP session description */
-struct ast_rtp {
- int s;
- char resp;
- struct ast_frame f;
- unsigned char rawdata[8192 + AST_FRIENDLY_OFFSET];
- unsigned int ssrc; /*!< Synchronization source, RFC 3550, page 10. */
- unsigned int themssrc; /*!< Their SSRC */
- unsigned int rxssrc;
- unsigned int lastts;
- unsigned int lastdigitts;
- unsigned int lastrxts;
- unsigned int lastividtimestamp;
- unsigned int lastovidtimestamp;
- unsigned int lasteventseqn;
- int lastrxseqno; /*!< Last received sequence number */
- unsigned short seedrxseqno; /*!< What sequence number did they start with?*/
- unsigned int seedrxts; /*!< What RTP timestamp did they start with? */
- unsigned int rxcount; /*!< How many packets have we received? */
- unsigned int rxoctetcount; /*!< How many octets have we received? should be rxcount *160*/
- unsigned int txcount; /*!< How many packets have we sent? */
- unsigned int txoctetcount; /*!< How many octets have we sent? (txcount*160)*/
- unsigned int cycles; /*!< Shifted count of sequence number cycles */
- double rxjitter; /*!< Interarrival jitter at the moment */
- double rxtransit; /*!< Relative transit time for previous packet */
- unsigned int lasteventendseqn;
- int lasttxformat;
- int lastrxformat;
- int dtmfcount;
- unsigned int dtmfduration;
- int nat;
- unsigned int flags;
- struct sockaddr_in us; /*!< Socket representation of the local endpoint. */
- struct sockaddr_in them; /*!< Socket representation of the remote endpoint. */
- struct timeval rxcore;
- struct timeval txcore;
- double drxcore; /*!< The double representation of the first received packet */
- struct timeval lastrx; /*!< timeval when we last received a packet */
- struct timeval dtmfmute;
- struct ast_smoother *smoother;
- int *ioid;
- unsigned short seqno; /*!< Sequence number, RFC 3550, page 13. */
- unsigned short rxseqno;
- struct sched_context *sched;
- struct io_context *io;
- void *data;
- ast_rtp_callback callback;
- struct rtpPayloadType current_RTP_PT[MAX_RTP_PT];
- int rtp_lookup_code_cache_isAstFormat; /*!< a cache for the result of rtp_lookup_code(): */
- int rtp_lookup_code_cache_code;
- int rtp_lookup_code_cache_result;
- struct ast_rtcp *rtcp;
- struct ast_srtp *srtp; /*!< Secure RTP data */
-};
+/*!
+ * \brief Get the amount of space required to hold an RTP session
+ * \return number of bytes required
+ */
+size_t ast_rtp_alloc_size(void);
/*!
* \brief Initializate a RTP session.
@@ -256,6 +207,10 @@
void ast_rtp_pt_clear(struct ast_rtp* rtp);
/*! \brief Set payload types to defaults */
void ast_rtp_pt_default(struct ast_rtp* rtp);
+
+/*! \brief Copy payload types between RTP structures */
+void ast_rtp_pt_copy(struct ast_rtp *dest, const struct ast_rtp *src);
+
void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt);
void ast_rtp_set_rtpmap_type(struct ast_rtp* rtp, int pt,
char* mimeType, char* mimeSubtype);
Modified: team/oej/securertp-trunk/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/securertp-trunk/rtp.c?rev=33172&r1=33171&r2=33172&view=diff
==============================================================================
--- team/oej/securertp-trunk/rtp.c (original)
+++ team/oej/securertp-trunk/rtp.c Fri Jun 9 04:19:50 2006
@@ -92,6 +92,61 @@
struct ast_srtp_res *g_srtp_res;
struct ast_srtp_policy_res *g_policy_res;
+
+/*! \brief RTP session description */
+struct ast_rtp {
+ int s;
+ char resp;
+ struct ast_frame f;
+ unsigned char rawdata[8192 + AST_FRIENDLY_OFFSET];
+ unsigned int ssrc; /*!< Synchronization source, RFC 3550, page 10. */
+ unsigned int themssrc; /*!< Their SSRC */
+ unsigned int rxssrc;
+ unsigned int lastts;
+ unsigned int lastdigitts;
+ unsigned int lastrxts;
+ unsigned int lastividtimestamp;
+ unsigned int lastovidtimestamp;
+ unsigned int lasteventseqn;
+ int lastrxseqno; /*!< Last received sequence number */
+ unsigned short seedrxseqno; /*!< What sequence number did they start with?*/
+ unsigned int seedrxts; /*!< What RTP timestamp did they start with? */
+ unsigned int rxcount; /*!< How many packets have we received? */
+ unsigned int rxoctetcount; /*!< How many octets have we received? should be rxcount *160*/
+ unsigned int txcount; /*!< How many packets have we sent? */
+ unsigned int txoctetcount; /*!< How many octets have we sent? (txcount*160)*/
+ unsigned int cycles; /*!< Shifted count of sequence number cycles */
+ double rxjitter; /*!< Interarrival jitter at the moment */
+ double rxtransit; /*!< Relative transit time for previous packet */
+ unsigned int lasteventendseqn;
+ int lasttxformat;
+ int lastrxformat;
+ int dtmfcount;
+ unsigned int dtmfduration;
+ int nat;
+ unsigned int flags;
+ struct sockaddr_in us; /*!< Socket representation of the local endpoint. */
+ struct sockaddr_in them; /*!< Socket representation of the remote endpoint. */
+ struct timeval rxcore;
+ struct timeval txcore;
+ double drxcore; /*!< The double representation of the first received packet */
+ struct timeval lastrx; /*!< timeval when we last received a packet */
+ struct timeval dtmfmute;
+ struct ast_smoother *smoother;
+ int *ioid;
+ unsigned short seqno; /*!< Sequence number, RFC 3550, page 13. */
+ unsigned short rxseqno;
+ struct sched_context *sched;
+ struct io_context *io;
+ void *data;
+ ast_rtp_callback callback;
+ struct rtpPayloadType current_RTP_PT[MAX_RTP_PT];
+ int rtp_lookup_code_cache_isAstFormat; /*!< a cache for the result of rtp_lookup_code(): */
+ int rtp_lookup_code_cache_code;
+ int rtp_lookup_code_cache_result;
+ struct ast_rtcp *rtcp;
+ struct ast_srtp *srtp; /*!< Secure RTP data */
+};
/* Forward declarations */
static int ast_rtcp_write(void *data);
@@ -304,6 +359,11 @@
int x;
for (x=0;x<4;x++)
req->id.id[x] = ast_random();
+}
+
+size_t ast_rtp_alloc_size(void)
+{
+ return sizeof(struct ast_rtp);
}
void ast_rtp_stun_request(struct ast_rtp *rtp, struct sockaddr_in *suggestion, const char *username)
@@ -1406,10 +1466,10 @@
rtp->rtp_lookup_code_cache_result = 0;
}
-static void ast_rtp_pt_copy(struct ast_rtp *dest, struct ast_rtp *src)
-{
- int i;
- /* Copy payload types from source to destination */
+void ast_rtp_pt_copy(struct ast_rtp *dest, const struct ast_rtp *src)
+{
+ unsigned int i;
+
for (i=0; i < MAX_RTP_PT; ++i) {
dest->current_RTP_PT[i].isAstFormat =
src->current_RTP_PT[i].isAstFormat;
More information about the svn-commits
mailing list