aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco
diff options
context:
space:
mode:
Diffstat (limited to 'lib/megaco')
-rw-r--r--lib/megaco/configure.in113
-rw-r--r--lib/megaco/doc/src/Makefile19
-rw-r--r--lib/megaco/doc/src/megaco.xml16
-rw-r--r--lib/megaco/doc/src/megaco_codec_transform.xml27
-rw-r--r--lib/megaco/doc/src/megaco_debug.xml28
-rw-r--r--lib/megaco/doc/src/megaco_mib.xml12
-rw-r--r--lib/megaco/doc/src/megaco_performance.xml18
-rw-r--r--lib/megaco/doc/src/megaco_run.xml8
-rw-r--r--lib/megaco/doc/src/megaco_user.xml11
-rw-r--r--lib/megaco/doc/src/notes.xml133
-rw-r--r--lib/megaco/doc/src/notes_history.xml10
-rw-r--r--lib/megaco/doc/standard/H.248.1-Corr1-200403.docbin296448 -> 0 bytes
-rw-r--r--lib/megaco/doc/standard/rfc2327.txt2355
-rw-r--r--lib/megaco/doc/standard/rfc3266.txt283
-rw-r--r--lib/megaco/examples/meas/meas.sh.skel12
-rw-r--r--lib/megaco/include/megaco.hrl19
-rw-r--r--lib/megaco/src/app/megaco.appup.src69
-rw-r--r--lib/megaco/src/app/megaco_internal.hrl26
-rw-r--r--lib/megaco/src/engine/megaco_config.erl439
-rw-r--r--lib/megaco/src/engine/megaco_filter.erl286
-rw-r--r--lib/megaco/src/engine/megaco_messenger.erl542
-rw-r--r--lib/megaco/src/engine/megaco_monitor.erl33
-rw-r--r--lib/megaco/src/flex/Makefile.in82
-rw-r--r--lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src7
-rw-r--r--lib/megaco/src/flex/megaco_flex_scanner_handler.erl45
-rw-r--r--lib/megaco/test/Makefile175
-rw-r--r--lib/megaco/test/megaco_app_test.erl14
-rw-r--r--lib/megaco/test/megaco_config_test.erl362
-rw-r--r--lib/megaco/test/modules.mk12
-rw-r--r--lib/megaco/vsn.mk30
30 files changed, 1704 insertions, 3482 deletions
diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in
index 297d618369..8f94a4efcf 100644
--- a/lib/megaco/configure.in
+++ b/lib/megaco/configure.in
@@ -1,20 +1,20 @@
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
dnl
dnl %CopyrightBegin%
-dnl
-dnl Copyright Ericsson AB 2001-2009. All Rights Reserved.
-dnl
+dnl
+dnl Copyright Ericsson AB 2001-2010. All Rights Reserved.
+dnl
dnl The contents of this file are subject to the Erlang Public License,
dnl Version 1.1, (the "License"); you may not use this file except in
dnl compliance with the License. You should have received a copy of the
dnl Erlang Public License along with this software. If not, it can be
dnl retrieved online at http://www.erlang.org/.
-dnl
+dnl
dnl Software distributed under the License is distributed on an "AS IS"
dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
dnl the License for the specific language governing rights and limitations
dnl under the License.
-dnl
+dnl
dnl %CopyrightEnd%
dnl
@@ -145,12 +145,14 @@ AC_ARG_ENABLE(megaco_flex_scanner_lineno,
AC_SUBST(ENABLE_MEGACO_FLEX_SCANNER_LINENO)
+dnl This is the os flavour, should be unix, vxworks or win32
+if test "X$host" = "Xwin32"; then
+ ERLANG_OSTYPE=win32
+else
+ ERLANG_OSTYPE=unix
+fi
-dnl
-dnl C compiler (related) defs
-dnl
-
-AC_PROG_CC
+AC_SUBST(ERLANG_OSTYPE)
dnl Magic test for clearcase.
if test -d ../../system; then
@@ -158,33 +160,55 @@ if test -d ../../system; then
else
OTP_EXTRA_FLAGS=
fi
+AC_SUBST(OTP_EXTRA_FLAGS)
+
+dnl
+dnl If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0,
+dnl every thing releted to compiling Dynamic Erlang Drivers can be found
+dnl in $(ERL_TOP)/make/$(TARGET)/ded.mk at compile time. If not, try to
+dnl figure these things out.
+dnl
+
+AC_MSG_CHECKING([for usable Dynamic Erlang Driver configuration])
+[
+ ded_mk_in="${ERL_TOP}/make/otp_ded.mk.in"
+ ded_mk_vsn=
+ test -r "$ded_mk_in" &&
+ ded_mk_vsn=`sed -n "s/^DED_MK_VSN[ ]*=[ ]*\(.*\)/\1/p" < "$ded_mk_in"`
+ test "$ded_mk_vsn" != "" || ded_mk_vsn=0
+]
+
+if test $ded_mk_vsn -gt 0; then
+
+HAVE_USABLE_OTP_DED_MK=yes
+AC_MSG_RESULT([yes])
+CC=false
+AC_SUBST(CC)
+DED_LD=false
+AC_SUBST(DED_LD)
+
+else dnl --- begin no usable otp_ded.mk.in ---
+
+HAVE_USABLE_OTP_DED_MK=no
+AC_MSG_RESULT([no])
dnl
-dnl The ErlDrvEntry struct changed in R13 (another field)
+dnl C compiler (related) defs
dnl
-AC_CHECK_MEMBERS([struct ErlDrvEntry.stop_select],
- [
- CFLAGS="$CFLAGS -DMEGACO_DRV_ENTRY_HAS_STOP_SELECT"
- ],
- [],
- [
- #include "erl_driver.h"
- ])
+AC_PROG_CC
dnl
dnl Flags to the C compiler
dnl
-dnl make sure we find config.h
-CFLAGS="$CFLAGS -I${ERL_TOP}/erts/$host -I${ERL_TOP}/erts/include/$host $OTP_EXTRA_FLAGS"
if test "X$host" = "Xwin32"; then
DED_CFLAGS="$CFLAGS"
else
case $host_os in
darwin*)
- CFLAGS="$CFLAGS -no-cpp-precomp"
+ CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
;;
esac
@@ -196,22 +220,10 @@ else
fi
dnl emulator includes needed
-DED_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host"
-
-DED_CFLAGS="$DED_INCLUDE $DED_CFLAGS"
-
-
+DED_INCLUDES="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host -I${ERL_TOP}/erts/include/internal -I${ERL_TOP}/erts/include/internal/$host -I${ERL_TOP}/erts/emulator/sys/$ERLANG_OSTYPE"
-AC_SUBST(DED_CFLAGS)
-
-
-AC_CHECK_PROGS(DED_LD, [ld.sh ld], no_ld)
-if test "$DED_LD" = no_ld; then
- AC_MSG_ERROR([ld is required to build the flex scanner!])
-fi
+DED_THR_DEFS="-D_THREAD_SAFE -D_REENTRANT"
-
-AC_MSG_CHECKING(for linker flags for loadable drivers)
case $host_os in
win32)
DED_LDFLAGS="-dll"
@@ -230,33 +242,36 @@ case $host_os in
# Mach-O linker, a shared lib and a loadable
# object file is not the same thing.
DED_LDFLAGS="-bundle -flat_namespace -undefined suppress"
- DED_CFLAGS="$DED_CFLAGS -fno-common"
+ DED_LD="$CC"
;;
*)
# assume GNU linker and ELF
DED_LDFLAGS="-shared"
;;
esac
+
+AC_CHECK_PROGS(DED_LD, [$LD ld.sh])
+AC_CHECK_TOOL(DED_LD, ld, no_ld)
+if test "$DED_LD" = no_ld; then
+ AC_MSG_ERROR([ld is required to build the flex scanner!])
+fi
+
+AC_MSG_CHECKING(for linker flags for loadable drivers)
DED_LDFLAGS="$LDFLAGS $DED_LDFLAGS"
AC_MSG_RESULT([$DED_LDFLAGS])
-AC_SUBST(DED_LDFLAGS)
+fi dnl --- end no usable otp_ded.mk.in ---
+
+AC_SUBST(HAVE_USABLE_OTP_DED_MK)
+AC_SUBST(DED_CFLAGS)
+AC_SUBST(DED_INCLUDES)
+AC_SUBST(DED_THR_DEFS)
+AC_SUBST(DED_LDFLAGS)
AC_CHECK_PROG(PERL, perl, perl, no_perl)
if test "$PERL" = no_perl; then
AC_MSG_ERROR([Perl is required to build the flex scanner!])
fi
-
-dnl This is the os flavour, should be unix, vxworks or win32
-if test "X$host" = "Xwin32"; then
- ERLANG_OSTYPE=win32
-else
- ERLANG_OSTYPE=unix
-fi
-
-AC_SUBST(ERLANG_OSTYPE)
-
-
AC_OUTPUT(src/flex/$host/Makefile:src/flex/Makefile.in)
diff --git a/lib/megaco/doc/src/Makefile b/lib/megaco/doc/src/Makefile
index 2c55e92914..2355a1b8b9 100644
--- a/lib/megaco/doc/src/Makefile
+++ b/lib/megaco/doc/src/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2000-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2000-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
include $(ERL_TOP)/make/target.mk
@@ -49,6 +49,9 @@ include files.mk
# ----------------------------------------------------
+XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \
+ $(XML_PART_FILES) $(XML_CHAPTER_FILES)
+
INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html)
HTML_APP_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html)
@@ -104,8 +107,10 @@ INDEX_SRC = $(INDEX_FILE).src
INDEX_TARGET = $(DOCDIR)/$(INDEX_FILE)
STANDARD_DIR = ../standard
-STANDARDS = $(STANDARD_DIR)/rfc3015.txt \
- $(STANDARD_DIR)/implementors_guide_v6.pdf
+STANDARDS = $(STANDARD_DIR)/rfc3525.txt \
+ $(STANDARD_DIR)/rfc4234.txt \
+ $(STANDARD_DIR)/rfc4566.txt \
+ $(STANDARD_DIR)/implementors_guide_v10-13.pdf
# ----------------------------------------------------
# FLAGS
diff --git a/lib/megaco/doc/src/megaco.xml b/lib/megaco/doc/src/megaco.xml
index 0fb9d5aac6..ae9e250965 100644
--- a/lib/megaco/doc/src/megaco.xml
+++ b/lib/megaco/doc/src/megaco.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>megaco</title>
@@ -40,6 +40,16 @@
<section>
<title>DATA TYPES</title>
<code type="none"><![CDATA[
+megaco_mid() = ip4Address() | ip6Address() |
+ domainName() | deviceName() |
+ mtpAddress()
+ip4Address() = #'IP4Address'{}
+ip6Address() = #'IP6Address'{}
+domainName() = #'DomainName'{}
+deviceName() = pathName()
+pathName() = ia5String(1..64)
+mtpAddress() = octetString(2..4)
+
action_request() = #'ActionRequest'{}
action_reply() = #'ActionReply'{}
error_desc() = #'ErrorDescriptor'{}
diff --git a/lib/megaco/doc/src/megaco_codec_transform.xml b/lib/megaco/doc/src/megaco_codec_transform.xml
index 71f7fc689f..89ed3fd654 100644
--- a/lib/megaco/doc/src/megaco_codec_transform.xml
+++ b/lib/megaco/doc/src/megaco_codec_transform.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2002</year><year>2009</year>
+ <year>2002</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>megaco_codec_transform</title>
@@ -36,8 +36,8 @@
<description>
<p>This module implements a simple megaco message transformation utility.</p>
- <p><em>Note</em> that this module is <em>not</em> included in the runtime part of
- the application.</p>
+ <p><em>Note</em> that this module is <em>not</em> included in the
+ runtime part of the application.</p>
<marker id="export_messages"></marker>
</description>
@@ -51,15 +51,16 @@
<v>MessagePackage = atom()</v>
</type>
<desc>
- <p>Export the messages in the <c>MessagePackage</c> (default is <c>time_test</c>). </p>
- <p>The out produced by this function is a directory structure with the
- following structure: </p>
+ <p>Export the messages in the <c>MessagePackage</c> (default
+ is <c>time_test</c>). </p>
+ <p>The output produced by this function is a directory structure
+ with the following structure: </p>
<code type="none"><![CDATA[
-\011 <message package>/pretty/<message-files>
-\011 compact/<message-files>
-\011 per/<message-files>
-\011 ber/<message-files>
-\011 erlang/<message-files>
+<message package>/pretty/<message-files>
+ compact/<message-files>
+ per/<message-files>
+ ber/<message-files>
+ erlang/<message-files>
]]></code>
</desc>
</func>
diff --git a/lib/megaco/doc/src/megaco_debug.xml b/lib/megaco/doc/src/megaco_debug.xml
index 1b99985341..2523a3be86 100644
--- a/lib/megaco/doc/src/megaco_debug.xml
+++ b/lib/megaco/doc/src/megaco_debug.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Testing and tools</title>
@@ -159,12 +159,12 @@
<p>When run as above (this will take some time), the measurement
process is done as follows:</p>
<pre>
-\011 For each codec:
-\011 For each message:
-\011 Read the message from the file
-\011 Detect message version
-\011 Measure decode
- Measure encode
+For each codec:
+ For each message:
+ Read the message from the file
+ Detect message version
+ Measure decode
+ Measure encode
Write results, encode, decode and total, to file
</pre>
</item>
@@ -218,11 +218,11 @@ message() = binary()
with the following structure:
</p>
<code type="none"><![CDATA[
-\011 <message package>/pretty/<message-files>
-\011 compact/
-\011 per/
-\011 ber/<message-files>
-\011 erlang/
+<message package>/pretty/<message-files>
+ compact/
+ per/
+ ber/<message-files>
+ erlang/
]]></code>
<p>The file includes both version 1, 2 and version 3 messages.</p>
</section>
diff --git a/lib/megaco/doc/src/megaco_mib.xml b/lib/megaco/doc/src/megaco_mib.xml
index 3c0a549590..f1abe08fb5 100644
--- a/lib/megaco/doc/src/megaco_mib.xml
+++ b/lib/megaco/doc/src/megaco_mib.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2002</year><year>2009</year>
+ <year>2002</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Megaco mib</title>
@@ -50,15 +50,15 @@
lightweight. I.e. the statistic counters are handled
separately by different entities of the application. For
instance our two transport module(s) (see <seealso marker="megaco_tcp#stats">megaco_tcp</seealso> and <seealso marker="megaco_udp#stats">megaco_udp</seealso>) maintain their
- own counters and the application engine (see <seealso marker="megaco#stats">megaco</seealso>) maintain it's own
+ own counters and the application engine (see <seealso marker="megaco#stats">megaco</seealso>) maintain its own
counters.</p>
<p>This also means that if a user implement their own transport
- service then it has to maintain it's own statistics.</p>
+ service then it has to maintain its own statistics.</p>
</section>
<section>
<title>Distribution</title>
- <p>Each megaco application maintains it's own set of counters. So
+ <p>Each megaco application maintains its own set of counters. So
in a large (distributed) MG/MGC it could be necessary to
collect the statistics from several nodes (each) running the
megaco application (only one of them with the transport).</p>
diff --git a/lib/megaco/doc/src/megaco_performance.xml b/lib/megaco/doc/src/megaco_performance.xml
index b34ee4f389..72b5c156ba 100644
--- a/lib/megaco/doc/src/megaco_performance.xml
+++ b/lib/megaco/doc/src/megaco_performance.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2002</year><year>2009</year>
+ <year>2002</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Performance comparison</title>
@@ -257,12 +257,12 @@ MEGACO/1 [124.124.124.222]
Transaction = 9998 {
Context = - {
ServiceChange = ROOT {
- \011Services {
- \011 Method = Restart,
- \011 ServiceChangeAddress = 55555,
- \011 Profile = ResGW/1,
- \011 Reason = "901 MG Cold Boot"
- \011}
+ Services {
+ Method = Restart,
+ ServiceChangeAddress = 55555,
+ Profile = ResGW/1,
+ Reason = "901 MG Cold Boot"
+ }
}
}
} </pre>
diff --git a/lib/megaco/doc/src/megaco_run.xml b/lib/megaco/doc/src/megaco_run.xml
index 3afc638bcf..9ed589b079 100644
--- a/lib/megaco/doc/src/megaco_run.xml
+++ b/lib/megaco/doc/src/megaco_run.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Running the stack</title>
@@ -365,7 +365,7 @@
then the specified max message size (see the
<seealso marker="megaco#user_info">max_pdu_size</seealso> option).
Finally, if segmentation is decided, then each action reply
- will make up it's own (segment) message.</p>
+ will make up its own (segment) message.</p>
</item>
</list>
</section>
diff --git a/lib/megaco/doc/src/megaco_user.xml b/lib/megaco/doc/src/megaco_user.xml
index 37942007bc..7332fa684d 100644
--- a/lib/megaco/doc/src/megaco_user.xml
+++ b/lib/megaco/doc/src/megaco_user.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>megaco_user</title>
@@ -471,7 +471,7 @@ protocol_version() = integer() ]]></code>
<v>transaction_result() = action_reps()</v>
<v>segment_result() = {segment_no(), last_segment(), action_reps()}</v>
<v>action_reps() = [action_reply()]</v>
- <v>failure() = {error, reason()}</v>
+ <v>failure() = {error, reason()} | {error, ReplyNo, reason()}</v>
<v>reason() = transaction_reason() | segment_reason() | user_cancel_reason() | send_reason() | other_reason()</v>
<v>transaction_reason() = error_desc()</v>
<v>segment_reason() = {segment_no(), last_segment(), error_desc()}</v>
@@ -486,6 +486,7 @@ protocol_version() = integer() ]]></code>
<v>send_failed_reason() = {send_message_failed, reason_for_send_failure()}</v>
<v>reason_for_send_failure() = term()</v>
<v>ReplyData = reply_data()</v>
+ <v>ReplyNo = integer() > 0</v>
<v>reply_data() = term()</v>
<v>Extra = term()</v>
</type>
@@ -669,7 +670,7 @@ protocol_version() = integer() ]]></code>
<p>Invoked when a unexpected message is received</p>
<p>If a reply to a request is not received in time, the
megaco stack removes all info about the request from
- it's tables. If a reply should arrive after this has been
+ its tables. If a reply should arrive after this has been
done the app has no way of knowing where to send this message.
The message is delivered to the "user" by calling this
function on the local node (the node which has the link).</p>
diff --git a/lib/megaco/doc/src/notes.xml b/lib/megaco/doc/src/notes.xml
index 26c64f7c52..99a3784402 100644
--- a/lib/megaco/doc/src/notes.xml
+++ b/lib/megaco/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Megaco Release Notes</title>
@@ -36,6 +36,133 @@
section is the version number of Megaco.</p>
<section>
+ <title>Megaco 3.14.1</title>
+
+ <p>Version 3.14.1 supports code replacement in runtime from/to
+ version 3.14, 3.13, 3.12 and 3.11.3.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>A minor compiler related performance improvement. </p>
+ <p>Own Id: OTP-8561</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section>
+ <title>Fixed bugs and malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>A raise condition when, during high load, processing
+ both the original and a resent message and delivering
+ this as two separate messages to the user. </p>
+ <p>Note that this solution only protects against multiple
+ reply deliveries! </p>
+ <p>Own Id: OTP-8529</p>
+ <p>Aux Id: Seq 10915</p>
+ </item>
+
+ <item>
+ <p>Fix shared libraries installation. </p>
+ <p>The flex shared lib(s) were incorrectly installed as data
+ files. </p>
+ <p>Peter Lemenkov</p>
+ <p>Own Id: OTP-8627</p>
+ </item>
+
+ <item>
+ <p>Eliminated a possible raise condition while creating
+ pending counters. </p>
+ <p>Own Id: OTP-8634</p>
+ <p>Aux Id: Seq 11579</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ </section> <!-- 3.14.1 -->
+
+
+ <section>
+ <title>Megaco 3.14</title>
+
+ <p>Version 3.14 supports code replacement in runtime from/to
+ version 3.13, 3.12 and 3.11.3.</p>
+
+ <section>
+ <title>Improvements and new features</title>
+
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>Various changes to configure and makefile(s) to facilitate cross
+ compilation (and other build system improvements). </p>
+ <p>Own Id: OTP-8323</p>
+ </item>
+
+ <item>
+ <p>Added a help target in the test Makefile to explain
+ the most useful make targets, used when testing the
+ application using the test-server provided with megaco.</p>
+ <p>Own Id: OTP-8362</p>
+ </item>
+
+ <item>
+ <p>Adapted megaco_filter to the new internal format.</p>
+ <p>Own Id: OTP-8403</p>
+ </item>
+ </list>
+
+ </section>
+
+ <section>
+ <title>Fixed bugs and malfunctions</title>
+<!--
+ <p>-</p>
+-->
+
+ <list type="bulleted">
+ <item>
+ <p>Callbacks, when the callback module is unknown (undefined),
+ results in warning messages. </p>
+ <p>A raise condition scenario. As part of a cancelation operation,
+ replies with waiting acknowledgements is cancelled. This includes
+ informing the user (via a call to the handle_trans_ack callback
+ function). It is possible that at this point the connection data
+ has been removed, which makes it impossible for megaco to
+ perform this operation, resulting in the warning message. The
+ solution is to also store the callback module with the other
+ reply information, to be used when cleaning up after a
+ cancelation. </p>
+ <p>Own Id: OTP-8328</p>
+ <p>Aux Id: Seq 11384</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ </section> <!-- 3.14 -->
+
+
+ <section>
<title>Megaco 3.13</title>
<p>Version 3.13 supports code replacement in runtime from/to
diff --git a/lib/megaco/doc/src/notes_history.xml b/lib/megaco/doc/src/notes_history.xml
index 97aa4c66a5..640b62230f 100644
--- a/lib/megaco/doc/src/notes_history.xml
+++ b/lib/megaco/doc/src/notes_history.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2006</year><year>2009</year>
+ <year>2006</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Megaco Release Notes history</title>
@@ -2764,7 +2764,7 @@
<p>Added a new configuration parameter, threaded.
This tells the megaco app, that all
transaction requests in a message should be executed
- in parallel (e.g. each in it's own process).
+ in parallel (e.g. each in its own process).
<br></br>See the
<seealso marker="megaco#user_info">threaded</seealso> parameter
of the user_info function (also conn_info).</p>
@@ -2911,7 +2911,7 @@
<title>Improvements and new features</title>
<list type="bulleted">
<item>
- <p>This is just a code up-/downgrade cleanup release. I.e. It's the
+ <p>This is just a code up-/downgrade cleanup release. I.e. it's the
same as version 1.2 minus the ugly stuff needed to handle up-/downgrade
from/to version 1.1.2, 1.1.1 and 1.1.0.</p>
</item>
diff --git a/lib/megaco/doc/standard/H.248.1-Corr1-200403.doc b/lib/megaco/doc/standard/H.248.1-Corr1-200403.doc
deleted file mode 100644
index 39ef6e4efa..0000000000
--- a/lib/megaco/doc/standard/H.248.1-Corr1-200403.doc
+++ /dev/null
Binary files differ
diff --git a/lib/megaco/doc/standard/rfc2327.txt b/lib/megaco/doc/standard/rfc2327.txt
deleted file mode 100644
index ce77de6128..0000000000
--- a/lib/megaco/doc/standard/rfc2327.txt
+++ /dev/null
@@ -1,2355 +0,0 @@
-
-
-
-
-
-
-Network Working Group M. Handley
-Request for Comments: 2327 V. Jacobson
-Category: Standards Track ISI/LBNL
- April 1998
-
-
- SDP: Session Description Protocol
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
-Abstract
-
- This document defines the Session Description Protocol, SDP. SDP is
- intended for describing multimedia sessions for the purposes of
- session announcement, session invitation, and other forms of
- multimedia session initiation.
-
- This document is a product of the Multiparty Multimedia Session
- Control (MMUSIC) working group of the Internet Engineering Task
- Force. Comments are solicited and should be addressed to the working
- group's mailing list at [email protected] and/or the authors.
-
-1. Introduction
-
- On the Internet multicast backbone (Mbone), a session directory tool
- is used to advertise multimedia conferences and communicate the
- conference addresses and conference tool-specific information
- necessary for participation. This document defines a session
- description protocol for this purpose, and for general real-time
- multimedia session description purposes. This memo does not describe
- multicast address allocation or the distribution of SDP messages in
- detail. These are described in accompanying memos. SDP is not
- intended for negotiation of media encodings.
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 1]
-
-RFC 2327 SDP April 1998
-
-
-2. Background
-
- The Mbone is the part of the internet that supports IP multicast, and
- thus permits efficient many-to-many communication. It is used
- extensively for multimedia conferencing. Such conferences usually
- have the property that tight coordination of conference membership is
- not necessary; to receive a conference, a user at an Mbone site only
- has to know the conference's multicast group address and the UDP
- ports for the conference data streams.
-
- Session directories assist the advertisement of conference sessions
- and communicate the relevant conference setup information to
- prospective participants. SDP is designed to convey such information
- to recipients. SDP is purely a format for session description - it
- does not incorporate a transport protocol, and is intended to use
- different transport protocols as appropriate including the Session
- Announcement Protocol [4], Session Initiation Protocol [11], Real-
- Time Streaming Protocol [12], electronic mail using the MIME
- extensions, and the Hypertext Transport Protocol.
-
- SDP is intended to be general purpose so that it can be used for a
- wider range of network environments and applications than just
- multicast session directories. However, it is not intended to
- support negotiation of session content or media encodings - this is
- viewed as outside the scope of session description.
-
-3. Glossary of Terms
-
- The following terms are used in this document, and have specific
- meaning within the context of this document.
-
- Conference
- A multimedia conference is a set of two or more communicating users
- along with the software they are using to communicate.
-
- Session
- A multimedia session is a set of multimedia senders and receivers
- and the data streams flowing from senders to receivers. A
- multimedia conference is an example of a multimedia session.
-
- Session Advertisement
- See session announcement.
-
- Session Announcement
- A session announcement is a mechanism by which a session
- description is conveyed to users in a proactive fashion, i.e., the
- session description was not explicitly requested by the user.
-
-
-
-
-Handley & Jacobson Standards Track [Page 2]
-
-RFC 2327 SDP April 1998
-
-
- Session Description
- A well defined format for conveying sufficient information to
- discover and participate in a multimedia session.
-
-3.1. Terminology
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in RFC 2119.
-
-4. SDP Usage
-
-4.1. Multicast Announcements
-
- SDP is a session description protocol for multimedia sessions. A
- common mode of usage is for a client to announce a conference session
- by periodically multicasting an announcement packet to a well known
- multicast address and port using the Session Announcement Protocol
- (SAP).
-
- SAP packets are UDP packets with the following format:
-
- |--------------------|
- | SAP header |
- |--------------------|
- | text payload |
- |//////////
-
-
- The header is the Session Announcement Protocol header. SAP is
- described in more detail in a companion memo [4]
-
- The text payload is an SDP session description, as described in this
- memo. The text payload should be no greater than 1 Kbyte in length.
- If announced by SAP, only one session announcement is permitted in a
- single packet.
-
-4.2. Email and WWW Announcements
-
- Alternative means of conveying session descriptions include
- electronic mail and the World Wide Web. For both email and WWW
- distribution, the use of the MIME content type "application/sdp"
- should be used. This enables the automatic launching of applications
- for participation in the session from the WWW client or mail reader
- in a standard manner.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 3]
-
-RFC 2327 SDP April 1998
-
-
- Note that announcements of multicast sessions made only via email or
- the World Wide Web (WWW) do not have the property that the receiver
- of a session announcement can necessarily receive the session because
- the multicast sessions may be restricted in scope, and access to the
- WWW server or reception of email is possible outside this scope. SAP
- announcements do not suffer from this mismatch.
-
-5. Requirements and Recommendations
-
- The purpose of SDP is to convey information about media streams in
- multimedia sessions to allow the recipients of a session description
- to participate in the session. SDP is primarily intended for use in
- an internetwork, although it is sufficiently general that it can
- describe conferences in other network environments.
-
- A multimedia session, for these purposes, is defined as a set of
- media streams that exist for some duration of time. Media streams
- can be many-to-many. The times during which the session is active
- need not be continuous.
-
- Thus far, multicast based sessions on the Internet have differed from
- many other forms of conferencing in that anyone receiving the traffic
- can join the session (unless the session traffic is encrypted). In
- such an environment, SDP serves two primary purposes. It is a means
- to communicate the existence of a session, and is a means to convey
- sufficient information to enable joining and participating in the
- session. In a unicast environment, only the latter purpose is likely
- to be relevant.
-
- Thus SDP includes:
-
- o Session name and purpose
-
- o Time(s) the session is active
-
- o The media comprising the session
-
- o Information to receive those media (addresses, ports, formats and
- so on)
-
- As resources necessary to participate in a session may be limited,
- some additional information may also be desirable:
-
- o Information about the bandwidth to be used by the conference
-
- o Contact information for the person responsible for the session
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 4]
-
-RFC 2327 SDP April 1998
-
-
- In general, SDP must convey sufficient information to be able to join
- a session (with the possible exception of encryption keys) and to
- announce the resources to be used to non-participants that may need
- to know.
-
-5.1. Media Information
-
- SDP includes:
-
- o The type of media (video, audio, etc)
-
- o The transport protocol (RTP/UDP/IP, H.320, etc)
-
- o The format of the media (H.261 video, MPEG video, etc)
-
- For an IP multicast session, the following are also conveyed:
-
- o Multicast address for media
-
- o Transport Port for media
-
- This address and port are the destination address and destination
- port of the multicast stream, whether being sent, received, or both.
-
- For an IP unicast session, the following are conveyed:
-
- o Remote address for media
-
- o Transport port for contact address
-
- The semantics of this address and port depend on the media and
- transport protocol defined. By default, this is the remote address
- and remote port to which data is sent, and the remote address and
- local port on which to receive data. However, some media may define
- to use these to establish a control channel for the actual media
- flow.
-
-5.2. Timing Information
-
- Sessions may either be bounded or unbounded in time. Whether or not
- they are bounded, they may be only active at specific times.
-
- SDP can convey:
-
- o An arbitrary list of start and stop times bounding the session
-
- o For each bound, repeat times such as "every Wednesday at 10am for
- one hour"
-
-
-
-Handley & Jacobson Standards Track [Page 5]
-
-RFC 2327 SDP April 1998
-
-
- This timing information is globally consistent, irrespective of local
- time zone or daylight saving time.
-
-5.3. Private Sessions
-
- It is possible to create both public sessions and private sessions.
- Private sessions will typically be conveyed by encrypting the session
- description to distribute it. The details of how encryption is
- performed are dependent on the mechanism used to convey SDP - see [4]
- for how this is done for session announcements.
-
- If a session announcement is private it is possible to use that
- private announcement to convey encryption keys necessary to decode
- each of the media in a conference, including enough information to
- know which encryption scheme is used for each media.
-
-5.4. Obtaining Further Information about a Session
-
- A session description should convey enough information to decide
- whether or not to participate in a session. SDP may include
- additional pointers in the form of Universal Resources Identifiers
- (URIs) for more information about the session.
-
-5.5. Categorisation
-
- When many session descriptions are being distributed by SAP or any
- other advertisement mechanism, it may be desirable to filter
- announcements that are of interest from those that are not. SDP
- supports a categorisation mechanism for sessions that is capable of
- being automated.
-
-5.6. Internationalization
-
- The SDP specification recommends the use of the ISO 10646 character
- sets in the UTF-8 encoding (RFC 2044) to allow many different
- languages to be represented. However, to assist in compact
- representations, SDP also allows other character sets such as ISO
- 8859-1 to be used when desired. Internationalization only applies to
- free-text fields (session name and background information), and not
- to SDP as a whole.
-
-6. SDP Specification
-
- SDP session descriptions are entirely textual using the ISO 10646
- character set in UTF-8 encoding. SDP field names and attributes names
- use only the US-ASCII subset of UTF-8, but textual fields and
- attribute values may use the full ISO 10646 character set. The
- textual form, as opposed to a binary encoding such as ASN/1 or XDR,
-
-
-
-Handley & Jacobson Standards Track [Page 6]
-
-RFC 2327 SDP April 1998
-
-
- was chosen to enhance portability, to enable a variety of transports
- to be used (e.g, session description in a MIME email message) and to
- allow flexible, text-based toolkits (e.g., Tcl/Tk ) to be used to
- generate and to process session descriptions. However, since the
- total bandwidth allocated to all SAP announcements is strictly
- limited, the encoding is deliberately compact. Also, since
- announcements may be transported via very unreliable means (e.g.,
- email) or damaged by an intermediate caching server, the encoding was
- designed with strict order and formatting rules so that most errors
- would result in malformed announcements which could be detected
- easily and discarded. This also allows rapid discarding of encrypted
- announcements for which a receiver does not have the correct key.
-
- An SDP session description consists of a number of lines of text of
- the form <type>=<value> <type> is always exactly one character and is
- case-significant. <value> is a structured text string whose format
- depends on <type>. It also will be case-significant unless a
- specific field defines otherwise. Whitespace is not permitted either
- side of the `=' sign. In general <value> is either a number of fields
- delimited by a single space character or a free format string.
-
- A session description consists of a session-level description
- (details that apply to the whole session and all media streams) and
- optionally several media-level descriptions (details that apply onto
- to a single media stream).
-
- An announcement consists of a session-level section followed by zero
- or more media-level sections. The session-level part starts with a
- `v=' line and continues to the first media-level section. The media
- description starts with an `m=' line and continues to the next media
- description or end of the whole session description. In general,
- session-level values are the default for all media unless overridden
- by an equivalent media-level value.
-
- When SDP is conveyed by SAP, only one session description is allowed
- per packet. When SDP is conveyed by other means, many SDP session
- descriptions may be concatenated together (the `v=' line indicating
- the start of a session description terminates the previous
- description). Some lines in each description are required and some
- are optional but all must appear in exactly the order given here (the
- fixed order greatly enhances error detection and allows for a simple
- parser). Optional items are marked with a `*'.
-
-Session description
- v= (protocol version)
- o= (owner/creator and session identifier).
- s= (session name)
- i=* (session information)
-
-
-
-Handley & Jacobson Standards Track [Page 7]
-
-RFC 2327 SDP April 1998
-
-
- u=* (URI of description)
- e=* (email address)
- p=* (phone number)
- c=* (connection information - not required if included in all media)
- b=* (bandwidth information)
- One or more time descriptions (see below)
- z=* (time zone adjustments)
- k=* (encryption key)
- a=* (zero or more session attribute lines)
- Zero or more media descriptions (see below)
-
-Time description
- t= (time the session is active)
- r=* (zero or more repeat times)
-
-Media description
- m= (media name and transport address)
- i=* (media title)
- c=* (connection information - optional if included at session-level)
- b=* (bandwidth information)
- k=* (encryption key)
- a=* (zero or more media attribute lines)
-
- The set of `type' letters is deliberately small and not intended to
- be extensible -- SDP parsers must completely ignore any announcement
- that contains a `type' letter that it does not understand. The
- `attribute' mechanism ("a=" described below) is the primary means for
- extending SDP and tailoring it to particular applications or media.
- Some attributes (the ones listed in this document) have a defined
- meaning but others may be added on an application-, media- or
- session-specific basis. A session directory must ignore any
- attribute it doesn't understand.
-
- The connection (`c=') and attribute (`a=') information in the
- session-level section applies to all the media of that session unless
- overridden by connection information or an attribute of the same name
- in the media description. For instance, in the example below, each
- media behaves as if it were given a `recvonly' attribute.
-
- An example SDP description is:
-
- v=0
- o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
- s=SDP Seminar
- i=A Seminar on the session description protocol
- u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
- [email protected] (Mark Handley)
- c=IN IP4 224.2.17.12/127
-
-
-
-Handley & Jacobson Standards Track [Page 8]
-
-RFC 2327 SDP April 1998
-
-
- t=2873397496 2873404696
- a=recvonly
- m=audio 49170 RTP/AVP 0
- m=video 51372 RTP/AVP 31
- m=application 32416 udp wb
- a=orient:portrait
-
- Text records such as the session name and information are bytes
- strings which may contain any byte with the exceptions of 0x00 (Nul),
- 0x0a (ASCII newline) and 0x0d (ASCII carriage return). The sequence
- CRLF (0x0d0a) is used to end a record, although parsers should be
- tolerant and also accept records terminated with a single newline
- character. By default these byte strings contain ISO-10646
- characters in UTF-8 encoding, but this default may be changed using
- the `charset' attribute.
-
- Protocol Version
-
- v=0
-
- The "v=" field gives the version of the Session Description Protocol.
- There is no minor version number.
-
- Origin
-
- o=<username> <session id> <version> <network type> <address type>
- <address>
-
- The "o=" field gives the originator of the session (their username
- and the address of the user's host) plus a session id and session
- version number.
-
- <username> is the user's login on the originating host, or it is "-"
- if the originating host does not support the concept of user ids.
- <username> must not contain spaces. <session id> is a numeric string
- such that the tuple of <username>, <session id>, <network type>,
- <address type> and <address> form a globally unique identifier for
- the session.
-
- The method of <session id> allocation is up to the creating tool, but
- it has been suggested that a Network Time Protocol (NTP) timestamp be
- used to ensure uniqueness [1].
-
- <version> is a version number for this announcement. It is needed
- for proxy announcements to detect which of several announcements for
- the same session is the most recent. Again its usage is up to the
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 9]
-
-RFC 2327 SDP April 1998
-
-
- creating tool, so long as <version> is increased when a modification
- is made to the session data. Again, it is recommended (but not
- mandatory) that an NTP timestamp is used.
-
- <network type> is a text string giving the type of network.
- Initially "IN" is defined to have the meaning "Internet". <address
- type> is a text string giving the type of the address that follows.
- Initially "IP4" and "IP6" are defined. <address> is the globally
- unique address of the machine from which the session was created.
- For an address type of IP4, this is either the fully-qualified domain
- name of the machine, or the dotted-decimal representation of the IP
- version 4 address of the machine. For an address type of IP6, this
- is either the fully-qualified domain name of the machine, or the
- compressed textual representation of the IP version 6 address of the
- machine. For both IP4 and IP6, the fully-qualified domain name is
- the form that SHOULD be given unless this is unavailable, in which
- case the globally unique address may be substituted. A local IP
- address MUST NOT be used in any context where the SDP description
- might leave the scope in which the address is meaningful.
-
- In general, the "o=" field serves as a globally unique identifier for
- this version of this session description, and the subfields excepting
- the version taken together identify the session irrespective of any
- modifications.
-
- Session Name
-
- s=<session name>
-
- The "s=" field is the session name. There must be one and only one
- "s=" field per session description, and it must contain ISO 10646
- characters (but see also the `charset' attribute below).
-
- Session and Media Information
-
- i=<session description>
-
- The "i=" field is information about the session. There may be at
- most one session-level "i=" field per session description, and at
- most one "i=" field per media. Although it may be omitted, this is
- discouraged for session announcements, and user interfaces for
- composing sessions should require text to be entered. If it is
- present it must contain ISO 10646 characters (but see also the
- `charset' attribute below).
-
- A single "i=" field can also be used for each media definition. In
- media definitions, "i=" fields are primarily intended for labeling
- media streams. As such, they are most likely to be useful when a
-
-
-
-Handley & Jacobson Standards Track [Page 10]
-
-RFC 2327 SDP April 1998
-
-
- single session has more than one distinct media stream of the same
- media type. An example would be two different whiteboards, one for
- slides and one for feedback and questions.
-
- URI
-
- u=<URI>
-
- o A URI is a Universal Resource Identifier as used by WWW clients
-
- o The URI should be a pointer to additional information about the
- conference
-
- o This field is optional, but if it is present it should be specified
- before the first media field
-
- o No more than one URI field is allowed per session description
-
-
- Email Address and Phone Number
-
- e=<email address>
- p=<phone number>
-
- o These specify contact information for the person responsible for
- the conference. This is not necessarily the same person that
- created the conference announcement.
-
- o Either an email field or a phone field must be specified.
- Additional email and phone fields are allowed.
-
- o If these are present, they should be specified before the first
- media field.
-
- o More than one email or phone field can be given for a session
- description.
-
- o Phone numbers should be given in the conventional international
-
- format - preceded by a "+ and the international country code.
- There must be a space or a hyphen ("-") between the country code
- and the rest of the phone number. Spaces and hyphens may be used
- to split up a phone field to aid readability if desired. For
- example:
-
- p=+44-171-380-7777 or p=+1 617 253 6011
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 11]
-
-RFC 2327 SDP April 1998
-
-
- o Both email addresses and phone numbers can have an optional free
- text string associated with them, normally giving the name of the
- person who may be contacted. This should be enclosed in
- parenthesis if it is present. For example:
-
- [email protected] (Mark Handley)
-
- The alternative RFC822 name quoting convention is also allowed for
- both email addresses and phone numbers. For example,
-
- e=Mark Handley <[email protected]>
-
- The free text string should be in the ISO-10646 character set with
- UTF-8 encoding, or alternatively in ISO-8859-1 or other encodings
- if the appropriate charset session-level attribute is set.
-
- Connection Data
-
- c=<network type> <address type> <connection address>
-
- The "c=" field contains connection data.
-
- A session announcement must contain one "c=" field in each media
- description (see below) or a "c=" field at the session-level. It may
- contain a session-level "c=" field and one additional "c=" field per
- media description, in which case the per-media values override the
- session-level settings for the relevant media.
-
- The first sub-field is the network type, which is a text string
- giving the type of network. Initially "IN" is defined to have the
- meaning "Internet".
-
- The second sub-field is the address type. This allows SDP to be used
- for sessions that are not IP based. Currently only IP4 is defined.
-
- The third sub-field is the connection address. Optional extra
- subfields may be added after the connection address depending on the
- value of the <address type> field.
-
- For IP4 addresses, the connection address is defined as follows:
-
- o Typically the connection address will be a class-D IP multicast
-
- group address. If the session is not multicast, then the
- connection address contains the fully-qualified domain name or the
- unicast IP address of the expected data source or data relay or
- data sink as determined by additional attribute fields. It is not
- expected that fully-qualified domain names or unicast addresses
-
-
-
-Handley & Jacobson Standards Track [Page 12]
-
-RFC 2327 SDP April 1998
-
-
- will be given in a session description that is communicated by a
- multicast announcement, though this is not prohibited. If a
- unicast data stream is to pass through a network address
- translator, the use of a fully-qualified domain name rather than an
- unicast IP address is RECOMMENDED. In other cases, the use of an
- IP address to specify a particular interface on a multi-homed host
- might be required. Thus this specification leaves the decision as
- to which to use up to the individual application, but all
- applications MUST be able to cope with receiving both formats.
-
- o Conferences using an IP multicast connection address must also have
- a time to live (TTL) value present in addition to the multicast
- address. The TTL and the address together define the scope with
- which multicast packets sent in this conference will be sent. TTL
- values must be in the range 0-255.
-
- The TTL for the session is appended to the address using a slash as
- a separator. An example is:
-
- c=IN IP4 224.2.1.1/127
-
- Hierarchical or layered encoding schemes are data streams where the
- encoding from a single media source is split into a number of
- layers. The receiver can choose the desired quality (and hence
- bandwidth) by only subscribing to a subset of these layers. Such
- layered encodings are normally transmitted in multiple multicast
- groups to allow multicast pruning. This technique keeps unwanted
- traffic from sites only requiring certain levels of the hierarchy.
- For applications requiring multiple multicast groups, we allow the
- following notation to be used for the connection address:
-
- <base multicast address>/<ttl>/<number of addresses>
-
- If the number of addresses is not given it is assumed to be one.
- Multicast addresses so assigned are contiguously allocated above
- the base address, so that, for example:
-
- c=IN IP4 224.2.1.1/127/3
-
- would state that addresses 224.2.1.1, 224.2.1.2 and 224.2.1.3 are
- to be used at a ttl of 127. This is semantically identical to
- including multiple "c=" lines in a media description:
-
- c=IN IP4 224.2.1.1/127
- c=IN IP4 224.2.1.2/127
- c=IN IP4 224.2.1.3/127
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 13]
-
-RFC 2327 SDP April 1998
-
-
- Multiple addresses or "c=" lines can only be specified on a per-
- media basis, and not for a session-level "c=" field.
-
- It is illegal for the slash notation described above to be used for
- IP unicast addresses.
-
- Bandwidth
-
- b=<modifier>:<bandwidth-value>
-
- o This specifies the proposed bandwidth to be used by the session or
- media, and is optional.
-
- o <bandwidth-value> is in kilobits per second
-
- o <modifier> is a single alphanumeric word giving the meaning of the
- bandwidth figure.
-
- o Two modifiers are initially defined:
-
- CT Conference Total: An implicit maximum bandwidth is associated with
- each TTL on the Mbone or within a particular multicast
- administrative scope region (the Mbone bandwidth vs. TTL limits are
- given in the MBone FAQ). If the bandwidth of a session or media in
- a session is different from the bandwidth implicit from the scope,
- a `b=CT:...' line should be supplied for the session giving the
- proposed upper limit to the bandwidth used. The primary purpose of
- this is to give an approximate idea as to whether two or more
- conferences can co-exist simultaneously.
-
- AS Application-Specific Maximum: The bandwidth is interpreted to be
- application-specific, i.e., will be the application's concept of
- maximum bandwidth. Normally this will coincide with what is set on
- the application's "maximum bandwidth" control if applicable.
-
- Note that CT gives a total bandwidth figure for all the media at
- all sites. AS gives a bandwidth figure for a single media at a
- single site, although there may be many sites sending
- simultaneously.
-
- o Extension Mechanism: Tool writers can define experimental bandwidth
- modifiers by prefixing their modifier with "X-". For example:
-
- b=X-YZ:128
-
- SDP parsers should ignore bandwidth fields with unknown modifiers.
- Modifiers should be alpha-numeric and, although no length limit is
- given, they are recommended to be short.
-
-
-
-Handley & Jacobson Standards Track [Page 14]
-
-RFC 2327 SDP April 1998
-
-
- Times, Repeat Times and Time Zones
-
- t=<start time> <stop time>
-
- o "t=" fields specify the start and stop times for a conference
- session. Multiple "t=" fields may be used if a session is active
- at multiple irregularly spaced times; each additional "t=" field
- specifies an additional period of time for which the session will
- be active. If the session is active at regular times, an "r="
- field (see below) should be used in addition to and following a
- "t=" field - in which case the "t=" field specifies the start and
- stop times of the repeat sequence.
-
- o The first and second sub-fields give the start and stop times for
- the conference respectively. These values are the decimal
- representation of Network Time Protocol (NTP) time values in
- seconds [1]. To convert these values to UNIX time, subtract
- decimal 2208988800.
-
- o If the stop-time is set to zero, then the session is not bounded,
- though it will not become active until after the start-time. If
- the start-time is also zero, the session is regarded as permanent.
-
- User interfaces should strongly discourage the creation of
- unbounded and permanent sessions as they give no information about
- when the session is actually going to terminate, and so make
- scheduling difficult.
-
- The general assumption may be made, when displaying unbounded
- sessions that have not timed out to the user, that an unbounded
- session will only be active until half an hour from the current
- time or the session start time, whichever is the later. If
- behaviour other than this is required, an end-time should be given
- and modified as appropriate when new information becomes available
- about when the session should really end.
-
- Permanent sessions may be shown to the user as never being active
- unless there are associated repeat times which state precisely when
- the session will be active. In general, permanent sessions should
- not be created for any session expected to have a duration of less
- than 2 months, and should be discouraged for sessions expected to
- have a duration of less than 6 months.
-
- r=<repeat interval> <active duration> <list of offsets from start-
- time>
-
- o "r=" fields specify repeat times for a session. For example, if
- a session is active at 10am on Monday and 11am on Tuesday for one
-
-
-
-Handley & Jacobson Standards Track [Page 15]
-
-RFC 2327 SDP April 1998
-
-
- hour each week for three months, then the <start time> in the
- corresponding "t=" field would be the NTP representation of 10am on
- the first Monday, the <repeat interval> would be 1 week, the
- <active duration> would be 1 hour, and the offsets would be zero
- and 25 hours. The corresponding "t=" field stop time would be the
- NTP representation of the end of the last session three months
- later. By default all fields are in seconds, so the "r=" and "t="
- fields might be:
-
- t=3034423619 3042462419
- r=604800 3600 0 90000
-
- To make announcements more compact, times may also be given in units
- of days, hours or minutes. The syntax for these is a number
- immediately followed by a single case-sensitive character.
- Fractional units are not allowed - a smaller unit should be used
- instead. The following unit specification characters are allowed:
-
- d - days (86400 seconds)
- h - minutes (3600 seconds)
- m - minutes (60 seconds)
- s - seconds (allowed for completeness but not recommended)
-
- Thus, the above announcement could also have been written:
-
- r=7d 1h 0 25h
-
- Monthly and yearly repeats cannot currently be directly specified
- with a single SDP repeat time - instead separate "t" fields should
- be used to explicitly list the session times.
-
- z=<adjustment time> <offset> <adjustment time> <offset> ....
-
- o To schedule a repeated session which spans a change from daylight-
- saving time to standard time or vice-versa, it is necessary to
- specify offsets from the base repeat times. This is required
- because different time zones change time at different times of day,
- different countries change to or from daylight time on different
- dates, and some countries do not have daylight saving time at all.
-
- Thus in order to schedule a session that is at the same time winter
- and summer, it must be possible to specify unambiguously by whose
- time zone a session is scheduled. To simplify this task for
- receivers, we allow the sender to specify the NTP time that a time
- zone adjustment happens and the offset from the time when the
- session was first scheduled. The "z" field allows the sender to
- specify a list of these adjustment times and offsets from the base
- time.
-
-
-
-Handley & Jacobson Standards Track [Page 16]
-
-RFC 2327 SDP April 1998
-
-
- An example might be:
-
- z=2882844526 -1h 2898848070 0
-
- This specifies that at time 2882844526 the time base by which the
- session's repeat times are calculated is shifted back by 1 hour,
- and that at time 2898848070 the session's original time base is
- restored. Adjustments are always relative to the specified start
- time - they are not cumulative.
-
- o If a session is likely to last several years, it is expected
- that
- the session announcement will be modified periodically rather than
- transmit several years worth of adjustments in one announcement.
-
- Encryption Keys
-
- k=<method>
- k=<method>:<encryption key>
-
- o The session description protocol may be used to convey encryption
- keys. A key field is permitted before the first media entry (in
- which case it applies to all media in the session), or for each
- media entry as required.
-
- o The format of keys and their usage is outside the scope of this
- document, but see [3].
-
- o The method indicates the mechanism to be used to obtain a usable
- key by external means, or from the encoded encryption key given.
-
- The following methods are defined:
-
- k=clear:<encryption key>
- The encryption key (as described in [3] for RTP media streams
- under the AV profile) is included untransformed in this key
- field.
-
- k=base64:<encoded encryption key>
- The encryption key (as described in [3] for RTP media streams
- under the AV profile) is included in this key field but has been
- base64 encoded because it includes characters that are
- prohibited in SDP.
-
- k=uri:<URI to obtain key>
- A Universal Resource Identifier as used by WWW clients is
- included in this key field. The URI refers to the data
- containing the key, and may require additional authentication
-
-
-
-Handley & Jacobson Standards Track [Page 17]
-
-RFC 2327 SDP April 1998
-
-
- before the key can be returned. When a request is made to the
- given URI, the MIME content-type of the reply specifies the
- encoding for the key in the reply. The key should not be
- obtained until the user wishes to join the session to reduce
- synchronisation of requests to the WWW server(s).
-
- k=prompt
- No key is included in this SDP description, but the session or
- media stream referred to by this key field is encrypted. The
- user should be prompted for the key when attempting to join the
- session, and this user-supplied key should then be used to
- decrypt the media streams.
-
- Attributes
-
- a=<attribute>
- a=<attribute>:<value>
-
- Attributes are the primary means for extending SDP. Attributes may
- be defined to be used as "session-level" attributes, "media-level"
- attributes, or both.
-
- A media description may have any number of attributes ("a=" fields)
- which are media specific. These are referred to as "media-level"
- attributes and add information about the media stream. Attribute
- fields can also be added before the first media field; these
- "session-level" attributes convey additional information that applies
- to the conference as a whole rather than to individual media; an
- example might be the conference's floor control policy.
-
- Attribute fields may be of two forms:
-
- o property attributes. A property attribute is simply of the form
- "a=<flag>". These are binary attributes, and the presence of the
- attribute conveys that the attribute is a property of the session.
- An example might be "a=recvonly".
-
- o value attributes. A value attribute is of the form
- "a=<attribute>:<value>". An example might be that a whiteboard
- could have the value attribute "a=orient:landscape"
-
- Attribute interpretation depends on the media tool being invoked.
- Thus receivers of session descriptions should be configurable in
- their interpretation of announcements in general and of attributes in
- particular.
-
- Attribute names must be in the US-ASCII subset of ISO-10646/UTF-8.
-
-
-
-
-Handley & Jacobson Standards Track [Page 18]
-
-RFC 2327 SDP April 1998
-
-
- Attribute values are byte strings, and MAY use any byte value except
- 0x00 (Nul), 0x0A (LF), and 0x0D (CR). By default, attribute values
- are to be interpreted as in ISO-10646 character set with UTF-8
- encoding. Unlike other text fields, attribute values are NOT
- normally affected by the `charset' attribute as this would make
- comparisons against known values problematic. However, when an
- attribute is defined, it can be defined to be charset-dependent, in
- which case it's value should be interpreted in the session charset
- rather than in ISO-10646.
-
- Attributes that will be commonly used can be registered with IANA
- (see Appendix B). Unregistered attributes should begin with "X-" to
- prevent inadvertent collision with registered attributes. In either
- case, if an attribute is received that is not understood, it should
- simply be ignored by the receiver.
-
- Media Announcements
-
- m=<media> <port> <transport> <fmt list>
-
- A session description may contain a number of media descriptions.
- Each media description starts with an "m=" field, and is terminated
- by either the next "m=" field or by the end of the session
- description. A media field also has several sub-fields:
-
- o The first sub-field is the media type. Currently defined media are
- "audio", "video", "application", "data" and "control", though this
- list may be extended as new communication modalities emerge (e.g.,
- telepresense). The difference between "application" and "data" is
- that the former is a media flow such as whiteboard information, and
- the latter is bulk-data transfer such as multicasting of program
- executables which will not typically be displayed to the user.
- "control" is used to specify an additional conference control
- channel for the session.
-
- o The second sub-field is the transport port to which the media
- stream will be sent. The meaning of the transport port depends on
- the network being used as specified in the relevant "c" field and
- on the transport protocol defined in the third sub-field. Other
- ports used by the media application (such as the RTCP port, see
- [2]) should be derived algorithmically from the base media port.
-
- Note: For transports based on UDP, the value should be in the range
- 1024 to 65535 inclusive. For RTP compliance it should be an even
- number.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 19]
-
-RFC 2327 SDP April 1998
-
-
- For applications where hierarchically encoded streams are being
- sent to a unicast address, it may be necessary to specify multiple
- transport ports. This is done using a similar notation to that
- used for IP multicast addresses in the "c=" field:
-
- m=<media> <port>/<number of ports> <transport> <fmt list>
-
- In such a case, the ports used depend on the transport protocol.
- For RTP, only the even ports are used for data and the
- corresponding one-higher odd port is used for RTCP. For example:
-
- m=video 49170/2 RTP/AVP 31
-
- would specify that ports 49170 and 49171 form one RTP/RTCP pair and
- 49172 and 49173 form the second RTP/RTCP pair. RTP/AVP is the
- transport protocol and 31 is the format (see below).
-
- It is illegal for both multiple addresses to be specified in the
- "c=" field and for multiple ports to be specified in the "m=" field
- in the same session description.
-
- o The third sub-field is the transport protocol. The transport
- protocol values are dependent on the address-type field in the "c="
- fields. Thus a "c=" field of IP4 defines that the transport
- protocol runs over IP4. For IP4, it is normally expected that most
- media traffic will be carried as RTP over UDP. The following
- transport protocols are preliminarily defined, but may be extended
- through registration of new protocols with IANA:
-
- - RTP/AVP - the IETF's Realtime Transport Protocol using the
- Audio/Video profile carried over UDP.
-
- - udp - User Datagram Protocol
-
- If an application uses a single combined proprietary media format
- and transport protocol over UDP, then simply specifying the
- transport protocol as udp and using the format field to distinguish
- the combined protocol is recommended. If a transport protocol is
- used over UDP to carry several distinct media types that need to be
- distinguished by a session directory, then specifying the transport
- protocol and media format separately is necessary. RTP is an
- example of a transport-protocol that carries multiple payload
- formats that must be distinguished by the session directory for it
- to know how to start appropriate tools, relays, mixers or
- recorders.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 20]
-
-RFC 2327 SDP April 1998
-
-
- The main reason to specify the transport-protocol in addition to
- the media format is that the same standard media formats may be
- carried over different transport protocols even when the network
- protocol is the same - a historical example is vat PCM audio and
- RTP PCM audio. In addition, relays and monitoring tools that are
- transport-protocol-specific but format-independent are possible.
-
- For RTP media streams operating under the RTP Audio/Video Profile
- [3], the protocol field is "RTP/AVP". Should other RTP profiles be
- defined in the future, their profiles will be specified in the same
- way. For example, the protocol field "RTP/XYZ" would specify RTP
- operating under a profile whose short name is "XYZ".
-
- o The fourth and subsequent sub-fields are media formats. For audio
- and video, these will normally be a media payload type as defined
- in the RTP Audio/Video Profile.
-
- When a list of payload formats is given, this implies that all of
- these formats may be used in the session, but the first of these
- formats is the default format for the session.
-
- For media whose transport protocol is not RTP or UDP the format
- field is protocol specific. Such formats should be defined in an
- additional specification document.
-
- For media whose transport protocol is RTP, SDP can be used to
- provide a dynamic binding of media encoding to RTP payload type.
- The encoding names in the RTP AV Profile do not specify unique
- audio encodings (in terms of clock rate and number of audio
- channels), and so they are not used directly in SDP format fields.
- Instead, the payload type number should be used to specify the
- format for static payload types and the payload type number along
- with additional encoding information should be used for dynamically
- allocated payload types.
-
- An example of a static payload type is u-law PCM coded single
- channel audio sampled at 8KHz. This is completely defined in the
- RTP Audio/Video profile as payload type 0, so the media field for
- such a stream sent to UDP port 49232 is:
-
- m=video 49232 RTP/AVP 0
-
- An example of a dynamic payload type is 16 bit linear encoded
- stereo audio sampled at 16KHz. If we wish to use dynamic RTP/AVP
- payload type 98 for such a stream, additional information is
- required to decode it:
-
- m=video 49232 RTP/AVP 98
-
-
-
-Handley & Jacobson Standards Track [Page 21]
-
-RFC 2327 SDP April 1998
-
-
- a=rtpmap:98 L16/16000/2
-
- The general form of an rtpmap attribute is:
-
- a=rtpmap:<payload type> <encoding name>/<clock rate>[/<encoding
- parameters>]
-
- For audio streams, <encoding parameters> may specify the number of
- audio channels. This parameter may be omitted if the number of
- channels is one provided no additional parameters are needed. For
- video streams, no encoding parameters are currently specified.
-
- Additional parameters may be defined in the future, but
- codecspecific parameters should not be added. Parameters added to
- an rtpmap attribute should only be those required for a session
- directory to make the choice of appropriate media too to
- participate in a session. Codec-specific parameters should be
- added in other attributes.
-
- Up to one rtpmap attribute can be defined for each media format
- specified. Thus we might have:
-
- m=audio 49230 RTP/AVP 96 97 98
- a=rtpmap:96 L8/8000
- a=rtpmap:97 L16/8000
- a=rtpmap:98 L16/11025/2
-
- RTP profiles that specify the use of dynamic payload types must
- define the set of valid encoding names and/or a means to register
- encoding names if that profile is to be used with SDP.
-
- Experimental encoding formats can also be specified using rtpmap.
- RTP formats that are not registered as standard format names must
- be preceded by "X-". Thus a new experimental redundant audio
- stream called GSMLPC using dynamic payload type 99 could be
- specified as:
-
- m=video 49232 RTP/AVP 99
- a=rtpmap:99 X-GSMLPC/8000
-
- Such an experimental encoding requires that any site wishing to
- receive the media stream has relevant configured state in its
- session directory to know which tools are appropriate.
-
- Note that RTP audio formats typically do not include information
- about the number of samples per packet. If a non-default (as
- defined in the RTP Audio/Video Profile) packetisation is required,
- the "ptime" attribute is used as given below.
-
-
-
-Handley & Jacobson Standards Track [Page 22]
-
-RFC 2327 SDP April 1998
-
-
- For more details on RTP audio and video formats, see [3].
-
- o Formats for non-RTP media should be registered as MIME content
- types as described in Appendix B. For example, the LBL whiteboard
- application might be registered as MIME content-type application/wb
- with encoding considerations specifying that it operates over UDP,
- with no appropriate file format. In SDP this would then be
- expressed using a combination of the "media" field and the "fmt"
- field, as follows:
-
- m=application 32416 udp wb
-
- Suggested Attributes
-
- The following attributes are suggested. Since application writers
- may add new attributes as they are required, this list is not
- exhaustive.
-
- a=cat:<category>
- This attribute gives the dot-separated hierarchical category of
- the session. This is to enable a receiver to filter unwanted
- sessions by category. It would probably have been a compulsory
- separate field, except for its experimental nature at this time.
- It is a session-level attribute, and is not dependent on charset.
-
- a=keywds:<keywords>
- Like the cat attribute, this is to assist identifying wanted
- sessions at the receiver. This allows a receiver to select
- interesting session based on keywords describing the purpose of
- the session. It is a session-level attribute. It is a charset
- dependent attribute, meaning that its value should be interpreted
- in the charset specified for the session description if one is
- specified, or by default in ISO 10646/UTF-8.
-
- a=tool:<name and version of tool>
- This gives the name and version number of the tool used to create
- the session description. It is a session-level attribute, and is
- not dependent on charset.
-
- a=ptime:<packet time>
- This gives the length of time in milliseconds represented by the
- media in a packet. This is probably only meaningful for audio
- data. It should not be necessary to know ptime to decode RTP or
- vat audio, and it is intended as a recommendation for the
- encoding/packetisation of audio. It is a media attribute, and is
- not dependent on charset.
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 23]
-
-RFC 2327 SDP April 1998
-
-
- a=recvonly
- This specifies that the tools should be started in receive-only
- mode where applicable. It can be either a session or media
- attribute, and is not dependent on charset.
-
- a=sendrecv
- This specifies that the tools should be started in send and
- receive mode. This is necessary for interactive conferences with
- tools such as wb which defaults to receive only mode. It can be
- either a session or media attribute, and is not dependent on
- charset.
-
- a=sendonly
- This specifies that the tools should be started in send-only
- mode. An example may be where a different unicast address is to
- be used for a traffic destination than for a traffic source. In
- such a case, two media descriptions may be use, one sendonly and
- one recvonly. It can be either a session or media attribute, but
- would normally only be used as a media attribute, and is not
- dependent on charset.
-
- a=orient:<whiteboard orientation>
- Normally this is only used in a whiteboard media specification.
- It specifies the orientation of a the whiteboard on the screen.
- It is a media attribute. Permitted values are `portrait',
- `landscape' and `seascape' (upside down landscape). It is not
- dependent on charset
-
- a=type:<conference type>
- This specifies the type of the conference. Suggested values are
- `broadcast', `meeting', `moderated', `test' and `H332'.
- `recvonly' should be the default for `type:broadcast' sessions,
- `type:meeting' should imply `sendrecv' and `type:moderated'
- should indicate the use of a floor control tool and that the
- media tools are started so as to "mute" new sites joining the
- conference.
-
- Specifying the attribute type:H332 indicates that this loosely
- coupled session is part of a H.332 session as defined in the ITU
- H.332 specification [10]. Media tools should be started
- `recvonly'.
-
- Specifying the attribute type:test is suggested as a hint that,
- unless explicitly requested otherwise, receivers can safely avoid
- displaying this session description to users.
-
- The type attribute is a session-level attribute, and is not
- dependent on charset.
-
-
-
-Handley & Jacobson Standards Track [Page 24]
-
-RFC 2327 SDP April 1998
-
-
- a=charset:<character set>
- This specifies the character set to be used to display the
- session name and information data. By default, the ISO-10646
- character set in UTF-8 encoding is used. If a more compact
- representation is required, other character sets may be used such
- as ISO-8859-1 for Northern European languages. In particular,
- the ISO 8859-1 is specified with the following SDP attribute:
-
- a=charset:ISO-8859-1
-
- This is a session-level attribute; if this attribute is present,
- it must be before the first media field. The charset specified
- MUST be one of those registered with IANA, such as ISO-8859-1.
- The character set identifier is a US-ASCII string and MUST be
- compared against the IANA identifiers using a case-insensitive
- comparison. If the identifier is not recognised or not
- supported, all strings that are affected by it SHOULD be regarded
- as byte strings.
-
- Note that a character set specified MUST still prohibit the use
- of bytes 0x00 (Nul), 0x0A (LF) and 0x0d (CR). Character sets
- requiring the use of these characters MUST define a quoting
- mechanism that prevents these bytes appearing within text fields.
-
- a=sdplang:<language tag>
- This can be a session level attribute or a media level attribute.
- As a session level attribute, it specifies the language for the
- session description. As a media level attribute, it specifies
- the language for any media-level SDP information field associated
- with that media. Multiple sdplang attributes can be provided
- either at session or media level if multiple languages in the
- session description or media use multiple languages, in which
- case the order of the attributes indicates the order of
- importance of the various languages in the session or media from
- most important to least important.
-
- In general, sending session descriptions consisting of multiple
- languages should be discouraged. Instead, multiple descriptions
- should be sent describing the session, one in each language.
- However this is not possible with all transport mechanisms, and
- so multiple sdplang attributes are allowed although not
- recommended.
-
- The sdplang attribute value must be a single RFC 1766 language
- tag in US-ASCII. It is not dependent on the charset attribute.
- An sdplang attribute SHOULD be specified when a session is of
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 25]
-
-RFC 2327 SDP April 1998
-
-
- sufficient scope to cross geographic boundaries where the
- language of recipients cannot be assumed, or where the session is
- in a different language from the locally assumed norm.
-
- a=lang:<language tag>
- This can be a session level attribute or a media level attribute.
- As a session level attribute, it specifies the default language
- for the session being described. As a media level attribute, it
- specifies the language for that media, overriding any session-
- level language specified. Multiple lang attributes can be
- provided either at session or media level if multiple languages
- if the session description or media use multiple languages, in
- which case the order of the attributes indicates the order of
- importance of the various languages in the session or media from
- most important to least important.
-
- The lang attribute value must be a single RFC 1766 language tag
- in US-ASCII. It is not dependent on the charset attribute. A
- lang attribute SHOULD be specified when a session is of
- sufficient scope to cross geographic boundaries where the
- language of recipients cannot be assumed, or where the session is
- in a different language from the locally assumed norm.
-
- a=framerate:<frame rate>
- This gives the maximum video frame rate in frames/sec. It is
- intended as a recommendation for the encoding of video data.
- Decimal representations of fractional values using the notation
- "<integer>.<fraction>" are allowed. It is a media attribute, is
- only defined for video media, and is not dependent on charset.
-
- a=quality:<quality>
- This gives a suggestion for the quality of the encoding as an
- integer value.
-
- The intention of the quality attribute for video is to specify a
- non-default trade-off between frame-rate and still-image quality.
- For video, the value in the range 0 to 10, with the following
- suggested meaning:
-
- 10 - the best still-image quality the compression scheme can
- give.
-
- 5 - the default behaviour given no quality suggestion.
-
- 0 - the worst still-image quality the codec designer thinks is
- still usable.
-
- It is a media attribute, and is not dependent on charset.
-
-
-
-Handley & Jacobson Standards Track [Page 26]
-
-RFC 2327 SDP April 1998
-
-
- a=fmtp:<format> <format specific parameters>
- This attribute allows parameters that are specific to a
- particular format to be conveyed in a way that SDP doesn't have
- to understand them. The format must be one of the formats
- specified for the media. Format-specific parameters may be any
- set of parameters required to be conveyed by SDP and given
- unchanged to the media tool that will use this format.
-
- It is a media attribute, and is not dependent on charset.
-
-6.1. Communicating Conference Control Policy
-
- There is some debate over the way conference control policy should be
- communicated. In general, the authors believe that an implicit
- declarative style of specifying conference control is desirable where
- possible.
-
- A simple declarative style uses a single conference attribute field
- before the first media field, possibly supplemented by properties
- such as `recvonly' for some of the media tools. This conference
- attribute conveys the conference control policy. An example might be:
-
- a=type:moderated
-
- In some cases, however, it is possible that this may be insufficient
- to communicate the details of an unusual conference control policy.
- If this is the case, then a conference attribute specifying external
- control might be set, and then one or more "media" fields might be
- used to specify the conference control tools and configuration data
- for those tools. An example is an ITU H.332 session:
-
- c=IN IP4 224.5.6.7
- a=type:H332
- m=audio 49230 RTP/AVP 0
- m=video 49232 RTP/AVP 31
- m=application 12349 udp wb
- m=control 49234 H323 mc
- c=IN IP4 134.134.157.81
-
- In this example, a general conference attribute (type:H332) is
- specified stating that conference control will be provided by an
- external H.332 tool, and a contact addresses for the H.323 session
- multipoint controller is given.
-
- In this document, only the declarative style of conference control
- declaration is specified. Other forms of conference control should
- specify an appropriate type attribute, and should define the
- implications this has for control media.
-
-
-
-Handley & Jacobson Standards Track [Page 27]
-
-RFC 2327 SDP April 1998
-
-
-7. Security Considerations
-
- SDP is a session description format that describes multimedia
- sessions. A session description should not be trusted unless it has
- been obtained by an authenticated transport protocol from a trusted
- source. Many different transport protocols may be used to distribute
- session description, and the nature of the authentication will differ
- from transport to transport.
-
- One transport that will frequently be used to distribute session
- descriptions is the Session Announcement Protocol (SAP). SAP
- provides both encryption and authentication mechanisms but due to the
- nature of session announcements it is likely that there are many
- occasions where the originator of a session announcement cannot be
- authenticated because they are previously unknown to the receiver of
- the announcement and because no common public key infrastructure is
- available.
-
- On receiving a session description over an unauthenticated transport
- mechanism or from an untrusted party, software parsing the session
- should take a few precautions. Session description contain
- information required to start software on the receivers system.
- Software that parses a session description MUST not be able to start
- other software except that which is specifically configured as
- appropriate software to participate in multimedia sessions. It is
- normally considered INAPPROPRIATE for software parsing a session
- description to start, on a user's system, software that is
- appropriate to participate in multimedia sessions, without the user
- first being informed that such software will be started and giving
- their consent. Thus a session description arriving by session
- announcement, email, session invitation, or WWW page SHOULD not
- deliver the user into an {it interactive} multimedia session without
- the user being aware that this will happen. As it is not always
- simple to tell whether a session is interactive or not, applications
- that are unsure should assume sessions are interactive.
-
- In this specification, there are no attributes which would allow the
- recipient of a session description to be informed to start multimedia
- tools in a mode where they default to transmitting. Under some
- circumstances it might be appropriate to define such attributes. If
- this is done an application parsing a session description containing
- such attributes SHOULD either ignore them, or inform the user that
- joining this session will result in the automatic transmission of
- multimedia data. The default behaviour for an unknown attribute is
- to ignore it.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 28]
-
-RFC 2327 SDP April 1998
-
-
- Session descriptions may be parsed at intermediate systems such as
- firewalls for the purposes of opening a hole in the firewall to allow
- the participation in multimedia sessions. It is considered
- INAPPROPRIATE for a firewall to open such holes for unicast data
- streams unless the session description comes in a request from inside
- the firewall.
-
- For multicast sessions, it is likely that local administrators will
- apply their own policies, but the exclusive use of "local" or "site-
- local" administrative scope within the firewall and the refusal of
- the firewall to open a hole for such scopes will provide separation
- of global multicast sessions from local ones.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 29]
-
-RFC 2327 SDP April 1998
-
-
-Appendix A: SDP Grammar
-
- This appendix provides an Augmented BNF grammar for SDP. ABNF is
- defined in RFC 2234.
-
-
- announcement = proto-version
- origin-field
- session-name-field
- information-field
- uri-field
- email-fields
- phone-fields
- connection-field
- bandwidth-fields
- time-fields
- key-field
- attribute-fields
- media-descriptions
-
- proto-version = "v=" 1*DIGIT CRLF
- ;this memo describes version 0
-
- origin-field = "o=" username space
- sess-id space sess-version space
- nettype space addrtype space
- addr CRLF
-
- session-name-field = "s=" text CRLF
-
- information-field = ["i=" text CRLF]
-
- uri-field = ["u=" uri CRLF]
-
- email-fields = *("e=" email-address CRLF)
-
- phone-fields = *("p=" phone-number CRLF)
-
-
- connection-field = ["c=" nettype space addrtype space
- connection-address CRLF]
- ;a connection field must be present
- ;in every media description or at the
- ;session-level
-
-
- bandwidth-fields = *("b=" bwtype ":" bandwidth CRLF)
-
-
-
-
-Handley & Jacobson Standards Track [Page 30]
-
-RFC 2327 SDP April 1998
-
-
- time-fields = 1*( "t=" start-time space stop-time
- *(CRLF repeat-fields) CRLF)
- [zone-adjustments CRLF]
-
-
- repeat-fields = "r=" repeat-interval space typed-time
- 1*(space typed-time)
-
-
- zone-adjustments = time space ["-"] typed-time
- *(space time space ["-"] typed-time)
-
-
- key-field = ["k=" key-type CRLF]
-
-
- key-type = "prompt" |
- "clear:" key-data |
- "base64:" key-data |
- "uri:" uri
-
-
- key-data = email-safe | "~" | "
-
-
- attribute-fields = *("a=" attribute CRLF)
-
-
- media-descriptions = *( media-field
- information-field
- *(connection-field)
- bandwidth-fields
- key-field
- attribute-fields )
-
-
- media-field = "m=" media space port ["/" integer]
- space proto 1*(space fmt) CRLF
-
-
- media = 1*(alpha-numeric)
- ;typically "audio", "video", "application"
- ;or "data"
-
- fmt = 1*(alpha-numeric)
- ;typically an RTP payload type for audio
- ;and video media
-
-
-
-
-Handley & Jacobson Standards Track [Page 31]
-
-RFC 2327 SDP April 1998
-
-
- proto = 1*(alpha-numeric)
- ;typically "RTP/AVP" or "udp" for IP4
-
-
- port = 1*(DIGIT)
- ;should in the range "1024" to "65535" inclusive
- ;for UDP based media
-
-
- attribute = (att-field ":" att-value) | att-field
-
-
- att-field = 1*(alpha-numeric)
-
-
- att-value = byte-string
-
-
- sess-id = 1*(DIGIT)
- ;should be unique for this originating username/host
-
-
- sess-version = 1*(DIGIT)
- ;0 is a new session
-
-
- connection-address = multicast-address
- | addr
-
-
- multicast-address = 3*(decimal-uchar ".") decimal-uchar "/" ttl
- [ "/" integer ]
- ;multicast addresses may be in the range
- ;224.0.0.0 to 239.255.255.255
-
- ttl = decimal-uchar
-
- start-time = time | "0"
-
- stop-time = time | "0"
-
- time = POS-DIGIT 9*(DIGIT)
- ;sufficient for 2 more centuries
-
-
- repeat-interval = typed-time
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 32]
-
-RFC 2327 SDP April 1998
-
-
- typed-time = 1*(DIGIT) [fixed-len-time-unit]
-
-
- fixed-len-time-unit = "d" | "h" | "m" | "s"
-
-
- bwtype = 1*(alpha-numeric)
-
- bandwidth = 1*(DIGIT)
-
-
- username = safe
- ;pretty wide definition, but doesn't include space
-
-
- email-address = email | email "(" email-safe ")" |
- email-safe "<" email ">"
-
-
- email = ;defined in RFC822
-
-
- uri= ;defined in RFC1630
-
-
- phone-number = phone | phone "(" email-safe ")" |
- email-safe "<" phone ">"
-
-
- phone = "+" POS-DIGIT 1*(space | "-" | DIGIT)
- ;there must be a space or hyphen between the
- ;international code and the rest of the number.
-
-
- nettype = "IN"
- ;list to be extended
-
-
- addrtype = "IP4" | "IP6"
- ;list to be extended
-
-
- addr = FQDN | unicast-address
-
-
- FQDN = 4*(alpha-numeric|"-"|".")
- ;fully qualified domain name as specified in RFC1035
-
-
-
-
-Handley & Jacobson Standards Track [Page 33]
-
-RFC 2327 SDP April 1998
-
-
- unicast-address = IP4-address | IP6-address
-
-
- IP4-address = b1 "." decimal-uchar "." decimal-uchar "." b4
- b1 = decimal-uchar
- ;less than "224"; not "0" or "127"
- b4 = decimal-uchar
- ;not "0"
-
- IP6-address = ;to be defined
-
-
- text = byte-string
- ;default is to interpret this as IS0-10646 UTF8
- ;ISO 8859-1 requires a "a=charset:ISO-8859-1"
- ;session-level attribute to be used
-
-
- byte-string = 1*(0x01..0x09|0x0b|0x0c|0x0e..0xff)
- ;any byte except NUL, CR or LF
-
-
- decimal-uchar = DIGIT
- | POS-DIGIT DIGIT
- | ("1" 2*(DIGIT))
- | ("2" ("0"|"1"|"2"|"3"|"4") DIGIT)
- | ("2" "5" ("0"|"1"|"2"|"3"|"4"|"5"))
-
-
- integer = POS-DIGIT *(DIGIT)
-
-
- alpha-numeric = ALPHA | DIGIT
-
-
- DIGIT = "0" | POS-DIGIT
-
-
- POS-DIGIT = "1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"
-
-
- ALPHA = "a"|"b"|"c"|"d"|"e"|"f"|"g"|"h"|"i"|"j"|"k"|
- "l"|"m"|"n"|"o "|"p"|"q"|"r"|"s"|"t"|"u"|"v"|
- "w"|"x"|"y"|"z"|"A"|"B"|"C "|"D"|"E"|"F"|"G"|
- "H"|"I"|"J"|"K"|"L"|"M"|"N"|"O"|"P"|" Q"|"R"|
- "S"|"T"|"U"|"V"|"W"|"X"|"Y"|"Z"
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 34]
-
-RFC 2327 SDP April 1998
-
-
- email-safe = safe | space | tab
-
-
- safe = alpha-numeric |
- "'" | "'" | "-" | "." | "/" | ":" | "?" | """ |
- "#" | "$" | "&" | "*" | ";" | "=" | "@" | "[" |
- "]" | "^" | "_" | "`" | "{" | "|" | "}" | "+" |
- "~" | "
-
-
- space = %d32
- tab = %d9
- CRLF = %d13.10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 35]
-
-RFC 2327 SDP April 1998
-
-
-Appendix B: Guidelines for registering SDP names with IANA
-
- There are seven field names that may be registered with IANA. Using
- the terminology in the SDP specification BNF, they are "media",
- "proto", "fmt", "att-field", "bwtype", "nettype" and "addrtype".
-
- "media" (eg, audio, video, application, data).
-
- Packetized media types, such as those used by RTP, share the
- namespace used by media types registry [RFC 2048] (i.e. "MIME
- types"). The list of valid media names is the set of top-level
- MIME content types. The set of media is intended to be small and
- not to be extended except under rare circumstances. (The MIME
- subtype corresponds to the "fmt" parameter below).
-
- "proto"
-
- In general this should be an IETF standards-track transport
- protocol identifier such as RTP/AVP (rfc 1889 under the rfc 1890
- profile).
-
- However, people will want to invent their own proprietary
- transport protocols. Some of these should be registered as a
- "fmt" using "udp" as the protocol and some of which probably
- can't be.
-
- Where the protocol and the application are intimately linked,
- such as with the LBL whiteboard wb which used a proprietary and
- special purpose protocol over UDP, the protocol name should be
- "udp" and the format name that should be registered is "wb". The
- rules for formats (see below) apply to such registrations.
-
- Where the proprietary transport protocol really carries many
- different data formats, it is possible to register a new protocol
- name with IANA. In such a case, an RFC MUST be produced
- describing the protocol and referenced in the registration. Such
- an RFC MAY be informational, although it is preferable if it is
- standards-track.
-
- "fmt"
-
- The format namespace is dependent on the context of the "proto"
- field, so a format cannot be registered without specifying one or
- more transport protocols that it applies to.
-
- Formats cover all the possible encodings that might want to be
- transported in a multimedia session.
-
-
-
-
-Handley & Jacobson Standards Track [Page 36]
-
-RFC 2327 SDP April 1998
-
-
- For RTP formats that have been assigned static payload types, the
- payload type number is used. For RTP formats using a dynamic
- payload type number, the dynamic payload type number is given as
- the format and an additional "rtpmap" attribute specifies the
- format and parameters.
-
- For non-RTP formats, any unregistered format name may be
- registered through the MIME-type registration process [RFC 2048].
- The type given here is the MIME subtype only (the top-level MIME
- content type is specified by the media parameter). The MIME type
- registration SHOULD reference a standards-track RFC which
- describes the transport protocol for this media type. If there
- is an existing MIME type for this format, the MIME registration
- should be augmented to reference the transport specification for
- this media type. If there is not an existing MIME type for this
- format, and there exists no appropriate file format, this should
- be noted in the encoding considerations as "no appropriate file
- format".
-
- "att-field" (Attribute names)
-
- Attribute field names MAY be registered with IANA, although this
- is not compulsory, and unknown attributes are simply ignored.
-
- When an attribute is registered, it must be accompanied by a
- brief specification stating the following:
-
- o contact name, email address and telephone number
-
- o attribute-name (as it will appear in SDP)
-
- o long-form attribute name in English
-
- o type of attribute (session level, media level, or both)
-
- o whether the attribute value is subject to the charset
- attribute.
-
- o a one paragraph explanation of the purpose of the attribute.
-
- o a specification of appropriate attribute values for this
- attribute.
-
- IANA will not sanity check such attribute registrations except to
- ensure that they do not clash with existing registrations.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 37]
-
-RFC 2327 SDP April 1998
-
-
- Although the above is the minimum that IANA will accept, if the
- attribute is expected to see widespread use and interoperability
- is an issue, authors are encouraged to produce a standards-track
- RFC that specifies the attribute more precisely.
-
- Submitters of registrations should ensure that the specification
- is in the spirit of SDP attributes, most notably that the
- attribute is platform independent in the sense that it makes no
- implicit assumptions about operating systems and does not name
- specific pieces of software in a manner that might inhibit
- interoperability.
-
- "bwtype" (bandwidth specifiers)
-
- A proliferation of bandwidth specifiers is strongly discouraged.
-
- New bandwidth specifiers may be registered with IANA. The
- submission MUST reference a standards-track RFC specifying the
- semantics of the bandwidth specifier precisely, and indicating
- when it should be used, and why the existing registered bandwidth
- specifiers do not suffice.
-
- "nettype" (Network Type)
-
- New network types may be registered with IANA if SDP needs to be
- used in the context of non-internet environments. Whilst these
- are not normally the preserve of IANA, there may be circumstances
- when an Internet application needs to interoperate with a non-
- internet application, such as when gatewaying an internet
- telephony call into the PSTN. The number of network types should
- be small and should be rarely extended. A new network type
- cannot be registered without registering at least one address
- type to be used with that network type. A new network type
- registration MUST reference an RFC which gives details of the
- network type and address type and specifies how and when they
- would be used. Such an RFC MAY be Informational.
-
- "addrtype" (Address Type)
-
- New address types may be registered with IANA. An address type
- is only meaningful in the context of a network type, and any
- registration of an address type MUST specify a registered network
- type, or be submitted along with a network type registration. A
- new address type registration MUST reference an RFC giving
- details of the syntax of the address type. Such an RFC MAY be
- Informational. Address types are not expected to be registered
- frequently.
-
-
-
-
-Handley & Jacobson Standards Track [Page 38]
-
-RFC 2327 SDP April 1998
-
-
- Registration Procedure
-
- To register a name the above guidelines should be followed regarding
- the required level of documentation that is required. The
- registration itself should be sent to IANA. Attribute registrations
- should include the information given above. Other registrations
- should include the following additional information:
-
- o contact name, email address and telephone number
-
- o name being registered (as it will appear in SDP)
-
- o long-form name in English
-
- o type of name ("media", "proto", "fmt", "bwtype", "nettype", or
- "addrtype")
-
- o a one paragraph explanation of the purpose of the registered name.
-
- o a reference to the specification (eg RFC number) of the registered
- name.
-
- IANA may refer any registration to the IESG or to any appropriate
- IETF working group for review, and may request revisions to be made
- before a registration will be made.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 39]
-
-RFC 2327 SDP April 1998
-
-
-Appendix C: Authors' Addresses
-
- Mark Handley
- Information Sciences Institute
- c/o MIT Laboratory for Computer Science
- 545 Technology Square
- Cambridge, MA 02139
- United States
- electronic mail: [email protected]
-
- Van Jacobson
- MS 46a-1121
- Lawrence Berkeley Laboratory
- Berkeley, CA 94720
- United States
- electronic mail: [email protected]
-
-Acknowledgments
-
- Many people in the IETF MMUSIC working group have made comments and
- suggestions contributing to this document. In particular, we would
- like to thank Eve Schooler, Steve Casner, Bill Fenner, Allison
- Mankin, Ross Finlayson, Peter Parnes, Joerg Ott, Carsten Bormann, Rob
- Lanphier and Steve Hanna.
-
-References
-
- [1] Mills, D., "Network Time Protocol (version 3) specification and
- implementation", RFC 1305, March 1992.
-
- [2] Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson, "RTP:
- A Transport Protocol for Real-Time Applications", RFC 1889, January
- 1996.
-
- [3] Schulzrinne, H., "RTP Profile for Audio and Video Conferences
- with Minimal Control", RFC 1890, January 1996
-
- [4] Handley, M., "SAP - Session Announcement Protocol", Work in
- Progress.
-
- [5] V. Jacobson, S. McCanne, "vat - X11-based audio teleconferencing
- tool" vat manual page, Lawrence Berkeley Laboratory, 1994.
-
- [6] The Unicode Consortium, "The Unicode Standard -- Version 2.0",
- Addison-Wesley, 1996.
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 40]
-
-RFC 2327 SDP April 1998
-
-
- [7] ISO/IEC 10646-1:1993. International Standard -- Information
- technol- ogy -- Universal Multiple-Octet Coded Character Set (UCS) --
- Part 1: Architecture and Basic Multilingual Plane. Five amendments
- and a techn- ical corrigendum have been published up to now. UTF-8
- is described in Annex R, published as Amendment 2.
-
- [8] Goldsmith, D., and M. Davis, "Using Unicode with MIME", RFC 1641,
- July 1994.
-
- [9] Yergeau, F., "UTF-8, a transformation format of Unicode and ISO
- 10646", RFC 2044, October 1996.
-
- [10] ITU-T Recommendation H.332 (1998): "Multimedia Terminal for
- Receiving Internet-based H.323 Conferences", ITU, Geneva.
-
- [11] Handley, M., Schooler, E., and H. Schulzrinne, "Session
- Initiation Protocol (SIP)", Work in Progress.
-
- [12] Schulzrinne, H., Rao, A., and R. Lanphier, "Real Time Streaming
- Protocol (RTSP)", RFC 2326, April 1998.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 41]
-
-RFC 2327 SDP April 1998
-
-
-Full Copyright Statement
-
- Copyright (C) The Internet Society (1998). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Handley & Jacobson Standards Track [Page 42]
-
diff --git a/lib/megaco/doc/standard/rfc3266.txt b/lib/megaco/doc/standard/rfc3266.txt
deleted file mode 100644
index f047f12a1f..0000000000
--- a/lib/megaco/doc/standard/rfc3266.txt
+++ /dev/null
@@ -1,283 +0,0 @@
-
-
-
-
-
-
-Network Working Group S. Olson
-Request for Comments: 3266 Microsoft
-Updates: 2327 G. Camarillo
-Category: Standards Track Ericsson
- A. B. Roach
- dynamicsoft
- June 2002
-
-
- Support for IPv6 in Session Description Protocol (SDP)
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Copyright Notice
-
- Copyright (C) The Internet Society (2002). All Rights Reserved.
-
-Abstract
-
- This document describes the use of Internet Protocol Version 6 (IPv6)
- addresses in conjunction with the Session Description Protocol (SDP).
- Specifically, this document clarifies existing text in SDP with
- regards to the syntax of IPv6 addresses.
-
-1. Introduction
-
- SDP is intended for describing multimedia sessions for the purposes
- of session announcement, session invitation, and other forms of
- multimedia session initiation. It is a text format description that
- provides many details of a multimedia session including: the
- originator of the session, a URL related to the session, the
- connection address for the session media(s), and optional attributes
- for the session media(s). Each of these pieces of information may
- involve one or more IPv6 addresses. The ABNF for IP addresses in SDP
- currently leaves the syntax for IPv6 addresses undefined. This
- document attempts to complete the ABNF to include IPv6 addresses.
-
- Accordingly, the address type "IP6" indicating an IPv6 address,
- should be allowed in the connection field, "c=", of the SDP. The
- ABNF already reflects this, though the "Connection Data" text under
- section 6 of RFC 2328 currently only defines the "IP4" address type.
-
-
-
-
-Olson, et. al. Standards Track [Page 1]
-
-RFC 3266 Support for IPv6 in Session Description Protocol June 2002
-
-
-2. Terminology
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in RFC 2119 [5].
-
-3. Syntax
-
- RFC 2373 [1] gives an ABNF for the text representation of IPv6
- addresses in Appendix B. RFC 2732 [3] covers the text representation
- of IPv6 addresses when used within a URL. Using the ABNF described
- in these documents, the following updated ABNF for SDP is proposed.
-
- uri = ; defined in RFC1630 and RFC2732
-
- multicast-address = IP4-multicast / IP6-multicast
-
- IP4-multicast = m1 3*( "." decimal-uchar )
- "/" ttl [ "/" integer ]
- ; IPv4 multicast addresses may be in the
- ; range 224.0.0.0 to 239.255.255.255
-
- m1 = ("22" ("4"/"5"/"6"/"7"/"8"/"9")) /
- ("23" DIGIT ))
-
- IP6-multicast = hexpart
- ; IPv6 address starting with FF
-
- addr = FQDN / unicast-address
-
- FQDN = 4*(alpha-numeric/"-"/".")
- ; fully qualified domain name as specified
- ; in RFC1035
- unicast-address = IP4-address / IP6-address
-
- IP4-address = b1 3*("." decimal-uchar) / "0.0.0.0"
-
- b1 = decimal-uchar
- ; less than "224"; not "0" or "127"
-
- ; The following is from RFC2373 Appendix B. It is a direct copy.
- IP6-address = hexpart [ ":" IP4-address ]
-
- hexpart = hexseq / hexseq "::" [ hexseq ] /
- "::" [ hexseq ]
-
-
-
-
-
-
-Olson, et. al. Standards Track [Page 2]
-
-RFC 3266 Support for IPv6 in Session Description Protocol June 2002
-
-
- hexseq = hex4 *( ":" hex4)
-
- hex4 = 1*4HEXDIG
-
-4. Example SDP description with IPv6 addresses
-
- The following is an example SDP description using the above ABNF for
- IPv6 addresses. In particular, the origin and connection fields
- contain IPv6 addresses.
-
- v=0
- o=nasa1 971731711378798081 0 IN IP6 2201:056D::112E:144A:1E24
- s=(Almost) live video feed from Mars-II satellite
- p=+1 713 555 1234
- c=IN IP6 FF1E:03AD::7F2E:172A:1E24
- t=3338481189 3370017201
- m=audio 6000 RTP/AVP 2
- a=rtpmap:2 G726-32/8000
- m=video 6024 RTP/AVP 107
- a=rtpmap:107 H263-1998/90000
-
-5. Note for implementors
-
- An implementation may receive an SDP session description with an IPv6
- address whose format [1] is internally that of an IPv4 mapped
- address. Note that such an address is actually the address of an
- IPv4-only node, and implementors are warned to interpret IPv4 mapped
- addresses as equivalent to IP4.
-
-6. IANA Considerations
-
- This document updates the definition of the IP6 addrtype parameter
- found in RFC 2327.
-
-7. Security Considerations
-
- No additional considerations above what is stated in section 7 of RFC
- 2327.
-
-8. References
-
- [1] Hinden, R. and S. Deering, "IP Version 6 Addressing
- Architecture", RFC 2373, July 1998.
-
- [2] Handley, M. and V. Jacobson, "SDP: Session Description
- Protocol", RFC 2327, April 1998.
-
-
-
-
-
-Olson, et. al. Standards Track [Page 3]
-
-RFC 3266 Support for IPv6 in Session Description Protocol June 2002
-
-
- [3] Hinden, R., Carpenter, B. and L. Masinter, "Format for Literal
- IPv6 Addresses in URL's", RFC 2732, December 1999.
-
- [4] Crocker, D. and P. Overell, "Augmented BNF for Syntax
- Specifications: ABNF", RFC 2234, November 1997.
-
- [5] Bradner, S., "Key words for Use in RFCs to Indicate Requirement
- Levels", BCP 14, RFC 2119, March 1997.
-
-9. Authors' Addresses
-
- Sean Olson
- Microsoft
- One Microsoft Way
- Redmond, WA 98052
- USA
-
-
-
- Gonzalo Camarillo
- Ericsson
- Advanced Signalling Research Lab.
- FIN-02420 Jorvas
- Finland
-
- Phone: +358 9 299 3371
- Fax: +358 9 299 3118
-
-
- Adam Roach
- dynamicsoft
- 5100 Tennyson Parkway
- Suite 1200
- Plano, TX 75024
- USA
-
- Voice: <sip:[email protected]>
-
-
-
-
-
-
-
-
-
-
-
-Olson, et. al. Standards Track [Page 4]
-
-RFC 3266 Support for IPv6 in Session Description Protocol June 2002
-
-
-10. Full Copyright Statement
-
- Copyright (C) The Internet Society (2002). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-Acknowledgement
-
- Funding for the RFC Editor function is currently provided by the
- Internet Society.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Olson, et. al. Standards Track [Page 5]
-
diff --git a/lib/megaco/examples/meas/meas.sh.skel b/lib/megaco/examples/meas/meas.sh.skel
index 4bbc6a5f7e..76745ed8f4 100644
--- a/lib/megaco/examples/meas/meas.sh.skel
+++ b/lib/megaco/examples/meas/meas.sh.skel
@@ -1,20 +1,20 @@
#!/bin/sh
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2007-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2007-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -27,7 +27,7 @@ MEAS_HOME=$MEGACO_HOME/examples/meas
PATH=$ERL_HOME/bin:$PATH
# MEAS_TIME_TEST="-s megaco_codec_meas start time_test"
-MEAS_DEFAULT="-s megaco_codec_meas t"
+MEAS_DEFAULT="-s megaco_codec_meas start"
STOP="-s init stop"
ERL="erl \
diff --git a/lib/megaco/include/megaco.hrl b/lib/megaco/include/megaco.hrl
index 4045fa9461..87e830323f 100644
--- a/lib/megaco/include/megaco.hrl
+++ b/lib/megaco/include/megaco.hrl
@@ -1,19 +1,20 @@
-%% ``The contents of this file are subject to the Erlang Public License,
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
-%% retrieved via the world wide web at http://www.erlang.org/.
-%%
+%% retrieved online at http://www.erlang.org/.
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
-%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-%% AB. All Rights Reserved.''
-%%
-%% $Id$
+%%
+%% %CopyrightEnd%
%%
%%----------------------------------------------------------------------
%% Purpose: Define common data structures and error codes
diff --git a/lib/megaco/src/app/megaco.appup.src b/lib/megaco/src/app/megaco.appup.src
index 163ff06651..f939f5e6cf 100644
--- a/lib/megaco/src/app/megaco.appup.src
+++ b/lib/megaco/src/app/megaco.appup.src
@@ -1,19 +1,20 @@
+%% This is an -*- erlang -*- file.
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2001-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -120,43 +121,97 @@
%% |
%% v
%% 3.13
+%% |
+%% v
+%% 3.14
+%% |
+%% v
+%% 3.14.1
%%
%%
{"%VSN%",
[
+ {"3.14",
+ [
+ {load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_config, soft, soft_purge, soft_purge, []}
+ ]
+ },
+ {"3.13",
+ [
+ {load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_config, soft, soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, downgrade_to_pre_3_13_1},
+ soft_purge, soft_purge, []}
+ ]
+ },
{"3.12",
[
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
{load_module, megaco_udp, soft_purge, soft_purge, []},
{load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
- {update, megaco_monitor, soft, soft_purge, soft_purge, []}
+ {update, megaco_config, soft, soft_purge, soft_purge, []},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, downgrade_to_pre_3_13_1},
+ soft_purge, soft_purge, []}
]
},
{"3.11.3",
[
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
{load_module, megaco_udp, soft_purge, soft_purge, []},
{load_module, megaco_messenger, soft_purge, soft_purge,
[megaco_config, megaco_monitor]},
{update, megaco_monitor, soft, soft_purge, soft_purge, []},
{update, megaco_config, {advanced, upgrade_from_pre_3_12},
+ soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, downgrade_to_pre_3_13_1},
soft_purge, soft_purge, []}
]
}
],
[
+ {"3.14",
+ [
+ {load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_config, soft, soft_purge, soft_purge, []}
+ ]
+ },
+ {"3.13",
+ [
+ {load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_config, soft, soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, upgrade_from_pre_3_13_1},
+ soft_purge, soft_purge, []}
+ ]
+ },
{"3.12",
[
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
{load_module, megaco_udp, soft_purge, soft_purge, []},
{load_module, megaco_messenger, soft_purge, soft_purge, [megaco_monitor]},
- {update, megaco_monitor, soft, soft_purge, soft_purge, []}
+ {update, megaco_config, soft, soft_purge, soft_purge, []},
+ {update, megaco_monitor, soft, soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, upgrade_from_pre_3_13_1},
+ soft_purge, soft_purge, []}
]
},
{"3.11.3",
[
+ {load_module, megaco_filter, soft_purge, soft_purge, []},
{load_module, megaco_udp, soft_purge, soft_purge, []},
{load_module, megaco_messenger, soft_purge, soft_purge,
[megaco_config, megaco_monitor]},
{update, megaco_monitor, soft, soft_purge, soft_purge, []},
{update, megaco_config, {advanced, downgrade_to_pre_3_12},
+ soft_purge, soft_purge, []},
+ {update, megaco_flex_scanner_handler, {advanced, upgrade_from_pre_3_13_1},
soft_purge, soft_purge, []}
]
}
diff --git a/lib/megaco/src/app/megaco_internal.hrl b/lib/megaco/src/app/megaco_internal.hrl
index adbaacacef..2c124e9060 100644
--- a/lib/megaco/src/app/megaco_internal.hrl
+++ b/lib/megaco/src/app/megaco_internal.hrl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -139,6 +139,22 @@
[?APPLICATION, ?MODULE, self()|A]))).
+-define(megaco_ereport(Label, Report),
+ ?megaco_report(error_report, Label, Report)).
+
+-define(megaco_wreport(Label, Report),
+ ?megaco_report(warning_report, Label, Report)).
+
+-define(megaco_ireport(Label, Report),
+ ?megaco_report(info_report, Label, Report)).
+
+-define(megaco_report(Func, Label, Report),
+ (catch error_logger:Func([{label, Label},
+ {application, ?APPLICATION},
+ {module, ?MODULE},
+ {process, self()} | Report]))).
+
+
%%%----------------------------------------------------------------------
%%% Default (ignore) value of the Extra argument to the
%%% megaco:receive_message/5 and process_received_message functions/5.
diff --git a/lib/megaco/src/engine/megaco_config.erl b/lib/megaco/src/engine/megaco_config.erl
index 2058c53973..6805db790d 100644
--- a/lib/megaco/src/engine/megaco_config.erl
+++ b/lib/megaco/src/engine/megaco_config.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -224,149 +224,278 @@ update_user_info(UserMid, orig_pending_limit, Val) ->
update_user_info(UserMid, Item, Val) ->
call({update_user_info, UserMid, Item, Val}).
-conn_info(CH, Item)
- when is_record(CH, megaco_conn_handle) andalso (Item /= cancel) ->
- case Item of
- conn_handle ->
- CH;
- mid ->
- CH#megaco_conn_handle.local_mid;
- local_mid ->
- CH#megaco_conn_handle.local_mid;
- remote_mid ->
- CH#megaco_conn_handle.remote_mid;
- conn_data ->
- case lookup_local_conn(CH) of
- [] ->
- exit({no_such_connection, CH});
- [ConnData] ->
- ConnData
- end;
- _ ->
- case lookup_local_conn(CH) of
- [] ->
- exit({no_such_connection, CH});
- [ConnData] ->
- conn_info(ConnData, Item)
- end
+
+conn_info(Data, Item) ->
+ %% The purpose of this is a compiler optimization...
+ %% Args are processed from left to right.
+ do_conn_info(Item, Data).
+
+do_conn_info(mid = _Item, #megaco_conn_handle{local_mid = Mid}) ->
+ Mid;
+do_conn_info(local_mid = _Item, #megaco_conn_handle{local_mid = LMid}) ->
+ LMid;
+do_conn_info(remote_mid = _Item, #megaco_conn_handle{remote_mid = RMid}) ->
+ RMid;
+do_conn_info(conn_handle = _Item, CH) when is_record(CH, megaco_conn_handle) ->
+ CH;
+do_conn_info(conn_data = _Item, CH) when is_record(CH, megaco_conn_handle) ->
+ case lookup_local_conn(CH) of
+ [] ->
+ exit({no_such_connection, CH});
+ [ConnData] ->
+ ConnData
+ end;
+do_conn_info(Item, CH) when is_record(CH, megaco_conn_handle) ->
+ case lookup_local_conn(CH) of
+ [] ->
+ exit({no_such_connection, CH});
+ [ConnData] ->
+ do_conn_info(Item, ConnData)
end;
-conn_info(#conn_data{conn_handle = CH}, cancel) ->
+
+do_conn_info(cancel = _Item, #conn_data{conn_handle = CH}) ->
+ %% To minimise raise-condition propabillity,
+ %% we always look in the table instead of
+ %% in the record for this one
+ ets:lookup_element(megaco_local_conn, CH, #conn_data.cancel);
+do_conn_info(cancel = _Item, CH) when is_record(CH, megaco_conn_handle) ->
%% To minimise raise-condition propabillity,
%% we always look in the table instead of
%% in the record for this one
ets:lookup_element(megaco_local_conn, CH, #conn_data.cancel);
-conn_info(CD, Item) when is_record(CD, conn_data) ->
- case Item of
- all ->
- Tags0 = record_info(fields, conn_data),
- Tags1 = replace(serial, trans_id, Tags0),
- Tags = [mid, local_mid, remote_mid] ++
- replace(max_serial, max_trans_id, Tags1),
- [{Tag, conn_info(CD,Tag)} || Tag <- Tags,
- Tag /= conn_data,
- Tag /= trans_sender,
- Tag /= cancel];
- conn_data -> CD;
- conn_handle -> CD#conn_data.conn_handle;
- mid -> (CD#conn_data.conn_handle)#megaco_conn_handle.local_mid;
- local_mid -> (CD#conn_data.conn_handle)#megaco_conn_handle.local_mid;
- remote_mid -> (CD#conn_data.conn_handle)#megaco_conn_handle.remote_mid;
- trans_id -> CH = CD#conn_data.conn_handle,
- LocalMid = CH#megaco_conn_handle.local_mid,
- Item2 = {LocalMid, trans_id_counter},
- case (catch ets:lookup(megaco_config, Item2)) of
- {'EXIT', _} ->
- undefined_serial;
- [] ->
- user_info(LocalMid, min_trans_id);
- [{_, Serial}] ->
- Max = CD#conn_data.max_serial,
- if
- ((Max =:= infinity) andalso
- is_integer(Serial) andalso
- (Serial < 4294967295)) ->
- Serial + 1;
- (Max =:= infinity) andalso
- is_integer(Serial) andalso
- (Serial =:= 4294967295) ->
- user_info(LocalMid,
- min_trans_id);
- Serial < Max ->
- Serial + 1;
- Serial =:= Max ->
- user_info(LocalMid,
- min_trans_id);
- Serial =:= 4294967295 ->
- user_info(LocalMid,
- min_trans_id);
- true ->
- undefined_serial
- end
- end;
- max_trans_id -> CD#conn_data.max_serial;
- request_timer -> CD#conn_data.request_timer;
- long_request_timer -> CD#conn_data.long_request_timer;
-
- auto_ack -> CD#conn_data.auto_ack;
-
- trans_ack -> CD#conn_data.trans_ack;
- trans_ack_maxcount -> CD#conn_data.trans_ack_maxcount;
-
- trans_req -> CD#conn_data.trans_req;
- trans_req_maxcount -> CD#conn_data.trans_req_maxcount;
- trans_req_maxsize -> CD#conn_data.trans_req_maxsize;
-
- trans_timer -> CD#conn_data.trans_timer;
-
- pending_timer -> CD#conn_data.pending_timer;
- orig_pending_limit -> CD#conn_data.sent_pending_limit;
- sent_pending_limit -> CD#conn_data.sent_pending_limit;
- recv_pending_limit -> CD#conn_data.recv_pending_limit;
- reply_timer -> CD#conn_data.reply_timer;
- control_pid -> CD#conn_data.control_pid;
- monitor_ref -> CD#conn_data.monitor_ref;
- send_mod -> CD#conn_data.send_mod;
- send_handle -> CD#conn_data.send_handle;
- encoding_mod -> CD#conn_data.encoding_mod;
- encoding_config -> CD#conn_data.encoding_config;
- protocol_version -> CD#conn_data.protocol_version;
- auth_data -> CD#conn_data.auth_data;
- user_mod -> CD#conn_data.user_mod;
- user_args -> CD#conn_data.user_args;
- reply_action -> CD#conn_data.reply_action;
- reply_data -> CD#conn_data.reply_data;
- threaded -> CD#conn_data.threaded;
- strict_version -> CD#conn_data.strict_version;
- long_request_resend -> CD#conn_data.long_request_resend;
- call_proxy_gc_timeout -> CD#conn_data.call_proxy_gc_timeout;
- cancel -> CD#conn_data.cancel;
- resend_indication -> CD#conn_data.resend_indication;
- segment_reply_ind -> CD#conn_data.segment_reply_ind;
- segment_recv_acc -> CD#conn_data.segment_recv_acc;
- segment_recv_timer -> CD#conn_data.segment_recv_timer;
- segment_send -> CD#conn_data.segment_send;
- segment_send_timer -> CD#conn_data.segment_send_timer;
- max_pdu_size -> CD#conn_data.max_pdu_size;
- request_keep_alive_timeout -> CD#conn_data.request_keep_alive_timeout;
- receive_handle ->
- LocalMid = (CD#conn_data.conn_handle)#megaco_conn_handle.local_mid,
- #megaco_receive_handle{local_mid = LocalMid,
- encoding_mod = CD#conn_data.encoding_mod,
- encoding_config = CD#conn_data.encoding_config,
- send_mod = CD#conn_data.send_mod};
- _ ->
- exit({no_such_item, Item})
+do_conn_info(all = _Item,
+ #conn_data{conn_handle = CH,
+ serial = TransId,
+ max_serial = MaxTransId,
+ request_timer = ReqTmr,
+ long_request_timer = LongReqTmr,
+ auto_ack = AutoAck,
+ trans_ack = TransAck,
+ trans_ack_maxcount = TransAckMaxCount,
+ trans_req = TransReq,
+ trans_req_maxcount = TransReqMaxCount,
+ trans_req_maxsize = TransReqMaxSz,
+ trans_timer = TransTmr,
+ %% trans_sender,
+ pending_timer = PendingTmr,
+ sent_pending_limit = SentPendingLimit,
+ recv_pending_limit = RecvPendingLimit,
+ reply_timer = ReplyTmr,
+ control_pid = CtrlPid,
+ monitor_ref = MonRef,
+ send_mod = SendMod,
+ send_handle = SendHandle,
+ encoding_mod = EncodingMod,
+ encoding_config = EncodingConf,
+ protocol_version = ProtoVersion,
+ auth_data = AuthData,
+ user_mod = UserMod,
+ user_args = UserArgs,
+ reply_action = ReplyAction,
+ reply_data = ReplyData,
+ threaded = Threaded,
+ strict_version = StrictVersion,
+ long_request_resend = LongReqResend,
+ call_proxy_gc_timeout = CallProxyGCTimeout,
+ %% cancel,
+ resend_indication = ResendInd,
+ segment_reply_ind = SegReplyInd,
+ segment_recv_acc = SegRecvAcc,
+ segment_recv_timer = SegRecvTmr,
+ segment_send = SegSend,
+ segment_send_timer = SegSendTmr,
+ max_pdu_size = MaxPduSz,
+ request_keep_alive_timeout = RequestKeepAliveTmr}) ->
+ [{conn_handle, CH},
+ {trans_id, TransId},
+ {max_trans_id, MaxTransId},
+ {request_timer, ReqTmr},
+ {long_request_timer, LongReqTmr},
+ {mid, CH#megaco_conn_handle.local_mid},
+ {local_mid, CH#megaco_conn_handle.local_mid},
+ {remote_mid, CH#megaco_conn_handle.remote_mid},
+ {auto_ack, AutoAck},
+ {trans_ack, TransAck},
+ {trans_ack_maxcount, TransAckMaxCount},
+ {trans_req, TransReq},
+ {trans_req_maxcount, TransReqMaxCount},
+ {trans_req_maxsize, TransReqMaxSz},
+ {trans_timer, TransTmr},
+ {pending_timer, PendingTmr},
+ {sent_pending_limit, SentPendingLimit},
+ {recv_pending_limit, RecvPendingLimit},
+ {reply_timer, ReplyTmr},
+ {control_pid, CtrlPid},
+ {monitor_ref, MonRef},
+ {send_mod, SendMod},
+ {send_handle, SendHandle},
+ {encoding_mod, EncodingMod},
+ {encoding_config, EncodingConf},
+ {protocol_version, ProtoVersion},
+ {auth_data, AuthData},
+ {user_mod, UserMod},
+ {user_args, UserArgs},
+ {reply_action, ReplyAction},
+ {reply_data, ReplyData},
+ {threaded, Threaded},
+ {strict_version, StrictVersion},
+ {long_request_resend, LongReqResend},
+ {call_proxy_gc_timeout, CallProxyGCTimeout},
+ {resend_indication, ResendInd},
+ {segment_reply_ind, SegReplyInd},
+ {segment_recv_acc, SegRecvAcc},
+ {segment_recv_timer, SegRecvTmr},
+ {segment_send, SegSend},
+ {segment_send_timer, SegSendTmr},
+ {max_pdu_size, MaxPduSz},
+ {request_keep_alive_timeout, RequestKeepAliveTmr}];
+
+do_conn_info(conn_data = _Item, CD) ->
+ CD;
+do_conn_info(conn_handle = _Item, #conn_data{conn_handle = Val}) ->
+ Val;
+do_conn_info(mid = _Item,
+ #conn_data{conn_handle = #megaco_conn_handle{local_mid = Val}}) ->
+ Val;
+do_conn_info(local_mid = _Item,
+ #conn_data{conn_handle = #megaco_conn_handle{local_mid = Val}}) ->
+ Val;
+do_conn_info(remote_mid = _Item,
+ #conn_data{conn_handle = #megaco_conn_handle{remote_mid = Val}}) ->
+ Val;
+do_conn_info(trans_id = _Item,
+ #conn_data{conn_handle = #megaco_conn_handle{local_mid = LMid},
+ max_serial = Max}) ->
+ Item2 = {LMid, trans_id_counter},
+ case (catch ets:lookup(megaco_config, Item2)) of
+ {'EXIT', _} ->
+ undefined_serial;
+ [] ->
+ user_info(LMid, min_trans_id);
+ [{_, Serial}] ->
+ if
+ ((Max =:= infinity) andalso
+ is_integer(Serial) andalso
+ (Serial < 4294967295)) ->
+ Serial + 1;
+ ((Max =:= infinity) andalso
+ is_integer(Serial) andalso
+ (Serial =:= 4294967295)) ->
+ user_info(LMid, min_trans_id);
+ Serial < Max ->
+ Serial + 1;
+ Serial =:= Max ->
+ user_info(LMid, min_trans_id);
+ Serial =:= 4294967295 ->
+ user_info(LMid, min_trans_id);
+ true ->
+ undefined_serial
+ end
end;
-conn_info(BadHandle, _Item) ->
- {error, {no_such_connection, BadHandle}}.
-
-replace(_, _, []) ->
- [];
-replace(Item, WithItem, [Item|List]) ->
- [WithItem|List];
-replace(Item, WithItem, [OtherItem|List]) ->
- [OtherItem | replace(Item, WithItem, List)].
+do_conn_info(max_trans_id = _Item, #conn_data{max_serial = Val}) ->
+ Val;
+do_conn_info(request_timer = _Item, #conn_data{request_timer = Val}) ->
+ Val;
+do_conn_info(long_request_timer = _Item, #conn_data{long_request_timer = Val}) ->
+ Val;
+do_conn_info(auto_ack = _Item, #conn_data{auto_ack = Val}) ->
+ Val;
+do_conn_info(trans_ack = _Item, #conn_data{trans_ack = Val}) ->
+ Val;
+do_conn_info(trans_ack_maxcount = _Item, #conn_data{trans_ack_maxcount = Val}) ->
+ Val;
+do_conn_info(trans_req = _Item, #conn_data{trans_req = Val}) ->
+ Val;
+do_conn_info(trans_req_maxcount = _Item, #conn_data{trans_req_maxcount = Val}) ->
+ Val;
+do_conn_info(trans_req_maxsize = _Item, #conn_data{trans_req_maxsize = Val}) ->
+ Val;
+do_conn_info(trans_timer = _Item, #conn_data{trans_timer = Val}) ->
+ Val;
+do_conn_info(pending_timer = _Item, #conn_data{pending_timer = Val}) ->
+ Val;
+do_conn_info(orig_pending_limit = _Item, #conn_data{sent_pending_limit = Val}) ->
+ Val;
+do_conn_info(sent_pending_limit = _Item, #conn_data{sent_pending_limit = Val}) ->
+ Val;
+do_conn_info(recv_pending_limit = _Item, #conn_data{recv_pending_limit = Val}) ->
+ Val;
+do_conn_info(reply_timer = _Item, #conn_data{reply_timer = Val}) ->
+ Val;
+do_conn_info(control_pid = _Item, #conn_data{control_pid = Val}) ->
+ Val;
+do_conn_info(send_mod = _Item, #conn_data{send_mod = Val}) ->
+ Val;
+do_conn_info(send_handle = _Item, #conn_data{send_handle = Val}) ->
+ Val;
+do_conn_info(encoding_mod = _Item, #conn_data{encoding_mod = Val}) ->
+ Val;
+do_conn_info(encoding_config = _Item, #conn_data{encoding_config = Val}) ->
+ Val;
+do_conn_info(protocol_version = _Item, #conn_data{protocol_version = Val}) ->
+ Val;
+do_conn_info(auth_data = _Item, #conn_data{auth_data = Val}) ->
+ Val;
+do_conn_info(user_mod = _Item, #conn_data{user_mod = Val}) ->
+ Val;
+do_conn_info(user_args = _Item, #conn_data{user_args = Val}) ->
+ Val;
+do_conn_info(reply_action = _Item, #conn_data{reply_action = Val}) ->
+ Val;
+do_conn_info(reply_data = _Item, #conn_data{reply_data = Val}) ->
+ Val;
+do_conn_info(threaded = _Item, #conn_data{threaded = Val}) ->
+ Val;
+do_conn_info(strict_version = _Item, #conn_data{strict_version = Val}) ->
+ Val;
+do_conn_info(long_request_resend = _Item,
+ #conn_data{long_request_resend = Val}) ->
+ Val;
+do_conn_info(call_proxy_gc_timeout = _Item,
+ #conn_data{call_proxy_gc_timeout = Val}) ->
+ Val;
+do_conn_info(resend_indication = _Item, #conn_data{resend_indication = Val}) ->
+ Val;
+do_conn_info(segment_reply_ind = _Item, #conn_data{segment_reply_ind = Val}) ->
+ Val;
+do_conn_info(segment_recv_acc = _Item, #conn_data{segment_recv_acc = Val}) ->
+ Val;
+do_conn_info(segment_recv_timer = _Item,
+ #conn_data{segment_recv_timer = Val}) ->
+ Val;
+do_conn_info(segment_send = _Item, #conn_data{segment_send = Val}) ->
+ Val;
+do_conn_info(segment_send_timer = _Item,
+ #conn_data{segment_send_timer = Val}) ->
+ Val;
+do_conn_info(max_pdu_size = _Item, #conn_data{max_pdu_size = Val}) ->
+ Val;
+do_conn_info(request_keep_alive_timeout = _Item,
+ #conn_data{request_keep_alive_timeout = Val}) ->
+ Val;
+do_conn_info(receive_handle = _Item,
+ #conn_data{conn_handle = #megaco_conn_handle{local_mid = LMid},
+ encoding_mod = EM,
+ encoding_config = EC,
+ send_mod = SM}) ->
+ #megaco_receive_handle{local_mid = LMid,
+ encoding_mod = EM,
+ encoding_config = EC,
+ send_mod = SM};
+do_conn_info(Item, Data)
+ when is_record(Data, conn_data) orelse is_record(Data, megaco_conn_handle) ->
+ exit({no_such_item, Item});
+do_conn_info(_Item, BadData) ->
+ {error, {no_such_connection, BadData}}.
+
+
+%% replace(_, _, []) ->
+%% [];
+%% replace(Item, WithItem, [Item|List]) ->
+%% [WithItem|List];
+%% replace(Item, WithItem, [OtherItem|List]) ->
+%% [OtherItem | replace(Item, WithItem, List)].
update_conn_info(#conn_data{conn_handle = CH}, Item, Val) ->
@@ -499,31 +628,19 @@ incr_counter(Item, Incr) ->
end
catch
error:_ ->
+ %% Counter does not exist, so try creat it
try
begin
cre_counter(Item, Incr)
end
catch
exit:_ ->
- %% Ok, some other process got there before us,
- %% so try again
+ %% This is a raise condition.
+ %% When we tried to update the counter above, it
+ %% did not exist, but now it does...
ets:update_counter(megaco_config, Item, Incr)
end
end.
-%% incr_counter(Item, Incr) ->
-%% case (catch ets:update_counter(megaco_config, Item, Incr)) of
-%% {'EXIT', _} ->
-%% case (catch cre_counter(Item, Incr)) of
-%% {'EXIT', _} ->
-%% %% Ok, some other process got there before us,
-%% %% so try again
-%% ets:update_counter(megaco_config, Item, Incr);
-%% NewVal ->
-%% NewVal
-%% end;
-%% NewVal ->
-%% NewVal
-%% end.
cre_counter(Item, Initial) ->
case whereis(?SERVER) =:= self() of
@@ -531,8 +648,8 @@ cre_counter(Item, Initial) ->
case call({cre_counter, Item, Initial}) of
{ok, Value} ->
Value;
- Error ->
- exit(Error)
+ {error, Reason} ->
+ exit({failed_creating_counter, Item, Initial, Reason})
end;
true ->
%% Check that the counter does not already exists
@@ -542,7 +659,7 @@ cre_counter(Item, Initial) ->
ets:insert(megaco_config, {Item, Initial}),
{ok, Initial};
[_] ->
- %% Ouch, now what?
+ %% Possibly a raise condition
{error, already_exists}
end
@@ -1432,7 +1549,7 @@ verify_val(Item, Val) ->
segment_send_timer -> verify_timer(Val);
max_pdu_size -> verify_int(Val) andalso (Val > 0);
request_keep_alive_timeout ->
- (verify_int(Val) andalso (Val >= 0)) orelse (Val =:= plain);
+ (verify_uint(Val) orelse (Val =:= plain));
_ -> false
end.
diff --git a/lib/megaco/src/engine/megaco_filter.erl b/lib/megaco/src/engine/megaco_filter.erl
index 23a91b1f1d..9df752789c 100644
--- a/lib/megaco/src/engine/megaco_filter.erl
+++ b/lib/megaco/src/engine/megaco_filter.erl
@@ -1,37 +1,83 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%
%%----------------------------------------------------------------------
-%% Purpose : megaco/H.248 customization of generic event tracer
+%% Purpose : Megaco/H.248 customization of the Event Tracer tool
%%----------------------------------------------------------------------
-module(megaco_filter).
--export([start/0, start/1, filter/1,
+-export([start/0, start/1, filter/1, raw_filter/1,
pretty_error/1, string_to_term/1]).
+
-include_lib("megaco/include/megaco.hrl").
-include_lib("megaco/include/megaco_message_v1.hrl").
-include_lib("megaco/src/app/megaco_internal.hrl").
-include_lib("et/include/et.hrl").
+%%----------------------------------------------------------------------
+%% BUGBUG: There are some opportunities for improvements:
+%%
+%% * This version of the module does only handle version 1 of the messages.
+%%
+%% * The record definition of megaco_transaction_reply is copied from
+%% megaco_message_internal.hrl as that header file contains some
+%% records that already are defined in megaco_message_{v1,v2,v3}.hrl.
+%% * The records megaco_udp and megaco_tcp are copied from the files
+%% megaco_udp.hrl and megaco_tcp.hrl respectively, as we cannot include
+%% both header files. They both defines the macros HEAP_SIZE and GC_MSG_LIMIT.
+
+%%-include("megaco_message_internal.hrl").
+-record('megaco_transaction_reply',
+ {
+ transactionId,
+ immAckRequired = asn1_NOVALUE,
+ transactionResult,
+ segmentNumber = asn1_NOVALUE,
+ segmentationComplete = asn1_NOVALUE
+ }).
+
+%% -include_lib("megaco/src/udp/megaco_udp.hrl").
+-record(megaco_udp,
+ {port,
+ options = [],
+ socket,
+ receive_handle,
+ module = megaco,
+ serialize = false % false: Spawn a new process for each message
+ }).
+
+%% -include_lib("megaco/src/tcp/megaco_tcp.hrl").
+-record(megaco_tcp,
+ {host,
+ port,
+ options = [],
+ socket,
+ proxy_pid,
+ receive_handle,
+ module = megaco,
+ serialize = false % false: Spawn a new process for each message
+ }).
+%%----------------------------------------------------------------------
+
start() ->
start([]).
@@ -47,11 +93,20 @@ start(ExtraOptions) ->
{title, "Megaco tracer - Erlang/OTP"} | ExtraOptions],
et_viewer:start(Options).
-filter(E) when is_record(E, event) ->
+filter(E) ->
+ case catch raw_filter(E) of
+ {'EXIT', Reason} = Error->
+ io:format("~p: ~p\n", [?MODULE, Error]),
+ exit(Reason);
+ E2 ->
+ E2
+ end.
+
+raw_filter(E) when is_record(E, event) ->
From = filter_actor(E#event.from),
To = filter_actor(E#event.to),
E2 = E#event{from = From, to = To},
- E3 = filter_contents(E#event.contents, E2, []),
+ E3 = filter_contents(E#event.contents, E2),
{true, E3}.
filter_actors(From, To, E)
@@ -101,6 +156,9 @@ filter_user_actor(Actor) ->
do_filter_actor(CH) when is_record(CH, megaco_conn_handle) ->
Mid = CH#megaco_conn_handle.local_mid,
do_filter_actor(Mid);
+do_filter_actor(RH) when is_record(RH, megaco_receive_handle) ->
+ Mid = RH#megaco_receive_handle.local_mid,
+ do_filter_actor(Mid);
do_filter_actor(Actor) ->
case Actor of
{ip4Address, {'IP4Address', [A1,A2,A3,A4], asn1_NOVALUE}} ->
@@ -130,86 +188,108 @@ do_filter_actor(Actor) ->
"UNKNOWN"
end.
-filter_contents([], E, Contents) ->
- E#event{contents = lists:flatten(lists:reverse(Contents))};
-filter_contents([H | T], E, Contents) ->
+
+filter_contents(Contents, E) ->
+ do_filter_contents(Contents, E, missing_conn_data, []).
+
+do_filter_contents([H | T], E, ConnData, Contents) ->
case H of
- {line, _Mod, _Line} ->
- filter_contents(T, E, Contents);
+ Udp when is_record(Udp, megaco_udp) ->
+ RH = Udp#megaco_udp.receive_handle,
+ Actor = filter_actor(RH),
+ E2 = E#event{from = Actor, to = Actor},
+ Pretty =
+ ["Port: ", integer_to_list(Udp#megaco_udp.port), "\n",
+ "Encoder: ", atom_to_list(RH#megaco_receive_handle.encoding_mod)],
+ do_filter_contents(T, E2, ConnData, [[Pretty, "\n"], Contents]);
+ Tcp when is_record(Tcp, megaco_tcp) ->
+ RH = Tcp#megaco_tcp.receive_handle,
+ Actor = filter_actor(RH),
+ E2 = E#event{from = Actor, to = Actor},
+ Pretty =
+ ["Port: ", integer_to_list(Tcp#megaco_tcp.port), "\n",
+ "Encoder: ", atom_to_list(RH#megaco_receive_handle.encoding_mod)],
+ do_filter_contents(T, E2, ConnData, [[Pretty, "\n"], Contents]);
CD when is_record(CD, conn_data) ->
CH = CD#conn_data.conn_handle,
From = CH#megaco_conn_handle.local_mid,
- To = CH#megaco_conn_handle.remote_mid,
+ To = CH#megaco_conn_handle.remote_mid,
E2 = filter_actors(From, To, E),
Serial = CD#conn_data.serial,
E3 = append_serial(Serial, E2),
- filter_contents(T, E3, Contents);
+ do_filter_contents(T, E3, CD, Contents);
CH when is_record(CH, megaco_conn_handle) ->
From = CH#megaco_conn_handle.local_mid,
- To = CH#megaco_conn_handle.remote_mid,
+ To = CH#megaco_conn_handle.remote_mid,
E2 = filter_actors(From, To, E),
- filter_contents(T, E2, Contents);
- {orig_conn_handle, _CH} ->
- filter_contents(T, E, Contents);
+ do_filter_contents(T, E2, ConnData, Contents);
RH when is_record(RH, megaco_receive_handle) ->
Actor = RH#megaco_receive_handle.local_mid,
E2 = filter_actors(Actor, Actor, E),
- filter_contents(T, E2, Contents);
- {pid, Pid} when is_pid(Pid) ->
- filter_contents(T, E, Contents);
- pending ->
- filter_contents(T, E, Contents);
- reply ->
- filter_contents(T, E, Contents);
+ do_filter_contents(T, E2, ConnData, Contents);
{error, Reason} ->
Pretty = pretty_error({error, Reason}),
E2 = prepend_error(E),
- filter_contents(T, E2, [[Pretty, "\n"], Contents]);
+ do_filter_contents(T, E2, ConnData, [[Pretty, "\n"], Contents]);
{'EXIT', Reason} ->
Pretty = pretty_error({'EXIT', Reason}),
E2 = prepend_error(E),
- filter_contents(T, E2, [[Pretty, "\n"], Contents]);
+ do_filter_contents(T, E2, ConnData, [[Pretty, "\n"], Contents]);
ED when is_record(ED, 'ErrorDescriptor') ->
Pretty = pretty_error(ED),
E2 = prepend_error(E),
- filter_contents(T, E2, [[Pretty, "\n"], Contents]);
+ do_filter_contents(T, E2, ConnData, [[Pretty, "\n"], Contents]);
Trans when is_record(Trans, 'TransactionRequest') ->
- Pretty = pretty({trans, {transactionRequest, Trans}}),
- filter_contents([], E, [[Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, {trans, {transactionRequest, Trans}}),
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
+ {transactionRequest, Trans} when is_record(Trans, 'TransactionRequest') ->
+ Pretty = pretty(ConnData, {trans, {transactionRequest, Trans}}),
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
Trans when is_record(Trans, 'TransactionReply') ->
- Pretty = pretty({trans, {transactionReply, Trans}}),
- filter_contents([], E, [[Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, {trans, {transactionReply, Trans}}),
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
+ Trans when is_record(Trans, megaco_transaction_reply) ->
+ %% BUGBUG: Version 1 special
+ TransV1 =
+ #'TransactionReply'{transactionId = Trans#megaco_transaction_reply.transactionId,
+ immAckRequired = Trans#megaco_transaction_reply.immAckRequired,
+ transactionResult = Trans#megaco_transaction_reply.transactionResult},
+ Pretty = pretty(ConnData, {trans, {transactionReply, TransV1}}),
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
Trans when is_record(Trans, 'TransactionPending') ->
- Pretty = pretty({trans, {transactionPending, Trans}}),
- filter_contents([], E, [[Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, {trans, {transactionPending, Trans}}),
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
Trans when is_record(Trans, 'TransactionAck') ->
- Pretty = pretty({trans, {transactionResponseAck, [Trans]}}),
+ Pretty = pretty(ConnData, {trans, {transactionResponseAck, [Trans]}}),
case Trans#'TransactionAck'.lastAck of
asn1_NOVALUE ->
- filter_contents([], E, [[Pretty, "\n"], Contents]);
+ do_filter_contents([], E, ConnData, [[Pretty, "\n"], Contents]);
Last ->
Label = term_to_string(E#event.label),
E2 = E#event{label = Label ++ ".." ++ integer_to_list(Last)},
- filter_contents([], E2, [[Pretty, "\n"], Contents])
+ do_filter_contents([], E2, ConnData, [[Pretty, "\n"], Contents])
end;
{context_id, _ContextId} ->
- Pretty = pretty(H),
- filter_contents(T, E, [[Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, H),
+ do_filter_contents(T, E, ConnData, [[Pretty, "\n"], Contents]);
{command_request, CmdReq} ->
- Pretty = pretty(CmdReq),
- filter_contents(T, E, [[Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, CmdReq),
+ do_filter_contents(T, E, ConnData, [[Pretty, "\n"], Contents]);
{user_reply, {ok, ARS}} ->
- Pretty = [[pretty(AR), "\n"] || AR <- ARS],
- filter_contents(T, E, [["REPLY: \n", Pretty, "\n"], Contents]);
+ Pretty = [[pretty(ConnData, AR), "\n"] || AR <- ARS],
+ do_filter_contents(T, E, ConnData, [["USER REPLY OK: \n", Pretty, "\n"], Contents]);
{user_reply, Error} ->
Pretty = pretty_error(Error),
- filter_contents(T, E, [["REPLY: \n", Pretty, "\n"], Contents]);
+ do_filter_contents(T, E, ConnData, [["USER REPLY ERROR: \n", Pretty, "\n"], Contents]);
{actionReplies, ARS} ->
- Pretty = [[pretty(AR), "\n"] || AR <- ARS],
- filter_contents(T, E, [["REPLY: \n", Pretty, "\n"], Contents]);
+ Pretty = [[pretty(ConnData, AR), "\n"] || AR <- ARS],
+ do_filter_contents(T, E, ConnData, [["ACTION REPLIES: \n", Pretty, "\n"], Contents]);
MegaMsg when is_record(MegaMsg, 'MegacoMessage') ->
- Pretty = pretty(MegaMsg),
- filter_contents(T, E, [["MESSAGE: \n", Pretty, "\n"], Contents]);
+ Pretty = pretty(ConnData, MegaMsg),
+ do_filter_contents(T, E, ConnData, [Pretty, "\n", Contents]);
+ {message, MegaMsg} when is_record(MegaMsg, 'MegacoMessage') ->
+ Pretty = pretty(ConnData, MegaMsg),
+ do_filter_contents(T, E, ConnData, [Pretty, "\n", Contents]);
{bytes, Bin} when is_binary(Bin) ->
E2 =
case E#event.label of
@@ -223,15 +303,37 @@ filter_contents([H | T], E, Contents) ->
E
end,
CharList = erlang:binary_to_list(Bin),
- filter_contents(T, E2, [[CharList , "\n"], Contents]);
- [] ->
- filter_contents(T, E, Contents);
+ do_filter_contents(T, E2, ConnData, [[CharList , "\n"], Contents]);
+ List when is_list(List) ->
+ %% BUGBUG: Workaround as megaco_messenger puts nested lists in its traces
+ do_filter_contents(List ++ T, E, ConnData, Contents);
+ Int when is_integer(Int) ->
+ %% BUGBUG: Workaround as megaco_messenger puts nested lists in its traces
+ do_filter_contents(T, E, ConnData, Contents);
+ {line, _Mod, _Line} ->
+ do_filter_contents(T, E, ConnData, Contents);
+ {orig_conn_handle, _CH} ->
+ do_filter_contents(T, E, ConnData, Contents);
+ {pid, Pid} when is_pid(Pid) ->
+ do_filter_contents(T, E, ConnData, Contents);
+ pending ->
+ do_filter_contents(T, E, ConnData, Contents);
+ reply ->
+ do_filter_contents(T, E, ConnData, Contents);
{test_lib, _Mod, _Fun} ->
- filter_contents(T, E, Contents);
+ do_filter_contents(T, E, ConnData, Contents);
+ {trans_id, _TransId} ->
+ do_filter_contents(T, E, ConnData, Contents);
+ {send_func, _FunName} ->
+ do_filter_contents(T, E, ConnData, Contents);
+ Pid when is_pid(Pid) ->
+ do_filter_contents(T, E, ConnData, Contents);
Other ->
- Pretty = pretty(Other),
- filter_contents(T, E, [[Pretty, "\n"], Contents])
- end.
+ Pretty = pretty(ConnData, Other),
+ do_filter_contents(T, E, ConnData, [[Pretty, "\n"], Contents])
+ end;
+do_filter_contents([], E, _ConnData, Contents) ->
+ E#event{contents = lists:flatten(lists:reverse(Contents))}.
append_serial(Serial, E) when is_integer(Serial) ->
Label = term_to_string(E#event.label),
@@ -243,7 +345,7 @@ prepend_error(E) ->
Label = term_to_string(E#event.label),
E#event{label = "<ERROR> " ++ Label}.
-pretty({context_id, ContextId}) ->
+pretty(_ConnData, {context_id, ContextId}) ->
if
ContextId =:= ?megaco_null_context_id ->
["CONTEXT ID: -\n"];
@@ -254,61 +356,33 @@ pretty({context_id, ContextId}) ->
is_integer(ContextId) ->
["CONTEXT ID: ",integer_to_list(ContextId), "\n"]
end;
-pretty(MegaMsg) when is_record(MegaMsg, 'MegacoMessage') ->
- case catch megaco_pretty_text_encoder:encode_message([], MegaMsg) of
- {ok, Bin} ->
- term_to_string(Bin);
- _Bad ->
- term_to_string(MegaMsg)
- end;
-pretty(CmdReq) when is_record(CmdReq, 'CommandRequest') ->
- case catch megaco_pretty_text_encoder:encode_command_request(CmdReq) of
- {ok, IoList} ->
- IoList2 = lists:flatten(IoList),
- term_to_string(IoList2);
- _Bad ->
- term_to_string(CmdReq)
- end;
-pretty({complete_success, ContextId, RepList} = Res) ->
+pretty(_ConnData, MegaMsg) when is_record(MegaMsg, 'MegacoMessage') ->
+ {ok, Bin} = megaco_pretty_text_encoder:encode_message([], MegaMsg),
+ term_to_string(Bin);
+pretty(_ConnData, CmdReq) when is_record(CmdReq, 'CommandRequest') ->
+ {ok, IoList} = megaco_pretty_text_encoder:encode_command_request(CmdReq),
+ term_to_string(lists:flatten(IoList));
+pretty(_ConnData, {complete_success, ContextId, RepList}) ->
ActRep = #'ActionReply'{contextId = ContextId,
commandReply = RepList},
- case catch megaco_pretty_text_encoder:encode_action_reply(ActRep) of
- {ok, IoList} ->
- IoList2 = lists:flatten(IoList),
- term_to_string(IoList2);
- _Bad ->
- term_to_string(Res)
- end;
-pretty(AR) when is_record(AR, 'ActionReply') ->
- case catch megaco_pretty_text_encoder:encode_action_reply(AR) of
- {ok, IoList} ->
- IoList2 = lists:flatten(IoList),
- term_to_string(IoList2);
- _Bad ->
- term_to_string(AR)
- end;
-pretty({partial_failure, ContextId, RepList} = Res) ->
+ {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(ActRep),
+ term_to_string(lists:flatten(IoList));
+pretty(_ConnData, AR) when is_record(AR, 'ActionReply') ->
+ {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(AR),
+ term_to_string(lists:flatten(IoList));
+pretty(_ConnData, {partial_failure, ContextId, RepList}) ->
ActRep = #'ActionReply'{contextId = ContextId,
commandReply = RepList},
- case catch megaco_pretty_text_encoder:encode_action_reply(ActRep) of
- {ok, IoList} ->
- IoList2 = lists:flatten(IoList),
- term_to_string(IoList2);
- _Bad ->
- term_to_string(Res)
- end;
-pretty({trans, Trans}) ->
- case catch megaco_pretty_text_encoder:encode_transaction(Trans) of
+ {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(ActRep),
+ term_to_string(lists:flatten(IoList));
+pretty(_ConnData, {trans, Trans}) ->
+ case megaco_pretty_text_encoder:encode_transaction(Trans) of
{ok, Bin} when is_binary(Bin) ->
- IoList2 = lists:flatten(binary_to_list(Bin)),
- term_to_string(IoList2);
+ term_to_string(binary_to_list(Bin));
{ok, IoList} ->
- IoList2 = lists:flatten(IoList),
- term_to_string(IoList2);
- _Bad ->
- term_to_string(Trans)
+ term_to_string(lists:flatten(IoList))
end;
-pretty(Other) ->
+pretty(__ConnData, Other) ->
term_to_string(Other).
pretty_error({error, Reason}) ->
diff --git a/lib/megaco/src/engine/megaco_messenger.erl b/lib/megaco/src/engine/megaco_messenger.erl
index a9e4fd67b2..5fad29931b 100644
--- a/lib/megaco/src/engine/megaco_messenger.erl
+++ b/lib/megaco/src/engine/megaco_messenger.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -99,20 +99,22 @@
%% N.B. Update cancel/1 with '_' when a new field is added
-record(reply,
{
- trans_id,
- local_mid,
- state = prepare, % prepare | eval_request | waiting_for_ack | aborted
- pending_timer_ref,
- handler = undefined, % pid of the proc executing the callback func
- timer_ref,
- version,
- %% bytes: Sent reply data: not acknowledged
- bytes, % binary() | [{integer(), binary(), timer_ref()}]
- ack_action, % discard_ack | {handle_ack, Data}
- send_handle,
- %% segments: Not sent reply data (segments)
- segments = [] % [{integer(), binary()}]
- }).
+ trans_id,
+ local_mid,
+ state = prepare, % prepare | eval_request | waiting_for_ack | aborted
+ pending_timer_ref,
+ handler = undefined, % pid of the proc executing the callback func
+ timer_ref,
+ version,
+ %% bytes: Sent reply data: not acknowledged
+ bytes, % binary() | [{integer(), binary(), timer_ref()}]
+ ack_action, % discard_ack | {handle_ack, Data}
+ send_handle,
+ %% segments: Not sent reply data (segments)
+ segments = [], % [{integer(), binary()}]
+ user_mod,
+ user_args
+ }).
-record(trans_id,
{
@@ -1203,7 +1205,7 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
LocalMid = ConnHandle#megaco_conn_handle.local_mid,
TransId = to_remote_trans_id(ConnData),
?rt2("prepare request", [LocalMid, TransId]),
- case megaco_monitor:lookup_reply(TransId) of
+ case lookup_reply(ConnData, TransId) of
[] ->
?rt3("brand new request"),
@@ -1222,18 +1224,22 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
#conn_data{send_handle = SendHandle,
pending_timer = InitTimer,
- protocol_version = Version} = ConnData,
+ protocol_version = Version,
+ user_mod = UserMod,
+ user_args = UserArgs} = ConnData,
{WaitFor, CurrTimer} = megaco_timer:init(InitTimer),
M = ?MODULE,
F = pending_timeout,
- A = [ConnHandle, TransId, CurrTimer],
+ A = [ConnHandle, TransId, CurrTimer],
PendingRef = megaco_monitor:apply_after(M, F, A, WaitFor),
Rep = #reply{send_handle = SendHandle,
trans_id = TransId,
local_mid = LocalMid,
pending_timer_ref = PendingRef,
handler = self(),
- version = Version},
+ version = Version,
+ user_mod = UserMod,
+ user_args = UserArgs},
case megaco_monitor:insert_reply_new(Rep) of
true ->
prepare_normal_trans(ConnData, Rest, AckList,
@@ -1250,9 +1256,14 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
Extra)
end;
- [#reply{state = State,
+ %% We can ignore the Converted value here as we *know*
+ %% conn-data to be correct (not faked), so even if
+ %% the record was converted, it will now have correct
+ %% values for user_mod and user_args.
+ {_Converted,
+ #reply{state = State,
handler = Pid,
- pending_timer_ref = Ref} = Rep]
+ pending_timer_ref = Ref} = Rep}
when (State =:= prepare) orelse (State =:= eval_request) ->
?rt2("request resend", [State, Pid, Ref]),
@@ -1364,9 +1375,14 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
end;
- [#reply{state = waiting_for_ack,
+ %% We can ignore the Converted value here as we *know*
+ %% conn-data to be correct (not faked), so even if
+ %% the record was converted, it will now have correct
+ %% values for user_mod and user_args.
+ {_Converted,
+ #reply{state = waiting_for_ack,
bytes = Bin,
- version = Version} = Rep] ->
+ version = Version} = Rep} ->
?rt3("request resend when waiting for ack"),
%% We have already sent a reply, but the receiver
@@ -1384,7 +1400,13 @@ prepare_request(ConnData, T, Rest, AckList, ReqList, Extra) ->
end,
prepare_normal_trans(ConnData2, Rest, AckList, ReqList, Extra);
- [#reply{state = aborted} = Rep] ->
+
+ %% We can ignore the Converted value here as we *know*
+ %% conn-data to be correct (not faked), so even if
+ %% the record was converted, it will now have correct
+ %% values for user_mod and user_args.
+ {_Converted,
+ #reply{state = aborted} = Rep} ->
?rt3("request resend when already in aborted state"),
%% OTP-4956:
@@ -1424,15 +1446,15 @@ prepare_ack(ConnData, [], Rest, AckList, ReqList, Extra) ->
do_prepare_ack(ConnData, T, AckList) ->
TransId = to_remote_trans_id(ConnData),
- case megaco_monitor:lookup_reply(TransId) of
+ case lookup_reply(ConnData, TransId) of
[] ->
%% The reply has already been garbage collected. Ignore.
?report_trace(ConnData, "discard ack (no receiver)", [T]),
AckList;
- [Rep] when Rep#reply.state =:= waiting_for_ack ->
+ {_Converted, Rep} when Rep#reply.state =:= waiting_for_ack ->
%% Don't care about Msg and Rep version diff
[{ConnData, Rep, T} | AckList];
- [_Rep] ->
+ {_Converted, _Rep} ->
%% Protocol violation from the sender of this ack
?report_important(ConnData, "<ERROR> discard trans",
[T, {error, "got ack before reply was sent"}]),
@@ -1519,30 +1541,6 @@ check_pending_limit(Limit, Direction, TransId) ->
aborted
end.
-%% check_pending_limit(infinity, _, _) ->
-%% {ok, 0};
-%% check_pending_limit(Limit, Direction, TransId) ->
-%% ?rt2("check pending limit", [Direction, Limit, TransId]),
-%% case (catch megaco_config:get_pending_counter(Direction, TransId)) of
-%% {'EXIT', _} ->
-%% %% This function is only called when we "know" the
-%% %% counter to exist. So, the only reason that this
-%% %% would happen is of the counter has been removed.
-%% %% This only happen if the pending limit has been
-%% %% reached. In any case, this is basically the same
-%% %% as aborted!
-%% ?rt2("check pending limit - exit", []),
-%% aborted;
-%% Val when Val =< Limit ->
-%% %% Since we have no intention to increment here, it
-%% %% is ok to be _at_ the limit
-%% ?rt2("check pending limit - ok", [Val]),
-%% {ok, Val};
-%% _Val ->
-%% ?rt2("check pending limit - aborted", [_Val]),
-%% aborted
-%% end.
-
check_and_maybe_incr_pending_limit(infinity, _, _) ->
ok;
@@ -1550,59 +1548,42 @@ check_and_maybe_incr_pending_limit(Limit, Direction, TransId) ->
%%
%% We need this kind of test to detect when we _pass_ the limit
%%
- ?rt2("check and maybe incr pending limit", [Direction, Limit, TransId]),
+ ?rt2("check and maybe incr pending limit", [{direction, Direction},
+ {transaction_id, TransId},
+ {counter_limit, Limit}]),
try megaco_config:get_pending_counter(Direction, TransId) of
Val when Val > Limit ->
- ?rt2("check and maybe incr - aborted", [Direction, Val, Limit]),
+ ?rt2("check and maybe incr - aborted", [{counter_value, Val}]),
aborted; % Already passed the limit
Val ->
- ?rt2("check and maybe incr - incr", [Direction, Val, Limit]),
+ ?rt2("check and maybe incr - incr", [{counter_value, Val}]),
megaco_config:incr_pending_counter(Direction, TransId),
if
Val < Limit ->
ok; % Still within the limit
true ->
?rt2("check and maybe incr - error",
- [Direction, Val, Limit]),
+ [{counter_value, Val}]),
error % Passed the limit
end
catch
_:_ ->
%% Has not been created yet (connect).
- megaco_config:cre_pending_counter(Direction, TransId, 1),
- ok
+ %% Try create it, but bevare of possible raise condition
+ try
+ begin
+ megaco_config:cre_pending_counter(Direction, TransId, 1),
+ ok
+ end
+ catch
+ _:_ ->
+ %% Ouch, raise condition, increment instead...
+ megaco_config:incr_pending_counter(Direction, TransId),
+ ok
+ end
end.
-%% check_and_maybe_incr_pending_limit(infinity, _, _) ->
-%% ok;
-%% check_and_maybe_incr_pending_limit(Limit, Direction, TransId) ->
-%% %%
-%% %% We need this kind of test to detect when we _pass_ the limit
-%% %%
-%% ?rt2("check and maybe incr pending limit", [Direction, Limit, TransId]),
-%% case (catch megaco_config:get_pending_counter(Direction, TransId)) of
-%% {'EXIT', _} ->
-%% %% Has not been created yet (connect).
-%% megaco_config:cre_pending_counter(Direction, TransId, 1),
-%% ok;
-%% Val when Val > Limit ->
-%% ?rt2("check and maybe incr - aborted", [Direction, Val, Limit]),
-%% aborted; % Already passed the limit
-%% Val ->
-%% ?rt2("check and maybe incr - incr", [Direction, Val, Limit]),
-%% megaco_config:incr_pending_counter(Direction, TransId),
-%% if
-%% Val < Limit ->
-%% ok; % Still within the limit
-%% true ->
-%% ?rt2("check and maybe incr - error",
-%% [Direction, Val, Limit]),
-%% error % Passed the limit
-%% end
-%% end.
-
-
%% BUGBUG BUGBUG BUGBUG
%%
%% Do we know that the Rep is still valid? A previous transaction
@@ -1657,8 +1638,8 @@ handle_request(ConnData, TransId, T, Extra) ->
%% Furthermore, the reply timer has not been started,
%% so do the cleanup now
?rt1(ConnData, "pending limit already passed", [TransId]),
- case megaco_monitor:lookup_reply(TransId) of
- [Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, Rep} ->
cancel_reply(ConnData, Rep, aborted);
_ ->
ok
@@ -1671,8 +1652,8 @@ do_handle_request(_, ignore, _ConnData, _TransId) ->
ignore;
do_handle_request(_, ignore_trans_request, ConnData, TransId) ->
?rt1(ConnData, "ignore trans request: don't reply", [TransId]),
- case megaco_monitor:lookup_reply(TransId) of
- [#reply{} = Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, #reply{} = Rep} ->
cancel_reply(ConnData, Rep, ignore);
_ ->
ignore
@@ -1689,8 +1670,8 @@ do_handle_request({pending, RequestData}, _SendReply, _ConnData, _) ->
do_handle_request(AckAction, {ok, Bin}, ConnData, TransId)
when is_binary(Bin) ->
?rt1(ConnData, "handle request - ok", [AckAction, TransId]),
- case megaco_monitor:lookup_reply(TransId) of
- [#reply{pending_timer_ref = PendingRef} = Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, #reply{pending_timer_ref = PendingRef} = Rep} ->
#conn_data{reply_timer = InitTimer,
conn_handle = ConnHandle} = ConnData,
@@ -1729,8 +1710,8 @@ do_handle_request(AckAction, {ok, {Sent, NotSent}}, ConnData, TransId)
?rt1(ConnData, "handle request - ok [segmented reply]",
[AckAction, TransId]),
- case megaco_monitor:lookup_reply(TransId) of
- [#reply{pending_timer_ref = PendingRef} = Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, #reply{pending_timer_ref = PendingRef} = Rep} ->
%% d("do_handle_request -> found reply record:"
%% "~n Rep: ~p", [Rep]),
@@ -1772,8 +1753,8 @@ do_handle_request(AckAction, {ok, {Sent, NotSent}}, ConnData, TransId)
end;
do_handle_request(_, {error, aborted}, ConnData, TransId) ->
?report_trace(ConnData, "aborted during our absence", [TransId]),
- case megaco_monitor:lookup_reply(TransId) of
- [Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, Rep} ->
cancel_reply(ConnData, Rep, aborted);
_ ->
ok
@@ -1781,8 +1762,8 @@ do_handle_request(_, {error, aborted}, ConnData, TransId) ->
ignore;
do_handle_request(AckAction, {error, Reason}, ConnData, TransId) ->
?report_trace(ConnData, "error", [TransId, Reason]),
- case megaco_monitor:lookup_reply(TransId) of
- [Rep] ->
+ case lookup_reply(ConnData, TransId) of
+ {_Converted, Rep} ->
Rep2 = Rep#reply{state = waiting_for_ack,
ack_action = AckAction},
cancel_reply(ConnData, Rep2, Reason);
@@ -2626,33 +2607,84 @@ handle_reply(
handle_reply(#conn_data{conn_handle = CH} = CD, T, Extra) ->
TransId = to_local_trans_id(CD),
?rt2("handle reply", [T, TransId]),
- case megaco_monitor:lookup_request(TransId) of
- [Req] when (is_record(Req, request) andalso
- (CD#conn_data.cancel =:= true)) ->
+ case {megaco_monitor:request_lockcnt_inc(TransId),
+ megaco_monitor:lookup_request(TransId)} of
+ {_Cnt, [Req]} when (is_record(Req, request) andalso
+ (CD#conn_data.cancel =:= true)) ->
?TC_AWAIT_REPLY_EVENT(true),
+ ?report_trace(CD, "trans reply - cancel(1)", [T]),
do_handle_reply_cancel(CD, Req, T);
- [#request{remote_mid = RMid} = Req] when ((RMid =:= preliminary_mid) orelse
- (RMid =:= CH#megaco_conn_handle.remote_mid)) ->
+ {Cnt, [#request{remote_mid = RMid} = Req]} when
+ ((Cnt =:= 1) andalso
+ ((RMid =:= preliminary_mid) orelse
+ (RMid =:= CH#megaco_conn_handle.remote_mid))) ->
?TC_AWAIT_REPLY_EVENT(false),
%% Just in case conn_data got update after our lookup
%% but before we looked up the request record, we
%% check the cancel field again.
case megaco_config:conn_info(CD, cancel) of
true ->
+ ?report_trace(CD, "trans reply - cancel(2)", [T]),
+ megaco_monitor:request_lockcnt_del(TransId),
do_handle_reply_cancel(CD, Req, T);
false ->
+ ?report_trace(CD, "trans reply", [T]),
do_handle_reply(CD, Req, TransId, T, Extra)
end;
- [#request{user_mod = UserMod,
- user_args = UserArgs,
- reply_action = Action,
- reply_data = UserData,
- remote_mid = RMid}] ->
+ {Cnt, [#request{remote_mid = RMid} = _Req]} when
+ (is_integer(Cnt) andalso
+ ((RMid =:= preliminary_mid) orelse
+ (RMid =:= CH#megaco_conn_handle.remote_mid))) ->
+ ?TC_AWAIT_REPLY_EVENT(false),
+ %% Ok, someone got there before me, now what?
+ %% This is a plain old raise condition
+ ?report_important(CD, "trans reply - raise condition",
+ [T, {request_lockcnt, Cnt}]),
+ megaco_monitor:request_lockcnt_dec(TransId);
+
+ %% no counter
+ {_Cnt, [#request{remote_mid = RMid} = Req]} when
+ ((RMid =:= preliminary_mid) orelse
+ (RMid =:= CH#megaco_conn_handle.remote_mid)) ->
+ ?TC_AWAIT_REPLY_EVENT(false),
+ %% The counter does not exist.
+ %% This can only mean a code upgrade raise condition.
+ %% That is, this request record was created before
+ %% this feature (the counters) was instroduced.
+ %% The simples solution is this is to behave exactly as
+ %% before, that is pass it along, and leave it to the
+ %% user to figure out.
+
+ %% Just in case conn_data got update after our lookup
+ %% but before we looked up the request record, we
+ %% check the cancel field again.
+ ?report_verbose(CD, "trans reply - old style", [T]),
+ case megaco_config:conn_info(CD, cancel) of
+ true ->
+ megaco_monitor:request_lockcnt_del(TransId),
+ do_handle_reply_cancel(CD, Req, T);
+ false ->
+ do_handle_reply(CD, Req, TransId, T, Extra)
+ end;
+
+ {Cnt, [#request{user_mod = UserMod,
+ user_args = UserArgs,
+ reply_action = Action,
+ reply_data = UserData,
+ remote_mid = RMid}]} ->
?report_trace(CD,
"received trans reply with invalid remote mid",
- [T, RMid]),
+ [{transaction, T},
+ {remote_mid, RMid},
+ {request_lockcnt, Cnt}]),
+ if
+ is_integer(Cnt) ->
+ megaco_monitor:request_lockcnt_dec(TransId);
+ true ->
+ ok
+ end,
WrongMid = CH#megaco_conn_handle.remote_mid,
T2 = transform_transaction_reply_enc(CD#conn_data.protocol_version,
T),
@@ -2663,7 +2695,15 @@ handle_reply(#conn_data{conn_handle = CH} = CD, T, Extra) ->
reply_data = UserData},
return_reply(CD2, TransId, UserReply, Extra);
- [] ->
+ {Cnt, []} when is_integer(Cnt) ->
+ ?TC_AWAIT_REPLY_EVENT(undefined),
+ ?report_trace(CD, "trans reply (no receiver)",
+ [T, {request_lockcnt, Cnt}]),
+ megaco_monitor:request_lockcnt_dec(TransId),
+ return_unexpected_trans(CD, T, Extra);
+
+ %% No counter
+ {_Cnt, []} ->
?TC_AWAIT_REPLY_EVENT(undefined),
?report_trace(CD, "trans reply (no receiver)", [T]),
return_unexpected_trans(CD, T, Extra)
@@ -2694,6 +2734,7 @@ do_handle_reply(CD,
%% This is the first reply (maybe of many)
megaco_monitor:delete_request(TransId),
+ megaco_monitor:request_lockcnt_del(TransId),
megaco_monitor:cancel_apply_after(Ref), % OTP-4843
megaco_config:del_pending_counter(recv, TransId), % OTP-7189
@@ -2819,9 +2860,10 @@ handle_segment_reply(CD,
{segment_no, SN},
{segmentation_complete, SC}]),
TransId2 = to_remote_trans_id(CD#conn_data{serial = TransId}),
- case megaco_monitor:lookup_reply(TransId2) of
- [#reply{bytes = Sent,
- segments = []} = Rep] when is_list(Sent) ->
+ case lookup_reply(CD, TransId2) of
+ {_Converted,
+ #reply{bytes = Sent,
+ segments = []} = Rep} when is_list(Sent) ->
?rt2("no unsent segments", [Sent]),
handle_segment_reply_callback(CD, TransId, SN, SC, Extra),
case lists:keysearch(SN, 1, Sent) of
@@ -2845,8 +2887,9 @@ handle_segment_reply(CD,
ok
end;
- [#reply{bytes = Sent,
- segments = NotSent}] when is_list(Sent) andalso
+ {_Converted,
+ #reply{bytes = Sent,
+ segments = NotSent}} when is_list(Sent) andalso
is_list(NotSent) ->
?rt2("unsent segments", [Sent, NotSent]),
handle_segment_reply_callback(CD, TransId, SN, SC, Extra),
@@ -2883,7 +2926,8 @@ handle_segment_reply(CD,
ok
end;
- [#reply{state = State}] ->
+ {_Converted,
+ #reply{state = State}} ->
%% We received a segment reply for a segmented reply we have
%% not yet sent? This is either some sort of race condition
%% or the "the other side" is really confused.
@@ -3012,7 +3056,7 @@ handle_ack_callback(ConnData, AckStatus, {handle_ack, AckData}, T, Extra) ->
_ ->
[ConnHandle, Version, AckStatus, AckData, Extra | UserArgs]
end,
- Res = (catch apply(UserMod, handle_trans_ack, Args)),
+ Res = (catch handle_callback(ConnData, UserMod, handle_trans_ack, Args)),
?report_debug(ConnData, "return: trans ack", [T, AckData, {return, Res}]),
case Res of
ok ->
@@ -3024,6 +3068,14 @@ handle_ack_callback(ConnData, AckStatus, {handle_ack, AckData}, T, Extra) ->
Res.
+handle_callback(ConnData, undefined = _UserMod, Func, Args) ->
+ ?report_important(ConnData, "callback: unknown callback module",
+ [{func, Func}, {args, Args}]),
+ ok;
+handle_callback(_ConnData, UserMod, Func, Args) ->
+ (catch apply(UserMod, Func, Args)).
+
+
handle_message_error(ConnData, _Error, _Extra)
when ConnData#conn_data.monitor_ref == undefined_monitor_ref ->
%% May occur if another process already has setup a
@@ -3706,6 +3758,11 @@ insert_requests(ConnData, ConnHandle,
insert_request(ConnData, ConnHandle, TransId,
Action, Data, InitTimer, LongTimer) ->
+ %% We dont check the result of the lock-counter creation because
+ %% the only way it could already exist is if the transaction-id
+ %% range has wrapped and an old counter was not deleted.
+ megaco_monitor:request_lockcnt_cre(TransId),
+
#megaco_conn_handle{remote_mid = RemoteMid} = ConnHandle,
#conn_data{protocol_version = Version,
user_mod = UserMod,
@@ -4290,6 +4347,7 @@ cancel_request(ConnData, Req, Reason) ->
cancel_request2(ConnData, TransId, UserReply) ->
megaco_monitor:delete_request(TransId),
+ megaco_monitor:request_lockcnt_del(TransId),
megaco_config:del_pending_counter(recv, TransId), % OTP-7189
Serial = TransId#trans_id.serial,
ConnData2 = ConnData#conn_data{serial = Serial},
@@ -4347,34 +4405,76 @@ receive_reply_remote(ConnData, UserReply) ->
receive_reply_remote(ConnData, UserReply, Extra) ->
TransId = to_local_trans_id(ConnData),
- case (catch megaco_monitor:lookup_request(TransId)) of
- [#request{timer_ref = {_Type, Ref}} = Req] -> %% OTP-4843
+ case {megaco_monitor:request_lockcnt_inc(TransId),
+ (catch megaco_monitor:lookup_request(TransId))} of
+ {Cnt, [Req]} when (Cnt =:= 1) andalso is_record(Req, request) ->
%% Don't care about Req and Rep version diff
- megaco_monitor:delete_request(TransId),
- megaco_monitor:cancel_apply_after(Ref), % OTP-4843
- megaco_config:del_pending_counter(recv, TransId), % OTP-7189
-
- UserMod = Req#request.user_mod,
- UserArgs = Req#request.user_args,
- Action = Req#request.reply_action,
- UserData = Req#request.reply_data,
- ConnData2 = ConnData#conn_data{user_mod = UserMod,
- user_args = UserArgs,
- reply_action = Action,
- reply_data = UserData},
- return_reply(ConnData2, TransId, UserReply, Extra);
-
+ do_receive_reply_remote(ConnData, TransId, Req, UserReply, Extra);
+
+ {Cnt, [Req]} when is_integer(Cnt) andalso is_record(Req, request) ->
+ %% Another process is accessing, handle as unexpected
+ %% (so it has a possibillity to get logged).
+ ?report_important(ConnData, "trans reply (no receiver)",
+ [{user_reply, UserReply},
+ {request_lockcnt, Cnt}]),
+ megaco_monitor:request_lockcnt_dec(TransId),
+ return_unexpected_trans_reply(ConnData, TransId, UserReply, Extra);
+
+ %% no counter
+ {_Cnt, [Req]} when is_record(Req, request) ->
+ %% The counter does not exist.
+ %% This can only mean a code upgrade raise condition.
+ %% That is, this request record was created before
+ %% this feature (the counters) was instroduced.
+ %% The simples solution to this is to behave exactly as
+ %% before, that is, pass it along, and leave it to the
+ %% user to figure out.
+ ?report_trace(ConnData,
+ "remote reply - "
+ "code upgrade raise condition",
+ [{user_reply, UserReply}]),
+ do_receive_reply_remote(ConnData, TransId, Req, UserReply, Extra);
+
+ {Cnt, _} when is_integer(Cnt) ->
+ ?report_trace(ConnData, "trans reply (no receiver)",
+ [{user_reply, UserReply}, {request_lockcnt, Cnt}]),
+ megaco_monitor:request_lockcnt_dec(TransId),
+ return_unexpected_trans_reply(ConnData, TransId, UserReply, Extra);
+
_ ->
?report_trace(ConnData, "remote reply (no receiver)",
- [UserReply]),
+ [{user_reply, UserReply}]),
return_unexpected_trans_reply(ConnData, TransId, UserReply, Extra)
end.
-cancel_reply(ConnData, #reply{state = waiting_for_ack} = Rep, Reason) ->
+do_receive_reply_remote(ConnData, TransId,
+ #request{timer_ref = {_Type, Ref},
+ user_mod = UserMod,
+ user_args = UserArgs,
+ reply_action = Action,
+ reply_data = UserData} = _Req,
+ UserReply, Extra) ->
+ megaco_monitor:delete_request(TransId),
+ megaco_monitor:request_lockcnt_del(TransId),
+ megaco_monitor:cancel_apply_after(Ref), % OTP-4843
+ megaco_config:del_pending_counter(recv, TransId), % OTP-7189
+
+ ConnData2 = ConnData#conn_data{user_mod = UserMod,
+ user_args = UserArgs,
+ reply_action = Action,
+ reply_data = UserData},
+ return_reply(ConnData2, TransId, UserReply, Extra).
+
+
+cancel_reply(ConnData, #reply{state = waiting_for_ack,
+ user_mod = UserMod,
+ user_args = UserArgs} = Rep, Reason) ->
?report_trace(ignore, "cancel reply [waiting_for_ack]", [Rep]),
megaco_monitor:cancel_apply_after(Rep#reply.pending_timer_ref),
Serial = (Rep#reply.trans_id)#trans_id.serial,
- ConnData2 = ConnData#conn_data{serial = Serial},
+ ConnData2 = ConnData#conn_data{serial = Serial,
+ user_mod = UserMod,
+ user_args = UserArgs},
T = #'TransactionAck'{firstAck = Serial},
Extra = ?default_user_callback_extra,
handle_ack(ConnData2, {error, Reason}, Rep, T, Extra);
@@ -4558,16 +4658,30 @@ reply_timeout(ConnHandle, TransId, {_, timeout}) ->
reply_timeout(ConnHandle, TransId, Timer) ->
?report_trace(ConnHandle, "reply timeout", [Timer, TransId]),
- case megaco_monitor:lookup_reply(TransId) of
+ case lookup_reply(undefined, TransId) of
[] ->
reply_not_found_ignore;
- [#reply{state = waiting_for_ack,
- ack_action = {handle_ack, _}} = Rep] ->
+ {Converted,
+ #reply{state = waiting_for_ack,
+ ack_action = {handle_ack, _}} = Rep} ->
case megaco_config:lookup_local_conn(ConnHandle) of
[CD] when (CD#conn_data.cancel =:= true) ->
cancel_in_progress_ignore;
- [CD] ->
+ [CD] when (Converted =:= true) ->
+ incNumTimerRecovery(ConnHandle),
+ %% When we did the reply record lookup, we had no
+ %% conn_data record, and the reply record was
+ %% converted. This means that the reply record
+ %% has no valid info about user_mod or user_args.
+ %% Therefor, the user_mod and user_args of the
+ %% conn_data record is better then nothing.
+ #conn_data{user_mod = UserMod,
+ user_args = UserArgs} = CD,
+ Rep2 = Rep#reply{user_mod = UserMod,
+ user_args = UserArgs},
+ do_reply_timeout(ConnHandle, TransId, CD, Timer, Rep2);
+ [CD] when (Converted =:= false) ->
incNumTimerRecovery(ConnHandle),
do_reply_timeout(ConnHandle, TransId, CD, Timer, Rep);
[] ->
@@ -4576,10 +4690,25 @@ reply_timeout(ConnHandle, TransId, Timer) ->
do_reply_timeout(ConnHandle, TransId, CD, Timer, Rep)
end;
- [#reply{state = waiting_for_ack,
- bytes = Sent} = Rep] when is_list(Sent) ->
+ {Converted,
+ #reply{state = waiting_for_ack,
+ bytes = Sent} = Rep} when is_list(Sent) ->
case megaco_config:lookup_local_conn(ConnHandle) of
- [ConnData] ->
+ [ConnData] when (Converted =:= true) ->
+ incNumTimerRecovery(ConnHandle),
+ %% When we did the reply record lookup, we had no
+ %% conn_data record, and the reply record was
+ %% converted. This means that the reply record
+ %% has no valid info about user_mod or user_args.
+ %% Therefor, the user_mod and user_args of the
+ %% conn_data record is better then nothing.
+ #conn_data{user_mod = UserMod,
+ user_args = UserArgs} = ConnData,
+ Rep2 = Rep#reply{user_mod = UserMod,
+ user_args = UserArgs},
+ do_reply_timeout(ConnHandle, TransId, ConnData,
+ Timer, Rep2);
+ [ConnData] when (Converted =:= false) ->
incNumTimerRecovery(ConnHandle),
do_reply_timeout(ConnHandle, TransId, ConnData,
Timer, Rep);
@@ -4590,10 +4719,12 @@ reply_timeout(ConnHandle, TransId, Timer) ->
Timer, Rep)
end;
- [#reply{state = waiting_for_ack} = Rep] ->
+ {_Converted,
+ #reply{state = waiting_for_ack} = Rep} ->
do_reply_timeout(ConnHandle, TransId, Timer, Rep);
- [#reply{state = aborted} = Rep] ->
+ {_Converted,
+ #reply{state = aborted} = Rep} ->
do_reply_timeout(ConnHandle, TransId, Timer, Rep);
_ ->
@@ -4686,22 +4817,41 @@ handle_reply_timer_timeout(ConnHandle, TransId) ->
?report_trace(ConnHandle, "handle reply timeout", [timeout, TransId]),
incNumTimerRecovery(ConnHandle),
%% OTP-4378
- case megaco_monitor:lookup_reply(TransId) of
- [#reply{state = waiting_for_ack} = Rep] ->
+ case lookup_reply(undefined, TransId) of
+ {Converted,
+ #reply{state = waiting_for_ack} = Rep} ->
Serial = (Rep#reply.trans_id)#trans_id.serial,
- ConnData =
+ {Rep2, ConnData} =
case megaco_config:lookup_local_conn(ConnHandle) of
- [ConnData0] ->
- ConnData0;
- [] ->
- fake_conn_data(ConnHandle)
+ [ConnData0] when (Converted =:= false) ->
+ #reply{user_mod = UserMod,
+ user_args = UserArgs} = Rep,
+ {Rep,
+ ConnData0#conn_data{user_mod = UserMod,
+ user_args = UserArgs}};
+ [ConnData0] when (Converted =:= true) ->
+ {Rep#reply{user_mod = ConnData0#conn_data.user_mod,
+ user_args = ConnData0#conn_data.user_args},
+ ConnData0};
+ [] when (Converted =:= false) ->
+ ConnData0 = fake_conn_data(ConnHandle),
+ #reply{user_mod = UserMod,
+ user_args = UserArgs} = Rep,
+ {Rep,
+ ConnData0#conn_data{user_mod = UserMod,
+ user_args = UserArgs}};
+ [] when (Converted =:= true) ->
+ %% We have no valid info about user_mod and user_args
+ {Rep, fake_conn_data(ConnHandle)}
end,
ConnData2 = ConnData#conn_data{serial = Serial},
T = #'TransactionAck'{firstAck = Serial},
Extra = ?default_user_callback_extra,
- handle_ack(ConnData2, {error, timeout}, Rep, T, Extra);
- [#reply{pending_timer_ref = Ref, % aborted?
- bytes = SegSent}] -> % may be a binary
+ handle_ack(ConnData2, {error, timeout}, Rep2, T, Extra);
+
+ {_Converted,
+ #reply{pending_timer_ref = Ref, % aborted?
+ bytes = SegSent}} -> % may be a binary
megaco_monitor:cancel_apply_after(Ref),
cancel_segment_timers(SegSent),
megaco_monitor:delete_reply(TransId),
@@ -4803,9 +4953,10 @@ pending_timeout(ConnHandle, TransId, Timer) ->
handle_pending_timeout(CD, TransId, Timer) ->
?report_trace(CD, "handle pending timeout", []),
- case megaco_monitor:lookup_reply(TransId) of
- [#reply{state = State,
- handler = Pid} = Rep] when (State =:= prepare) orelse
+ case lookup_reply(CD, TransId) of
+ {_Converted,
+ #reply{state = State,
+ handler = Pid} = Rep} when (State =:= prepare) orelse
(State =:= eval_request) ->
#conn_data{sent_pending_limit = Limit,
@@ -4885,12 +5036,14 @@ handle_pending_timeout(CD, TransId, Timer) ->
[] ->
reply_not_found; % Trace ??
- [#reply{state = waiting_for_ack}] ->
+ {_Converted,
+ #reply{state = waiting_for_ack}} ->
%% The reply has already been sent
%% No need for any pending trans reply
reply_has_been_sent;
- [#reply{state = aborted} = Rep] ->
+ {_Converted,
+ #reply{state = aborted} = Rep} ->
%% glitch, but cleanup just the same
cancel_reply(CD, Rep, aborted),
reply_aborted_state
@@ -5096,7 +5249,65 @@ make_transaction_reply(_, TransId, IAR, TransRes) ->
%%-----------------------------------------------------------------
+%% This function is used as a wrapper for reply-record lookups.
+%% The intention is that during upgrade, this function
+%% can perform on-the-fly conversions of reply-records.
+lookup_reply(CD, TransId) ->
+ case megaco_monitor:lookup_reply(TransId) of
+ [#reply{} = Rep] ->
+ {false, Rep};
+
+ %% Old (pre-3.13.1) version of the record => Convert to new version
+ [{reply, TransId,
+ LocalMid, State, PendingTmrRef, Handler, TimerRef,
+ Version, Bytes, AckAction, SendHandle, Segments}]
+ when is_record(CD, conn_data) ->
+ #conn_data{user_mod = UserMod,
+ user_args = UserArgs} = CD,
+ Rep = #reply{trans_id = TransId,
+ local_mid = LocalMid,
+ state = State,
+ pending_timer_ref = PendingTmrRef,
+ handler = Handler,
+ timer_ref = TimerRef,
+ version = Version,
+ bytes = Bytes,
+ ack_action = AckAction,
+ send_handle = SendHandle,
+ segments = Segments,
+ user_mod = UserMod,
+ user_args = UserArgs},
+ {true, Rep};
+
+ %% Old (pre-3.13.1) version of the record => Convert to new version
+ [{reply, TransId,
+ LocalMid, State, PendingTmrRef, Handler, TimerRef,
+ Version, Bytes, AckAction, SendHandle, Segments}] ->
+ %% ConnData is not known here, so ignore for now
+ Rep = #reply{trans_id = TransId,
+ local_mid = LocalMid,
+ state = State,
+ pending_timer_ref = PendingTmrRef,
+ handler = Handler,
+ timer_ref = TimerRef,
+ version = Version,
+ bytes = Bytes,
+ ack_action = AckAction,
+ send_handle = SendHandle,
+ segments = Segments},
+ {true, Rep};
+
+ Else ->
+ Else
+ end.
+
+
%%-----------------------------------------------------------------
+
+%%-----------------------------------------------------------------
+%% info_msg(F, A) ->
+%% ?megaco_info(F, A).
+
warning_msg(F, A) ->
?megaco_warning(F, A).
@@ -5131,7 +5342,7 @@ error_msg(F, A) ->
%% Time in milli seconds
t() ->
- {A,B,C} = erlang:now(),
+ {A,B,C} = os:timestamp(),
A*1000000000+B*1000+(C div 1000).
@@ -5156,3 +5367,4 @@ incNum(Cnt) ->
Old
end.
+
diff --git a/lib/megaco/src/engine/megaco_monitor.erl b/lib/megaco/src/engine/megaco_monitor.erl
index f95a20cf58..29275371be 100644
--- a/lib/megaco/src/engine/megaco_monitor.erl
+++ b/lib/megaco/src/engine/megaco_monitor.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -51,6 +51,11 @@
update_request_field/3, update_request_fields/2,
delete_request/1,
+ request_lockcnt_cre/1,
+ request_lockcnt_del/1,
+ request_lockcnt_inc/1,
+ request_lockcnt_dec/1,
+
lookup_reply/1,
lookup_reply_field/2,
match_replies/1,
@@ -115,6 +120,24 @@ update_request_fields(Key, NewFields) when is_list(NewFields) ->
delete_request(Key) ->
ets:delete(megaco_requests, Key).
+
+request_lockcnt_cre(TransId) ->
+ Key = {TransId, lockcnt},
+ ets:insert_new(megaco_requests, {Key, 1}).
+
+request_lockcnt_del(TransId) ->
+ Key = {TransId, lockcnt},
+ ets:delete(megaco_requests, Key).
+
+request_lockcnt_inc(TransId) ->
+ Key = {TransId, lockcnt},
+ (catch ets:update_counter(megaco_requests, Key, 1)).
+
+request_lockcnt_dec(TransId) ->
+ Key = {TransId, lockcnt},
+ (catch ets:update_counter(megaco_requests, Key, -1)).
+
+
lookup_reply(Key) ->
ets:lookup(megaco_replies, Key).
diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in
index 782d6a4807..5af651d89b 100644
--- a/lib/megaco/src/flex/Makefile.in
+++ b/lib/megaco/src/flex/Makefile.in
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
include $(ERL_TOP)/make/target.mk
@@ -23,13 +23,30 @@ MEGACO_INCLUDEDIR = ../../include
include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
# ----------------------------------------------------
# Application version
# ----------------------------------------------------
include ../../vsn.mk
VSN=$(MEGACO_VSN)
+# ----------------------------------------------------
+# Dynamic Erlang Driver
+# ----------------------------------------------------
+HAVE_USABLE_OTP_DED_MK = @HAVE_USABLE_OTP_DED_MK@
+
+ifeq ($(HAVE_USABLE_OTP_DED_MK),yes)
+# otp_ded.mk will be used on R13B04 and later
+include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk
+else
+# megacos configure provide the info instead
+DED_CC = @CC@
+DED__NOWARN_NOTHR_CFLAGS = @DED_CFLAGS@
+DED_THR_DEFS = @DED_THR_DEFS@
+DED_LD = @DED_LD@
+DED_LDFLAGS = @DED_LDFLAGS@
+DED_INCLUDES = @DED_INCLUDES@
+DED_EXT = so
+endif
# ----------------------------------------------------
# The following variables differ on different systems, we set
@@ -39,16 +56,16 @@ VSN=$(MEGACO_VSN)
FLEX_VSN = $(shell flex --version)
-TMP_CFLAGS = @DED_CFLAGS@
+TMP_CFLAGS = $(DED__NOWARN_NOTHR_CFLAGS) @OTP_EXTRA_FLAGS@
ifeq ($(TYPE),valgrind)
CFLAGS = $(subst -O2, , $(TMP_CFLAGS)) -DVALGRIND
else
CFLAGS = $(TMP_CFLAGS)
endif
-CC = @CC@
-CFLAGS_MT = $(CFLAGS) -D_THREAD_SAFE -D_REENTRANT
-LD = @DED_LD@
-LDFLAGS = @DED_LDFLAGS@
+CC = $(DED_CC)
+CFLAGS_MT = $(CFLAGS) $(DED_THR_DEFS)
+LD = $(DED_LD)
+LDFLAGS = $(DED_LDFLAGS)
LEX = @LEX@
LEXLIB = @LEXLIB@
PERL = @PERL@
@@ -87,18 +104,13 @@ ENABLE_MEGACO_FLEX_SCANNER_LINENO = @ENABLE_MEGACO_FLEX_SCANNER_LINENO@
endif
endif
-
-SYSINCLUDE = -I$(ERL_TOP)/erts/emulator/beam \
- -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE)
ifeq ($(findstring vxworks,$(TARGET)),vxworks)
- SYSINCLUDE += -I$(ERL_TOP)/erts/etc/vxworks
+ DED_INCLUDES += -I$(ERL_TOP)/erts/etc/vxworks
endif
-DRIVER_INCLUDES = $(SYSINCLUDE)
-
PRIVDIR = ../../priv
LIBDIR = $(PRIVDIR)/lib/$(TARGET)
-
+OBJDIR = $(PRIVDIR)/obj/$(TARGET)
# ----------------------------------------------------
# Release directory specification
@@ -138,8 +150,8 @@ ifeq ($(findstring vxworks,$(TARGET)),vxworks)
FLEX_SCANNER_SO =
SOLIBS = $(FLEX_SCANNER_SO)
else
-FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).so
-FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).so
+FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).$(DED_EXT)
+FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).$(DED_EXT)
SOLIBS = $(FLEX_SCANNER_SO) $(FLEX_SCANNER_MT_SO)
endif
endif
@@ -175,7 +187,7 @@ else
CFLAGS += -DMFS_FLEX_DEBUG=0
endif
-CFLAGS += $(DRIVER_INCLUDES) $(DRV_FLAGS) -funroll-loops -Wall
+CFLAGS += $(DED_INCLUDES) -I$(ERL_TOP)/erts/$(TARGET) $(DRV_FLAGS) -funroll-loops -Wall
#ifneq ($(FLEX_VSN),)
#CFLAGS += -DFLEX_VERSION="$(FLEX_VSN)"
@@ -268,7 +280,7 @@ release_spec: opt
$(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true)
$(INSTALL_DATA) $(FLEX_FILES) $(C_TARGETS) $(RELSYSDIR)/src/flex
- $(INSTALL_DATA) $(SOLIBS) $(RELSYSDIR)/priv/lib
+ $(INSTALL_PROGRAM) $(SOLIBS) $(RELSYSDIR)/priv/lib
endif
@@ -379,18 +391,30 @@ $(STD_DRV).c: $(STD_DRV).flex
$(MT_DRV).c: $(MT_DRV).flex
$(LEX) $(MT_LEX_FLAGS) -P$* -o$@ $<
-solibs: $(LIBDIR) $(SOLIBS)
+solibs: $(LIBDIR) $(OBJDIR) $(SOLIBS)
+
+$(OBJDIR)/$(STD_DRV).o: $(STD_DRV).c
+ @echo "compiling std driver:"
+ $(CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $<
+
+$(OBJDIR)/$(MT_DRV).o: $(MT_DRV).c
+ @echo "compiling multi-threaded driver:"
+ $(CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $<
+
# No need to link with -lfl as we have also defined %option noyywrap -
# and having -lfl doesn't work under Darwin for some reason. - Sean
-$(LIBDIR)/$(STD_DRV).so: $(STD_DRV).c
- @echo "std driver:"
- $(CC) $(STD_DRV_NAME) $(CFLAGS) $(LDFLAGS) -o $(LIBDIR)/$(STD_DRV).so $<
+$(LIBDIR)/$(STD_DRV).$(DED_EXT): $(OBJDIR)/$(STD_DRV).o
+ @echo "linking std driver:"
+ $(LD) $(LDFLAGS) -o $@ $<
-$(LIBDIR)/$(MT_DRV).so: $(MT_DRV).c
- @echo "multi-threaded driver:"
- $(CC) $(MT_DRV_NAME) $(CFLAGS_MT) $(LDFLAGS) -o $(LIBDIR)/$(MT_DRV).so $<
+$(LIBDIR)/$(MT_DRV).$(DED_EXT): $(OBJDIR)/$(MT_DRV).o
+ @echo "linking multi-threaded driver:"
+ $(LD) $(LDFLAGS) -o $@ $<
$(LIBDIR):
-mkdir -p $(LIBDIR)
+$(OBJDIR):
+ -mkdir -p $(OBJDIR)
+
diff --git a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
index 3520c34d50..96621193e8 100644
--- a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
+++ b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src
@@ -8,12 +8,12 @@
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*
* ----------------------------------------------------------------------
@@ -361,9 +361,6 @@ static ErlDrvEntry mfs_entry = {
MEGACO_DRIVER_FLAGS, /* driver_flags, used for port lock indication */
NULL, /* handle2, emulator internal use */
NULL /* process_exit, Called when a process monitor fires */
-#if defined(MEGACO_DRV_ENTRY_HAS_STOP_SELECT)
- ,NULL /* stop_select, Called to close an event object */
-#endif
};
diff --git a/lib/megaco/src/flex/megaco_flex_scanner_handler.erl b/lib/megaco/src/flex/megaco_flex_scanner_handler.erl
index d09e0c6fff..420202134e 100644
--- a/lib/megaco/src/flex/megaco_flex_scanner_handler.erl
+++ b/lib/megaco/src/flex/megaco_flex_scanner_handler.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2001-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -180,27 +180,28 @@ terminate(_Reason, _S) ->
%% Purpose: Called to change the internal state
%% Returns: {ok, NewState}
%%----------------------------------------------------------------------
-%% code_change({down, _Vsn}, #state{conf = Conf} = State, downgrade_to_pre_3_8) ->
-%% Port = downgrade_flex_scanner(Conf),
-%% {ok, State#state{conf = {flex, Port}}};
+
+code_change({down, _Vsn}, #state{conf = Conf} = State, downgrade_to_pre_3_13_1) ->
+ NewPorts = bump_flex_scanner(Conf),
+ {ok, State#state{conf = {flex, NewPorts}}};
+
+code_change(_Vsn, #state{conf = Conf} = State, upgrade_from_pre_3_13_1) ->
+ NewPorts = bump_flex_scanner(Conf),
+ {ok, State#state{conf = {flex, NewPorts}}};
code_change(_Vsn, State, _Extra) ->
{ok, State}.
-%% downgrade_flex_scanner({flex, Port}) when is_port(Port) ->
-%% Port;
-%% downgrade_flex_scanner({flex, [Port]}) when is_port(Port) ->
-%% Port;
-%% downgrade_flex_scanner({flex, Ports}) when is_list(Ports) ->
-%% megaco_flex_scanner:stop(Ports),
-%% case megaco_flex_scanner:start() of
-%% {ok, Port} ->
-%% Port;
-%% Error ->
-%% exit(Error)
-%% end;
-%% downgrade_flex_scanner(BadConfig) ->
-%% exit({invalid_config, BadConfig}).
+bump_flex_scanner({flex, Ports}) ->
+ megaco_flex_scanner:stop(Ports),
+ case start_flex_scanners() of
+ {ok, NewPorts} ->
+ NewPorts;
+ Error ->
+ exit(Error)
+ end;
+bump_flex_scanner(BadConfig) ->
+ exit({invalid_config, BadConfig}).
%%%----------------------------------------------------------------------
diff --git a/lib/megaco/test/Makefile b/lib/megaco/test/Makefile
index a6f50f87c4..682b83d368 100644
--- a/lib/megaco/test/Makefile
+++ b/lib/megaco/test/Makefile
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1999-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 1999-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
include $(ERL_TOP)/make/target.mk
@@ -52,13 +52,15 @@ endif
include modules.mk
+EBIN = .
+
HRL_FILES = megaco_test_lib.hrl
ERL_FILES = $(MODULES:%=%.erl)
-TARGET_FILES = $(MODULES:%=%.$(EMULATOR))
+SOURCE = $(HRL_FILES) $(ERL_FILES)
-COVER_SPEC_FILE = megaco.cover
+TARGET_FILES = $(MODULES:%=%.$(EMULATOR))
APP_CASES = app appup
@@ -71,6 +73,18 @@ OP_CASES = mess mib mreq pending trans actions load
ALL_CASES = $(APP_CASES) $(CODEC_CASES) $(MISC_CASES) $(OP_CASES)
+EMAKEFILE = Emakefile
+MAKE_EMAKE = $(wildcard $(ERL_TOP)/make/make_emakefile)
+
+ifeq ($(MAKE_EMAKE),)
+BUILDTARGET = $(TARGET_FILES)
+RELTEST_FILES = $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) $(SOURCE)
+else
+BUILDTARGET = emakebuild
+RELTEST_FILES = $(EMAKEFILE) $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) $(SOURCE)
+endif
+
+
# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------
@@ -128,19 +142,153 @@ endif
# Targets
# ----------------------------------------------------
-tests debug opt: $(TARGET_FILES)
+tests debug opt: $(BUILDTARGET)
+
+targets: $(TARGET_FILES)
+
+.PHONY: emakebuild
+
+emakebuild: $(EMAKEFILE)
+
+$(EMAKEFILE):
+ $(MAKE_EMAKE) $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' | grep -v Warning > $(EMAKEFILE)
+ $(MAKE_EMAKE) $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) | grep -v Warning >> $(EMAKEFILE)
clean:
+ rm -f $(EMAKEFILE)
rm -f $(TARGET_FILES)
rm -f errs core *~
docs:
info:
+ @echo "MAKE_EMAKE = $(MAKE_EMAKE)"
+ @echo "EMAKEFILE = $(EMAKEFILE)"
+ @echo "BUILDTARGET = $(BUILDTARGET)"
+ @echo ""
@echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)"
@echo "ERL = $(ERL)"
@echo "MERL = $(MERL)"
@echo ""
+ @echo "ARGS = $(ARGS)"
+ @echo ""
+ @echo "HRL_FILES = $(HRL_FILES)"
+ @echo "ERL_FILES = $(ERL_FILES)"
+ @echo "TARGET_FILES = $(TARGET_FILES)"
+ @echo ""
+
+help:
+ @echo ""
+ @echo "This Makefile controls the test of the $(APPLICATION) application. "
+ @echo ""
+ @echo "There are two separate ways to perform the test of $(APPLICATION)."
+ @echo ""
+ @echo " a) Run the official OTP test-server (which we do not describe here)"
+ @echo ""
+ @echo " b) Run the test-server provided with this application. "
+ @echo " There are a number of targets to run the entire or parts"
+ @echo " of this applications ($(APPLICATION)) test-suite"
+ @echo ""
+ @echo "Targets:"
+ @echo ""
+ @echo " help"
+ @echo " Print this info"
+ @echo ""
+ @echo " info"
+ @echo " Prints various environment variables. "
+ @echo " May be useful when debugging the Makefile. "
+ @echo ""
+ @echo " tests | debug | opt "
+ @echo " Compile all test-code. "
+ @echo ""
+ @echo " clean "
+ @echo " Remove all targets. "
+ @echo ""
+ @echo " test"
+ @echo " Run the entire $(APPLICATION) test-suite. "
+ @echo ""
+ @echo " app"
+ @echo " Run the $(APPLICATION) application sub-test-suite. "
+ @echo ""
+ @echo " appup"
+ @echo " Run the $(APPLICATION) application upgrade (appup) sub-test-suite. "
+ @echo ""
+ @echo " conf"
+ @echo " Run the $(APPLICATION) config sub-test-suite. "
+ @echo " Checks various aspects of the megaco configuration. "
+ @echo ""
+ @echo " codec"
+ @echo " Run the $(APPLICATION) codec sub-test-suite(s). "
+ @echo ""
+ @echo " flex"
+ @echo " Run the $(APPLICATION) flex-scanner sub-test-suite. "
+ @echo " This sub-test-suite does not test the function of the scanner itself"
+ @echo " (that is done by the codec sub-test-suite(s)), instead, this"
+ @echo " sub-test-suite tests the *handling* of the flex-scanner linked-in driver."
+ @echo ""
+ @echo " dm"
+ @echo " Run the $(APPLICATION) digit-map sub-test-suite. "
+ @echo ""
+ @echo " tid"
+ @echo " Run the $(APPLICATION) binary term-id sub-test-suite. "
+ @echo ""
+ @echo " sdp"
+ @echo " Run the $(APPLICATION) SDP sub-test-suite. "
+ @echo ""
+ @echo " action"
+ @echo " Run the $(APPLICATION) actions sub-test-suite. "
+ @echo " Actions are building blocks of a $(APPLICATION) message. "
+ @echo " This sub-test-suite attempts to perform tests related to this, "
+ @echo " using all the supported codecs. "
+ @echo ""
+ @echo " mess"
+ @echo " Run the $(APPLICATION) message sub-test-suite"
+ @echo " This is basic message processing test-cases"
+ @echo ""
+ @echo " trans"
+ @echo " Run the $(APPLICATION) transaction sender sub-test-suite"
+ @echo " This is basic message processing for a megaco application "
+ @echo " configured to be using the transaction sender. "
+ @echo ""
+ @echo " mib"
+ @echo " Run the $(APPLICATION) $(APPLICATION)-mib sub-test-suite"
+ @echo " Tests related to the basic support for the $(APPLICATION) mib"
+ @echo " primarily counters"
+ @echo ""
+ @echo " mreq"
+ @echo " Run the $(APPLICATION) mreq sub-test-suite"
+ @echo " This is yet another sub-test-suite with message processing "
+ @echo " test-cases. "
+ @echo ""
+ @echo " pending"
+ @echo " Run the $(APPLICATION) pending-limit sub-test-suite"
+ @echo ""
+ @echo " udp"
+ @echo " Run the $(APPLICATION) UDP transport component sub-test-suite"
+ @echo ""
+ @echo " tcp"
+ @echo " Run the $(APPLICATION) TCP transport component sub-test-suite"
+ @echo ""
+ @echo " load"
+ @echo " Run the $(APPLICATION) load sub-test-suite"
+ @echo " This sub-test-suite performs load test test-cases using "
+ @echo " \"high\" message traffic. "
+ @echo ""
+ @echo " segment"
+ @echo " Run the $(APPLICATION) message segmentation sub-test-suite"
+ @echo " If using the UDP transport protocol, it is possible to send "
+ @echo " and receive segmented megaco replies (in version 3 of the protocol) "
+ @echo " This sub-test-suite tests this feature. "
+ @echo ""
+ @echo " timer"
+ @echo " Run the $(APPLICATION) timer sub-test-suite"
+ @echo " Basic test-suite for the megaco-timers"
+ @echo ""
+ @echo " ex"
+ @echo " Run the $(APPLICATION) example sub-test-suite"
+ @echo " The $(APPLICATION) application contains one example,"
+ @echo " this is a sub-test-suite based on the code,"
+ @echo ""
# ----------------------------------------------------
@@ -195,8 +343,6 @@ all: make
make: targets
-targets: $(TARGET_FILES)
-
test: make
$(MERL) $(ARGS) -sname megaco_test $(ERL_PATH) \
-s megaco_test_lib t $(SUITE) \
@@ -603,9 +749,10 @@ release_docs_spec:
release_tests_spec: tests
$(INSTALL_DIR) $(RELSYSDIR)
- $(INSTALL_DATA) $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) \
- $(HRL_FILES) $(ERL_FILES) \
- $(RELSYSDIR)
- $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)
+ $(INSTALL_DATA) $(RELTEST_FILES) $(RELSYSDIR)
+# $(INSTALL_DATA) $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) \
+# $(HRL_FILES) $(ERL_FILES) \
+# $(RELSYSDIR)
+#
chmod -f -R u+w $(RELSYSDIR)
diff --git a/lib/megaco/test/megaco_app_test.erl b/lib/megaco/test/megaco_app_test.erl
index 8e2148c236..597ec26338 100644
--- a/lib/megaco/test/megaco_app_test.erl
+++ b/lib/megaco/test/megaco_app_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2002-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -87,6 +87,10 @@ is_app(App) ->
case file:consult(File) of
{ok, [{application, App, AppFile}]} ->
{ok, AppFile};
+ {error, {LineNo, Mod, Code}} ->
+ IoList = lists:concat([File, ":", LineNo, ": ",
+ Mod:format_error(Code)]),
+ {error, list_to_atom(lists:flatten(IoList))};
Error ->
{error, {invalid_format, Error}}
end.
diff --git a/lib/megaco/test/megaco_config_test.erl b/lib/megaco/test/megaco_config_test.erl
index 453c1b8964..9ab1a7d90d 100644
--- a/lib/megaco/test/megaco_config_test.erl
+++ b/lib/megaco/test/megaco_config_test.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
@@ -106,166 +106,197 @@ config(Config) when is_list(Config) ->
Evil = 400,
End = 500,
+ InitialCmd =
+ fun(No, Desc, Cmd, VerifyVal) ->
+ initial_command(Initial + No, Desc, Cmd, VerifyVal)
+ end,
+
+ VerifyCmd =
+ fun(M, No, Key, V) ->
+ verify_user_default_command(M, Verify + No, Key, V)
+ end,
+
+ NiceCmd =
+ fun(M, No, Key, Val) ->
+ nice_user_update_command(M, Nice + No, Key, Val)
+ end,
+
+ EvilCmd =
+ fun(M, No, Key, Val) ->
+ evil_user_update_command(M, Evil + No, Key, Val)
+ end,
+
+ %% End commands
+ ExitCmd =
+ fun(No, Desc, Cmd) ->
+ exit_command(End + No, Desc, Cmd)
+ end,
+ ErrorCmd =
+ fun(No, Desc, Cmd, MainReason, TS) ->
+ error_command(End + No, Desc, Cmd, MainReason, TS)
+ end,
+ PlainCmd =
+ fun(No, Desc, Cmd, V) ->
+ command(End + No, Desc, Cmd, V)
+ end,
+
Commands =
[
%% Initial commands
- initial_command( Initial + 0,
- "enable trace",
- fun() -> megaco:enable_trace(100, io) end, ok),
- initial_command( Initial + 1,
- "start",
- fun() -> megaco:start() end, ok),
- initial_command( Initial + 2,
- "Verify no active requests",
- fun() -> megaco:system_info(n_active_requests) end,
- 0),
- initial_command( Initial + 3,
- "Verify no active replies",
- fun() -> megaco:system_info(n_active_replies) end,
- 0),
- initial_command( Initial + 4,
- "Verify no active connections",
- fun() ->
- megaco:system_info(n_active_connections)
- end,
- 0),
- initial_command( Initial + 5,
- "Verify no connections",
- fun() -> megaco:system_info(connections) end, []),
- initial_command( Initial + 6,
- "Verify no users",
- fun() -> megaco:system_info(users) end, []),
- initial_command( Initial + 7,
- "Start user",
- fun() -> megaco:start_user(Mid, []) end, ok),
-
+ InitialCmd(0,
+ "enable trace",
+ fun() -> megaco:enable_trace(100, io) end,
+ ok),
+ InitialCmd(1,
+ "start",
+ fun() -> megaco:start() end,
+ ok),
+ InitialCmd(2,
+ "Verify no active requests",
+ fun() -> megaco:system_info(n_active_requests) end,
+ 0),
+ InitialCmd(3,
+ "Verify no active replies",
+ fun() -> megaco:system_info(n_active_replies) end,
+ 0),
+ InitialCmd(4,
+ "Verify no active connections",
+ fun() -> megaco:system_info(n_active_connections) end,
+ 0),
+ InitialCmd(5,
+ "Verify no connections",
+ fun() -> megaco:system_info(connections) end,
+ []),
+ InitialCmd(6,
+ "Verify no users",
+ fun() -> megaco:system_info(users) end,
+ []),
+ InitialCmd(7,
+ "Start user",
+ fun() -> megaco:start_user(Mid, []) end,
+ ok),
+
%% Verify user defaults
- verify_user_default_command(Mid, Verify + 1, connections, []),
- verify_user_default_command(Mid, Verify + 2, min_trans_id, 1),
- verify_user_default_command(Mid, Verify + 3, max_trans_id, infinity),
- verify_user_default_command(Mid, Verify + 4, request_timer,
- #megaco_incr_timer{}),
- verify_user_default_command(Mid, Verify + 5, long_request_timer, timer:seconds(60)),
- verify_user_default_command(Mid, Verify + 6, auto_ack, false),
- verify_user_default_command(Mid, Verify + 7, pending_timer, 30000),
- verify_user_default_command(Mid, Verify + 8, reply_timer, 30000),
- verify_user_default_command(Mid, Verify + 9, send_mod, megaco_tcp),
- verify_user_default_command(Mid, Verify + 10, encoding_mod,
- megaco_pretty_text_encoder),
- verify_user_default_command(Mid, Verify + 11, encoding_config, []),
- verify_user_default_command(Mid, Verify + 12, protocol_version, 1),
- verify_user_default_command(Mid, Verify + 13, reply_data, undefined),
- verify_user_default_command(Mid, Verify + 14, receive_handle,
- fun(H) when is_record(H, megaco_receive_handle) -> {ok, H};
- (R) -> {error, R}
- end),
+ VerifyCmd(Mid, 1, connections, []),
+ VerifyCmd(Mid, 2, min_trans_id, 1),
+ VerifyCmd(Mid, 3, max_trans_id, infinity),
+ VerifyCmd(Mid, 4, request_timer, #megaco_incr_timer{}),
+ VerifyCmd(Mid, 5, long_request_timer, timer:seconds(60)),
+ VerifyCmd(Mid, 6, auto_ack, false),
+ VerifyCmd(Mid, 7, pending_timer, 30000),
+ VerifyCmd(Mid, 8, reply_timer, 30000),
+ VerifyCmd(Mid, 9, send_mod, megaco_tcp),
+ VerifyCmd(Mid, 10, encoding_mod, megaco_pretty_text_encoder),
+ VerifyCmd(Mid, 11, encoding_config, []),
+ VerifyCmd(Mid, 12, protocol_version, 1),
+ VerifyCmd(Mid, 13, reply_data, undefined),
+ VerifyCmd(Mid, 14, receive_handle,
+ fun(H) when is_record(H, megaco_receive_handle) ->
+ {ok, H};
+ (R) ->
+ {error, R}
+ end),
%% Nice update
- nice_user_update_command(Mid, Nice + 1, min_trans_id, Int),
- nice_user_update_command(Mid, Nice + 2, max_trans_id, Int),
- nice_user_update_command(Mid, Nice + 3, max_trans_id, infinity),
- nice_user_update_command(Mid, Nice + 4, request_timer, Int),
- nice_user_update_command(Mid, Nice + 5, request_timer, infinity),
- nice_user_update_command(Mid, Nice + 6, request_timer, IT),
- nice_user_update_command(Mid, Nice + 7, long_request_timer, Int),
- nice_user_update_command(Mid, Nice + 8, long_request_timer, infinity),
- nice_user_update_command(Mid, Nice + 9, long_request_timer, IT),
- nice_user_update_command(Mid, Nice + 10, auto_ack, true),
- nice_user_update_command(Mid, Nice + 11, auto_ack, false),
- nice_user_update_command(Mid, Nice + 12, pending_timer, Int),
- nice_user_update_command(Mid, Nice + 13, pending_timer, infinity),
- nice_user_update_command(Mid, Nice + 14, pending_timer, IT),
- nice_user_update_command(Mid, Nice + 15, reply_timer, Int),
- nice_user_update_command(Mid, Nice + 16, reply_timer, infinity),
- nice_user_update_command(Mid, Nice + 17, reply_timer, IT),
- nice_user_update_command(Mid, Nice + 18, send_mod, an_atom),
- nice_user_update_command(Mid, Nice + 19, encoding_mod, an_atom),
- nice_user_update_command(Mid, Nice + 20, encoding_config, []),
- nice_user_update_command(Mid, Nice + 21, protocol_version, Int),
- nice_user_update_command(Mid, Nice + 23, reply_data, IT),
- nice_user_update_command(Mid, Nice + 23, resend_indication, true),
- nice_user_update_command(Mid, Nice + 24, resend_indication, false),
- nice_user_update_command(Mid, Nice + 25, resend_indication, flag),
+ NiceCmd(Mid, 1, min_trans_id, Int),
+ NiceCmd(Mid, 2, max_trans_id, Int),
+ NiceCmd(Mid, 3, max_trans_id, infinity),
+ NiceCmd(Mid, 4, request_timer, Int),
+ NiceCmd(Mid, 5, request_timer, infinity),
+ NiceCmd(Mid, 6, request_timer, IT),
+ NiceCmd(Mid, 7, long_request_timer, Int),
+ NiceCmd(Mid, 8, long_request_timer, infinity),
+ NiceCmd(Mid, 9, long_request_timer, IT),
+ NiceCmd(Mid, 10, auto_ack, true),
+ NiceCmd(Mid, 11, auto_ack, false),
+ NiceCmd(Mid, 12, pending_timer, Int),
+ NiceCmd(Mid, 13, pending_timer, infinity),
+ NiceCmd(Mid, 14, pending_timer, IT),
+ NiceCmd(Mid, 15, reply_timer, Int),
+ NiceCmd(Mid, 16, reply_timer, infinity),
+ NiceCmd(Mid, 17, reply_timer, IT),
+ NiceCmd(Mid, 18, send_mod, an_atom),
+ NiceCmd(Mid, 19, encoding_mod, an_atom),
+ NiceCmd(Mid, 20, encoding_config, []),
+ NiceCmd(Mid, 21, protocol_version, Int),
+ NiceCmd(Mid, 23, reply_data, IT),
+ NiceCmd(Mid, 23, resend_indication, true),
+ NiceCmd(Mid, 24, resend_indication, false),
+ NiceCmd(Mid, 25, resend_indication, flag),
%% Evil update
- evil_user_update_command(Mid, Evil + 1, min_trans_id, NonInt),
- evil_user_update_command(Mid, Evil + 2, max_trans_id, NonInt),
- evil_user_update_command(Mid, Evil + 3, max_trans_id, non_infinity),
- evil_user_update_command(Mid, Evil + 4, request_timer, NonInt),
- evil_user_update_command(Mid, Evil + 5, request_timer, non_infinity),
- evil_user_update_command(Mid, Evil + 6, request_timer, IT2),
- evil_user_update_command(Mid, Evil + 7, request_timer, IT3),
- evil_user_update_command(Mid, Evil + 8, request_timer, IT4),
- evil_user_update_command(Mid, Evil + 9, request_timer, IT5),
- evil_user_update_command(Mid, Evil + 10, long_request_timer, NonInt),
- evil_user_update_command(Mid, Evil + 11, long_request_timer, non_infinity),
- evil_user_update_command(Mid, Evil + 12, long_request_timer, IT2),
- evil_user_update_command(Mid, Evil + 13, long_request_timer, IT3),
- evil_user_update_command(Mid, Evil + 14, long_request_timer, IT4),
- evil_user_update_command(Mid, Evil + 15, long_request_timer, IT5),
- evil_user_update_command(Mid, Evil + 16, auto_ack, non_bool),
- evil_user_update_command(Mid, Evil + 17, pending_timer, NonInt),
- evil_user_update_command(Mid, Evil + 18, pending_timer, non_infinity),
- evil_user_update_command(Mid, Evil + 19, pending_timer, IT2),
- evil_user_update_command(Mid, Evil + 20, pending_timer, IT3),
- evil_user_update_command(Mid, Evil + 21, pending_timer, IT4),
- evil_user_update_command(Mid, Evil + 22, pending_timer, IT5),
- evil_user_update_command(Mid, Evil + 23, reply_timer, NonInt),
- evil_user_update_command(Mid, Evil + 24, reply_timer, non_infinity),
- evil_user_update_command(Mid, Evil + 25, reply_timer, IT2),
- evil_user_update_command(Mid, Evil + 26, reply_timer, IT3),
- evil_user_update_command(Mid, Evil + 27, reply_timer, IT4),
- evil_user_update_command(Mid, Evil + 28, reply_timer, IT5),
- evil_user_update_command(Mid, Evil + 29, send_mod, {non_atom}),
- evil_user_update_command(Mid, Evil + 30, encoding_mod, {non_atom}),
- evil_user_update_command(Mid, Evil + 31, encoding_config, non_list),
- evil_user_update_command(Mid, Evil + 32, protocol_version, NonInt),
- evil_user_update_command(Mid, Evil + 33, resend_indication, flagg),
-
-
- exit_command(End + 1,
- "Verify non-existing system info",
- fun() -> megaco:system_info(non_exist) end),
- exit_command(End + 2,
- "Verify non-existing user user info",
- fun() -> megaco:user_info(non_exist, trans_id) end),
- exit_command(End + 3, "Verify non-existing user info",
- fun() -> megaco:user_info(Mid, non_exist) end),
-
- error_command(End + 4,
- "Try updating user info for non-existing user",
- fun() ->
- megaco:update_user_info(non_exist, trans_id, 1)
- end,
- no_such_user, 2),
- error_command(End + 11,
- "Try updating non-existing user info",
- fun() ->
- megaco:update_user_info(Mid, trans_id, 4711)
- end,
- bad_user_val, 4),
- error_command(End + 12,
- "Try start already started user",
- fun() ->
- megaco:start_user(Mid, [])
- end,
- user_already_exists, 2),
-
- command(End + 13, "Verify started users",
- fun() -> megaco:system_info(users) end, [Mid]),
- command(End + 14, "Stop user", fun() -> megaco:stop_user(Mid) end, ok),
- command(End + 15, "Verify started users",
- fun() -> megaco:system_info(users) end, []),
- error_command(End + 16, "Try stop not started user",
- fun() -> megaco:stop_user(Mid) end, no_such_user, 2),
- error_command(End + 17, "Try start megaco (it's already started)",
- fun() -> megaco:start() end, already_started, 2),
- command(End + 18, "Stop megaco", fun() -> megaco:stop() end, ok),
- error_command(End + 19, "Try stop megaco (it's not running)",
- fun() -> megaco:stop() end, not_started, 2)
+ EvilCmd(Mid, 1, min_trans_id, NonInt),
+ EvilCmd(Mid, 2, max_trans_id, NonInt),
+ EvilCmd(Mid, 3, max_trans_id, non_infinity),
+ EvilCmd(Mid, 4, request_timer, NonInt),
+ EvilCmd(Mid, 5, request_timer, non_infinity),
+ EvilCmd(Mid, 6, request_timer, IT2),
+ EvilCmd(Mid, 7, request_timer, IT3),
+ EvilCmd(Mid, 8, request_timer, IT4),
+ EvilCmd(Mid, 9, request_timer, IT5),
+ EvilCmd(Mid, 10, long_request_timer, NonInt),
+ EvilCmd(Mid, 11, long_request_timer, non_infinity),
+ EvilCmd(Mid, 12, long_request_timer, IT2),
+ EvilCmd(Mid, 13, long_request_timer, IT3),
+ EvilCmd(Mid, 14, long_request_timer, IT4),
+ EvilCmd(Mid, 15, long_request_timer, IT5),
+ EvilCmd(Mid, 16, auto_ack, non_bool),
+ EvilCmd(Mid, 17, pending_timer, NonInt),
+ EvilCmd(Mid, 18, pending_timer, non_infinity),
+ EvilCmd(Mid, 19, pending_timer, IT2),
+ EvilCmd(Mid, 20, pending_timer, IT3),
+ EvilCmd(Mid, 21, pending_timer, IT4),
+ EvilCmd(Mid, 22, pending_timer, IT5),
+ EvilCmd(Mid, 23, reply_timer, NonInt),
+ EvilCmd(Mid, 24, reply_timer, non_infinity),
+ EvilCmd(Mid, 25, reply_timer, IT2),
+ EvilCmd(Mid, 26, reply_timer, IT3),
+ EvilCmd(Mid, 27, reply_timer, IT4),
+ EvilCmd(Mid, 28, reply_timer, IT5),
+ EvilCmd(Mid, 29, send_mod, {non_atom}),
+ EvilCmd(Mid, 30, encoding_mod, {non_atom}),
+ EvilCmd(Mid, 31, encoding_config, non_list),
+ EvilCmd(Mid, 32, protocol_version, NonInt),
+ EvilCmd(Mid, 33, resend_indication, flagg),
+
+
+ %% End
+ ExitCmd(1, "Verify non-existing system info",
+ fun() -> megaco:system_info(non_exist) end),
+ ExitCmd(2, "Verify non-existing user user info",
+ fun() -> megaco:user_info(non_exist, trans_id) end),
+ ExitCmd(3, "Verify non-existing user info",
+ fun() -> megaco:user_info(Mid, non_exist) end),
+
+ ErrorCmd(4, "Try updating user info for non-existing user",
+ fun() ->
+ megaco:update_user_info(non_exist, trans_id, 1)
+ end,
+ no_such_user, 2),
+ ErrorCmd(11, "Try updating non-existing user info",
+ fun() ->
+ megaco:update_user_info(Mid, trans_id, 4711)
+ end,
+ bad_user_val, 4),
+ ErrorCmd(12, "Try start already started user",
+ fun() -> megaco:start_user(Mid, []) end,
+ user_already_exists, 2),
+
+ PlainCmd(13, "Verify started users",
+ fun() -> megaco:system_info(users) end, [Mid]),
+ PlainCmd(14, "Stop user", fun() -> megaco:stop_user(Mid) end, ok),
+ PlainCmd(15, "Verify started users",
+ fun() -> megaco:system_info(users) end, []),
+ ErrorCmd(16, "Try stop not started user",
+ fun() -> megaco:stop_user(Mid) end, no_such_user, 2),
+ ErrorCmd(17, "Try start megaco (it's already started)",
+ fun() -> megaco:start() end, already_started, 2),
+ PlainCmd(18, "Stop megaco", fun() -> megaco:stop() end, ok),
+ ErrorCmd(19, "Try stop megaco (it's not running)",
+ fun() -> megaco:stop() end, not_started, 2)
],
@@ -279,7 +310,7 @@ exec([#command{id = No,
desc = Desc,
cmd = Cmd,
verify = Verify}|Commands]) ->
- io:format("Executing command ~2w: ~s: ", [No, Desc]),
+ io:format("Executing command ~3w: ~s: ", [No, Desc]),
case (catch Verify((catch Cmd()))) of
{ok, OK} ->
io:format("ok => ~p~n", [OK]),
@@ -320,7 +351,7 @@ nice_user_update_command(Mid, No, Key, Val) ->
evil_user_update_command(Mid, No, Key, Val) ->
- Desc = lists:flatten(io_lib:format("Evil: Update ~w", [Key])),
+ Desc = lists:flatten(io_lib:format("Evil - Update ~w", [Key])),
Cmd = fun() ->
case (catch megaco:user_info(Mid, Key)) of
{'EXIT', R} ->
@@ -371,14 +402,19 @@ error_command(No, Desc, Cmd, MainReason, TS) when is_function(Cmd) ->
end,
command(No, Desc, Cmd, Verify).
-command(No, Desc, Cmd, Verify) when is_integer(No) and is_list(Desc) and
- is_function(Cmd) and is_function(Verify) ->
+command(No, Desc, Cmd, Verify)
+ when (is_integer(No) andalso
+ is_list(Desc) andalso
+ is_function(Cmd) andalso
+ is_function(Verify)) ->
#command{id = No,
desc = Desc,
cmd = Cmd,
verify = Verify};
-command(No, Desc, Cmd, VerifyVal) when is_integer(No) and is_list(Desc) and
- is_function(Cmd) ->
+command(No, Desc, Cmd, VerifyVal)
+ when (is_integer(No) andalso
+ is_list(Desc) andalso
+ is_function(Cmd)) ->
Verify = fun(Val) ->
case Val of
VerifyVal ->
@@ -881,6 +917,12 @@ otp_8167(Config) when is_list(Config) ->
p("connect ok: CD = ~n~p", [CD]),
CH = CD#conn_data.conn_handle,
+ p("get value for item cancel from connection: ~p", [CH]),
+ false = megaco_config:conn_info(CH, cancel),
+
+ p("get value for item cancel from connection data", []),
+ false = megaco_config:conn_info(CD, cancel),
+
p("get value for item call_proxy_gc_timeout for connection: ~p", [CH]),
10101 = megaco_config:conn_info(CH, call_proxy_gc_timeout),
diff --git a/lib/megaco/test/modules.mk b/lib/megaco/test/modules.mk
index 0186a84c26..049d8babe2 100644
--- a/lib/megaco/test/modules.mk
+++ b/lib/megaco/test/modules.mk
@@ -1,24 +1,26 @@
#-*-makefile-*- ; force emacs to enter makefile-mode
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2001-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
TEST_SPEC_FILE = megaco.spec
+COVER_SPEC_FILE = megaco.cover
+
BEHAVIOUR_MODULES = \
megaco_test_generator
diff --git a/lib/megaco/vsn.mk b/lib/megaco/vsn.mk
index 6ec7f3192a..63c9ab0ef7 100644
--- a/lib/megaco/vsn.mk
+++ b/lib/megaco/vsn.mk
@@ -1,27 +1,13 @@
-#-*-makefile-*- ; force emacs to enter makefile-mode
-
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-# the License for the specific language governing rights and limitations
-# under the License.
-#
-# %CopyrightEnd%
-
-MEGACO_VSN = 3.13
+APPLICATION = megaco
+MEGACO_VSN = 3.14.1
PRE_VSN =
-APP_VSN = "megaco-$(MEGACO_VSN)$(PRE_VSN)"
+APP_VSN = "$(APPLICATION)-$(MEGACO_VSN)$(PRE_VSN)"
-TICKETS = OTP-8205 OTP-8239 OTP-8249
+TICKETS = OTP-8529 OTP-8561 OTP-8627 OTP-8634
+
+TICKETS_3_14 = OTP-8317 OTP-8323 OTP-8328 OTP-8362 OTP-8403
+
+TICKETS_3_13 = OTP-8205 OTP-8239 OTP-8249
TICKETS_3_12 = OTP-8183 OTP-8212