mirror of https://github.com/sipwise/kamailio.git
parent
153a3ba271
commit
a8c25c0799
@ -0,0 +1,373 @@
|
||||
--- /root/sip-router/etc/sip-router-oob.cfg 2011-04-05 21:11:22.000000000 +0200
|
||||
+++ sip-router-oob-RTPPROXY.cfg-pre_flexroute 2011-04-05 21:03:19.000000000 +0200
|
||||
@@ -283,23 +287,11 @@
|
||||
#
|
||||
session_timer.min_se = "90" desc "minimum session interval (in s)"
|
||||
|
||||
-# RTP Proxy options
|
||||
-#
|
||||
-# Whether to enable or disable the rtp proxy. Possible values are:
|
||||
-# "0" -- always disable
|
||||
-# "1" -- always enable regardless of whether UAC or UAS is behind NAT
|
||||
-# "detect" -- detect whether the UAC or the UAS is behind NAT,
|
||||
-# and enable the rtp proxy when necessary
|
||||
-#
|
||||
-#DEBCONF-RTP_ENABLE-START
|
||||
-rtp_proxy.enabled = "detect" desc "indicates whether the RTP Proxy is enabled or not (0/1/detect)"
|
||||
-#DEBCONF-RTP_ENABLE-END
|
||||
-
|
||||
# ------------------ Module Loading -----------------------------------------
|
||||
#!ifdef LOCAL_TEST_RUN
|
||||
loadpath "modules:modules_s"
|
||||
#!else
|
||||
-loadpath "/usr/lib/sip-router/modules:/usr/lib/sip-router/modules_s"
|
||||
+loadpath "/usr/local/lib/ser/modules:/usr/local/lib/ser/modules_s"
|
||||
#!endif
|
||||
|
||||
# load a SQL database for authentication, domains, user AVPs etc.
|
||||
@@ -457,7 +449,7 @@
|
||||
modparam("rr", "enable_full_lr", 1)
|
||||
|
||||
# Limit the length of the AVP cookie to necessary attributes only
|
||||
-modparam("rr", "cookie_filter", "(account|rproxy|stimer|dialog_id)")
|
||||
+modparam("rr", "cookie_filter", "(account|stimer|dialog_id)")
|
||||
|
||||
# You probably do not want that someone can simply read and change
|
||||
# the AVP cookie in your Routes, thus should really change this
|
||||
@@ -467,7 +459,7 @@
|
||||
# The ftag Route parameter may be used to easily determine if a BYE
|
||||
# is coming from caller or callee, but we prefer shorter messages
|
||||
# Enable when FLAG_REVERSE_DIR is to be used
|
||||
-modparam("rr", "append_fromtag", 0)
|
||||
+modparam("rr", "append_fromtag", 1)
|
||||
|
||||
|
||||
# -- gflags --
|
||||
@@ -529,7 +521,7 @@
|
||||
|
||||
# RTP Proxy address
|
||||
#DEBCONF-RTTPPROXY-START
|
||||
-modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:22222")
|
||||
+#modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:22222")
|
||||
#DEBCONF-RTTPPROXY-END
|
||||
|
||||
# TCP keepalives as simple as CRLF
|
||||
@@ -649,7 +641,7 @@
|
||||
route(PSTN);
|
||||
|
||||
# nothing matched
|
||||
- sl_reply("404", "No route matched");
|
||||
+ t_reply("404", "No route matched");
|
||||
}
|
||||
|
||||
# Forward a request to the destination set.
|
||||
@@ -668,7 +660,8 @@
|
||||
# If this is an initial INVITE (without a To-tag) we might try
|
||||
# another target (call forwarding or voicemail) after receiving
|
||||
# an error.
|
||||
- if (isflagset(FLAG_INIT_DLG)) {
|
||||
+ # and also for RTPPROXY processing
|
||||
+ if (method=="INVITE" || method == "UPDATE") {
|
||||
t_on_failure("FAILURE_ROUTE");
|
||||
}
|
||||
|
||||
@@ -682,7 +675,7 @@
|
||||
|
||||
# Activate the RTP proxy as the second last step because it modifies the
|
||||
# body but also sets an dialog AVP cookie.
|
||||
- route(RTPPROXY);
|
||||
+ route(RTPPROXY_PROCESS_REQUEST);
|
||||
|
||||
# Insert a Record-Route header into all requests.
|
||||
# This has to be done as one of the last steps to include all the
|
||||
@@ -742,10 +735,10 @@
|
||||
# if needed then we MUST put after force_rport() which is located in NAT_DETECTION!!!
|
||||
# also must be called after FLAG_ACC is set !!!
|
||||
# Check t_reply() vs. sl_reply() usage in script
|
||||
- #if (!t_newtran()) {
|
||||
- # sl_reply("500", "Internal tm error");
|
||||
- # drop;
|
||||
- #}
|
||||
+ if (!t_newtran()) {
|
||||
+ sl_reply("500", "Internal tm error");
|
||||
+ drop;
|
||||
+ }
|
||||
|
||||
# Set flag and use it instead of the attribute.
|
||||
if ($replicate==1) {
|
||||
@@ -765,6 +758,7 @@
|
||||
(uri == myself || $t.did != ""))
|
||||
{
|
||||
options_reply();
|
||||
+ t_release();
|
||||
drop;
|
||||
}
|
||||
}
|
||||
@@ -879,47 +873,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-# Activates RTP proxy if necessary.
|
||||
-#
|
||||
-route[RTPPROXY]
|
||||
-{
|
||||
- if (@cfg_get.rtp_proxy.enabled == "0") {
|
||||
- # RTP Proxy is disabled
|
||||
- break;
|
||||
- } else if (@cfg_get.rtp_proxy.enabled == "detect") {
|
||||
- if (!isflagset(FLAG_NAT)) {
|
||||
- # If no NAT is involved we don't have to do here anything.
|
||||
- break;
|
||||
- }
|
||||
- } else if (@cfg_get.rtp_proxy.enabled != "1") {
|
||||
- # This is not a valid setting
|
||||
- xlog("L_ERR", "Unknown option for rtp_proxy.enabled: %@cfg_get.rtp_proxy.enabled\n");
|
||||
- break;
|
||||
- } # else rtp proxy is permanently enabled
|
||||
-
|
||||
- # If the message terminates a dialog for which the RTP proxy
|
||||
- # was turned on, turn it off again.
|
||||
- if ((method == "BYE" && isflagset(FLAG_RTP_PROXY)) ||
|
||||
- (method == "CANCEL")) {
|
||||
- unforce_rtp_proxy();
|
||||
- append_hf("P-RTP-Proxy: Off\r\n");
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- # Turn the RTP proxy on for INVITEs and UPDATEs, if they
|
||||
- # have a body
|
||||
- if (((method=="INVITE" || method == "UPDATE") && @msg.body != "")
|
||||
- && !isflagset(FLAG_RTP_PROXY))
|
||||
- {
|
||||
- force_rtp_proxy('r');
|
||||
- append_hf("P-RTP-Proxy: On\r\n");
|
||||
- setflag(FLAG_RTP_PROXY);
|
||||
- $rproxy = 1;
|
||||
- setavpflag($rproxy, "dialog_cookie");
|
||||
- }
|
||||
-}
|
||||
-
|
||||
+include_file "sip-router-oob-RTPPROXY.cfg.inc"
|
||||
|
||||
# Handling of Route headers
|
||||
#
|
||||
@@ -934,7 +888,7 @@
|
||||
xlog("L_DEBUG", "\n%mb\n\ndialogid -/from/to=%$dialog_id/%$f.dialog_id/%$t.dialog_id");
|
||||
if (method == "INVITE" || method == "UPDATE" || method == "ACK" || method == "BYE") {
|
||||
if (!defined $dialog_id) {
|
||||
- sl_reply("400", "Missing cookie");
|
||||
+ t_reply("400", "Missing cookie");
|
||||
drop;
|
||||
}
|
||||
}
|
||||
@@ -954,11 +908,6 @@
|
||||
setflag(FLAG_ACC_MISSED);
|
||||
}
|
||||
|
||||
- # Restore the RTP proxy flag if present
|
||||
- if ($rproxy == "1") {
|
||||
- setflag(FLAG_RTP_PROXY);
|
||||
- }
|
||||
-
|
||||
# Restore Session Timer flag and headers.
|
||||
if ( defined $stimer && ($stimer != "0")) {
|
||||
route(SESSION_TIMER);
|
||||
@@ -1039,7 +988,7 @@
|
||||
# then From b@B and To a@A. There is no mentioning of c@C despite
|
||||
# legitimate behaviour of c@C).
|
||||
if (!isflagset(FLAG_TOTAG) && strempty($t.did) && strempty($f.did)) {
|
||||
- sl_reply("403", "Relaying Forbidden");
|
||||
+ t_reply("403", "Relaying Forbidden");
|
||||
drop;
|
||||
}
|
||||
}
|
||||
@@ -1057,6 +1006,7 @@
|
||||
# If this is a replica (sent to the multicast address), trust it to
|
||||
# be secure and store it in usrloc
|
||||
if (dst_ip==224.0.1.75) {
|
||||
+ t_release();
|
||||
if (!isflagset(FLAG_REPL_ENABLED)) {
|
||||
# Multicast replication administratively disabled.
|
||||
# Ignore.
|
||||
@@ -1097,13 +1047,13 @@
|
||||
|
||||
# Check if the REGISTER if for one of our local domains.
|
||||
if (strempty($t.did)) {
|
||||
- sl_reply("403", "Register Forwarding Forbidden");
|
||||
+ t_reply("403", "Register Forwarding Forbidden");
|
||||
drop;
|
||||
}
|
||||
|
||||
# The REGISTER target is in the To header, so reload the domain.
|
||||
if (!lookup_domain("$td", "@to.uri.host")) {
|
||||
- sl_reply("404", "Unknown Domain");
|
||||
+ t_reply("404", "Unknown Domain");
|
||||
drop;
|
||||
}
|
||||
|
||||
@@ -1115,29 +1065,29 @@
|
||||
# We want only authenticated users to be registered.
|
||||
if (!www_authenticate("$fd.digest_realm", "credentials")) {
|
||||
if ($? == -2) {
|
||||
- sl_reply("500", "Internal Server Error");
|
||||
+ t_reply("500", "Internal Server Error");
|
||||
}
|
||||
else if ($? == -3) {
|
||||
- sl_reply("400", "Bad Request");
|
||||
+ t_reply("400", "Bad Request");
|
||||
}
|
||||
else {
|
||||
if ($digest_challenge != "") {
|
||||
append_to_reply("%$digest_challenge");
|
||||
}
|
||||
- sl_reply("401", "Unauthorized");
|
||||
+ t_reply("401", "Unauthorized");
|
||||
}
|
||||
drop;
|
||||
}
|
||||
|
||||
# Check if the authenticated user is the same as the target user.
|
||||
if (!lookup_user("$tu.uid", "@to.uri")) {
|
||||
- sl_reply("404", "Unknown user in To");
|
||||
+ t_reply("404", "Unknown user in To");
|
||||
drop;
|
||||
}
|
||||
|
||||
# the authentication ID does not match the ID in the To header
|
||||
if ($f.uid != $t.uid) {
|
||||
- sl_reply("403", "Authentication and To-Header mismatch");
|
||||
+ t_reply("403", "Authentication and To-Header mismatch");
|
||||
drop;
|
||||
}
|
||||
|
||||
@@ -1145,11 +1095,11 @@
|
||||
# originator. You may uncomment it if you care, which URI is in
|
||||
# the From header.
|
||||
#if (!lookup_user("$fr.uid", "@from.uri")) {
|
||||
- # sl_reply("404", "Unknown user in From");
|
||||
+ # t_reply("404", "Unknown user in From");
|
||||
# drop;
|
||||
#}
|
||||
#if ($fu.uid != $fr.uid) {
|
||||
- # sl_reply("403", "Authentication and From-Header mismatch");
|
||||
+ # t_reply("403", "Authentication and From-Header mismatch");
|
||||
# drop;
|
||||
#}
|
||||
|
||||
@@ -1158,7 +1108,7 @@
|
||||
}
|
||||
# Everything is fine. Store the binding.
|
||||
if (!save_contacts("location")) {
|
||||
- sl_reply("400", "Invalid REGISTER Request");
|
||||
+ t_reply("400", "Invalid REGISTER Request");
|
||||
drop;
|
||||
}
|
||||
# do not delete the following 3 lines, they are used by debconf
|
||||
@@ -1190,7 +1140,7 @@
|
||||
#DEBCONF-REPLICATION2-START
|
||||
#
|
||||
#DEBCONF-REPLICATION2-END
|
||||
-
|
||||
+ t_release();
|
||||
drop;
|
||||
}
|
||||
|
||||
@@ -1221,16 +1171,16 @@
|
||||
|
||||
if (!proxy_authenticate("$fd.digest_realm", "credentials")) {
|
||||
if ($? == -2) {
|
||||
- sl_reply("500", "Internal Server Error");
|
||||
+ t_reply("500", "Internal Server Error");
|
||||
}
|
||||
else if ($? == -3) {
|
||||
- sl_reply("400", "Bad Request");
|
||||
+ t_reply("400", "Bad Request");
|
||||
}
|
||||
else {
|
||||
if (defined $digest_challenge && $digest_challenge != "") {
|
||||
append_to_reply("%$digest_challenge");
|
||||
}
|
||||
- sl_reply("407", "Proxy Authentication Required");
|
||||
+ t_reply("407", "Proxy Authentication Required");
|
||||
}
|
||||
drop;
|
||||
}
|
||||
@@ -1238,11 +1188,11 @@
|
||||
# Check if the UID derived from authentication matches that from
|
||||
# the From header.
|
||||
if (!lookup_user("$fr.uid", "@from.uri")) {
|
||||
- sl_reply("403", "Fake Identity");
|
||||
+ t_reply("403", "Fake Identity");
|
||||
drop;
|
||||
}
|
||||
if ($fu.uid != $fr.uid) {
|
||||
- sl_reply("403", "Fake Identity");
|
||||
+ t_reply("403", "Fake Identity");
|
||||
drop;
|
||||
}
|
||||
setflag(FLAG_AUTH_OK);
|
||||
@@ -1274,10 +1224,10 @@
|
||||
# UA to the real target.
|
||||
if ($fd.did != "" && uri =~ "sip:[0-9][0-9]@") {
|
||||
if (sd_lookup("speed_dial")) {
|
||||
- sl_reply("302", "Speed Dial Redirect");
|
||||
+ t_reply("302", "Speed Dial Redirect");
|
||||
}
|
||||
else {
|
||||
- sl_reply("404", "Speed Dial Not Found");
|
||||
+ t_reply("404", "Speed Dial Not Found");
|
||||
}
|
||||
drop;
|
||||
}
|
||||
@@ -1392,7 +1342,7 @@
|
||||
# Check permissions of the caller for initial INVITEs.
|
||||
if (isflagset(FLAG_INIT_DLG)) {
|
||||
if ($f.gw_acl != "1") {
|
||||
- sl_reply("403", "PSTN Not Permitted");
|
||||
+ t_reply("403", "PSTN Not Permitted");
|
||||
drop;
|
||||
}
|
||||
}
|
||||
@@ -1431,7 +1381,7 @@
|
||||
xlog("L_DEBUG", "catching cancel dialogid=%$dialog_id\n");
|
||||
if (!t_relay_cancel()) {
|
||||
# An INVITE was found but some error occurred.
|
||||
- sl_reply("500", "Internal Server Error");
|
||||
+ t_reply("500", "Internal Server Error");
|
||||
drop;
|
||||
}
|
||||
# Bad luck, no corresponding INVITE was found, we have to
|
||||
@@ -1486,7 +1436,7 @@
|
||||
# Session interval is lower than the
|
||||
# configured Min-SE
|
||||
append_to_reply("Min-SE: %@cfg_get.session_timer.min_se\r\n");
|
||||
- sl_reply("422", "Session Interval Too Small");
|
||||
+ t_reply("422", "Session Interval Too Small");
|
||||
drop;
|
||||
}
|
||||
|
||||
@@ -1592,6 +1542,7 @@
|
||||
}
|
||||
}
|
||||
} # if (isflagset...
|
||||
+ route(RTPPROXY_PROCESS_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1603,14 +1554,7 @@
|
||||
# allow proper routing of in-dialog messages.
|
||||
route(UAS_NAT_DETECTION);
|
||||
|
||||
- # If RTP proxy was activated and this is a 18x or 2xx reply with a
|
||||
- # body, inform RTP proxy.
|
||||
- if (isflagset(FLAG_RTP_PROXY)
|
||||
- && status=~"(18[03])|(2[0-9][0-9])"
|
||||
- && @msg.body != "")
|
||||
- {
|
||||
- force_rtp_proxy('r');
|
||||
- }
|
||||
+ route(RTPPROXY_PROCESS_REPLY);
|
||||
|
||||
# Let's check for session timer support.
|
||||
if (isflagset(FLAG_SESSIONTIMER) && status =~ "2[0-9][0-9]") {
|
||||
@ -0,0 +1,374 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 258de5e..a61bc57 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -5,7 +5,7 @@ rtpproxy_SOURCES=main.c rtp.h rtp_server.c rtp_server.h \
|
||||
rtpp_command.c rtpp_command.h rtpp_log.c rtpp_network.h rtpp_network.c \
|
||||
rtpp_syslog_async.c rtpp_syslog_async.h rtpp_notify.c rtpp_notify.h \
|
||||
rtpp_command_async.h rtpp_command_async.c
|
||||
-rtpproxy_LDADD=-lm -lpthread
|
||||
+rtpproxy_LDADD=-lm -lpthread @LIBS_XMLRPC@
|
||||
dist_man_MANS=rtpproxy.8
|
||||
makeann_SOURCES=makeann.c rtp.h g711.h
|
||||
makeann_LDADD=@LIBS_G729@ @LIBS_GSM@
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 47c14fd..cdb5e43 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -217,7 +217,7 @@ rtpproxy_SOURCES = main.c rtp.h rtp_server.c rtp_server.h \
|
||||
rtpp_syslog_async.c rtpp_syslog_async.h rtpp_notify.c rtpp_notify.h \
|
||||
rtpp_command_async.h rtpp_command_async.c
|
||||
|
||||
-rtpproxy_LDADD = -lm -lpthread
|
||||
+rtpproxy_LDADD = -lm -lpthread @LIBS_XMLRPC@
|
||||
dist_man_MANS = rtpproxy.8
|
||||
makeann_SOURCES = makeann.c rtp.h g711.h
|
||||
makeann_LDADD = @LIBS_G729@ @LIBS_GSM@
|
||||
diff --git a/aclocal.m4 b/aclocal.m4
|
||||
index b36bc80..0970c41 100644
|
||||
--- a/aclocal.m4
|
||||
+++ b/aclocal.m4
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
|
||||
-[m4_warning([this file was generated for autoconf 2.68.
|
||||
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
|
||||
+[m4_warning([this file was generated for autoconf 2.67.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index cd0c23a..87491e3 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -14,6 +14,9 @@
|
||||
/* Define if you have libgsm library installed */
|
||||
#undef ENABLE_GSM
|
||||
|
||||
+/* Define if you have xmlrpc library installed */
|
||||
+#undef ENABLE_XMLRPC
|
||||
+
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 54c1a60..1c88b99 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -53,6 +53,17 @@ then
|
||||
AC_DEFINE([ENABLE_G729], 1, [Define if you have libg729 library installed])
|
||||
)
|
||||
fi
|
||||
+
|
||||
+# XML-RPC-Libs:
|
||||
+AC_CHECK_HEADERS(xmlrpc_client.h xmlrpc.h, found_xmlrpc=yes)
|
||||
+if test "$found_xmlrpc" = yes
|
||||
+then
|
||||
+ AC_CHECK_LIB(curl, curl_version,
|
||||
+ LIBS_XMLRPC="-lcurl -lxmlrpc_client -lxmlrpc -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok"
|
||||
+ AC_DEFINE([ENABLE_XMLRPC], 1, [Define if you have XML-RPC-Client library installed])
|
||||
+ )
|
||||
+fi
|
||||
+
|
||||
##if test -z "$G729_SUPPORT"
|
||||
##then
|
||||
## echo "*************************************************************************** $ECHO_C" 1>&6
|
||||
@@ -94,4 +105,5 @@ AC_CONFIG_FILES([Makefile])
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
AC_SUBST(LIBS_GSM)
|
||||
AC_SUBST(LIBS_G729)
|
||||
+AC_SUBST(LIBS_XMLRPC)
|
||||
AC_OUTPUT
|
||||
diff --git a/rtpp_command.c b/rtpp_command.c
|
||||
index c5734ae..d6072de 100644
|
||||
--- a/rtpp_command.c
|
||||
+++ b/rtpp_command.c
|
||||
@@ -69,6 +69,9 @@ struct proto_cap proto_caps[] = {
|
||||
{ "20081102", "Support for setting codecs in the update/lookup command" },
|
||||
{ "20081224", "Support for session timeout notifications" },
|
||||
{ "20090810", "Support for automatic bridging" },
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+ { "20100819", "Support for timeout notifications using XML-RPC towards Kamailio/sip-router.org" },
|
||||
+#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -269,6 +272,7 @@ handle_command(struct cfg *cf, int controlfd, double dtime)
|
||||
char *socket_name_u, *notify_tag;
|
||||
struct sockaddr *local_addr;
|
||||
char c;
|
||||
+ struct rtpp_timeout_handler * my_timeout_h;
|
||||
|
||||
requested_nsamples = -1;
|
||||
ia[0] = ia[1] = NULL;
|
||||
@@ -468,7 +472,7 @@ handle_command(struct cfg *cf, int controlfd, double dtime)
|
||||
}
|
||||
call_id = argv[1];
|
||||
if (op == UPDATE || op == LOOKUP || op == PLAY) {
|
||||
- max_argc = (op == UPDATE ? 8 : 6);
|
||||
+ max_argc = (op == PLAY ? 6 : 8);
|
||||
if (argc < 5 || argc > max_argc) {
|
||||
rtpp_log_write(RTPP_LOG_ERR, cf->stable.glog, "command syntax error");
|
||||
reply_error(&cf->stable, controlfd, &raddr, rlen, cookie, 4);
|
||||
@@ -478,7 +482,7 @@ handle_command(struct cfg *cf, int controlfd, double dtime)
|
||||
to_tag = argv[5];
|
||||
if (op == PLAY && argv[0][1] != '\0')
|
||||
playcount = atoi(argv[0] + 1);
|
||||
- if (op == UPDATE && argc > 6) {
|
||||
+ if (op != PLAY && argc > 6) {
|
||||
socket_name_u = argv[6];
|
||||
if (strncmp("unix:", socket_name_u, 5) == 0)
|
||||
socket_name_u += 5;
|
||||
@@ -965,25 +969,39 @@ handle_command(struct cfg *cf, int controlfd, double dtime)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&cf->glock);
|
||||
- if (op == UPDATE) {
|
||||
- if (cf->timeout_handler->socket_name == NULL && socket_name_u != NULL)
|
||||
- rtpp_log_write(RTPP_LOG_ERR, spa->log, "must permit notification socket with -n");
|
||||
+
|
||||
+ if ((op == UPDATE) || (op == LOOKUP)){
|
||||
if (spa->timeout_data.notify_tag != NULL) {
|
||||
free(spa->timeout_data.notify_tag);
|
||||
spa->timeout_data.notify_tag = NULL;
|
||||
}
|
||||
- if (cf->timeout_handler->socket_name != NULL && socket_name_u != NULL) {
|
||||
- if (strcmp(cf->timeout_handler->socket_name, socket_name_u) != 0) {
|
||||
- rtpp_log_write(RTPP_LOG_ERR, spa->log, "invalid socket name %s", socket_name_u);
|
||||
- socket_name_u = NULL;
|
||||
- } else {
|
||||
+ spa->timeout_data.handler = NULL;
|
||||
+ if (socket_name_u != NULL) {
|
||||
+ if (cf->timeout_handler != NULL && cf->timeout_handler->socket_name != NULL
|
||||
+ && strlen(cf->timeout_handler->socket_name) == strlen(socket_name_u)
|
||||
+ && strcmp(cf->timeout_handler->socket_name, socket_name_u) != 0) {
|
||||
rtpp_log_write(RTPP_LOG_INFO, spa->log, "setting timeout handler");
|
||||
spa->timeout_data.handler = cf->timeout_handler;
|
||||
spa->timeout_data.notify_tag = strdup(notify_tag);
|
||||
+ } else {
|
||||
+ rtpp_log_write(RTPP_LOG_INFO, spa->log, "setting custom timeout handler (%s)", socket_name_u);
|
||||
+ my_timeout_h = malloc(sizeof(struct rtpp_timeout_handler));
|
||||
+ if (my_timeout_h == NULL) {
|
||||
+ rtpp_log_write(RTPP_LOG_ERR, spa->log, "Unable to allocate memory");
|
||||
+ } else {
|
||||
+ memset(my_timeout_h, 0, sizeof(struct rtpp_timeout_handler));
|
||||
+ my_timeout_h->socket_name = (char *)malloc(strlen(socket_name_u) + 1);
|
||||
+ if(my_timeout_h->socket_name != NULL) {
|
||||
+ strcpy(my_timeout_h->socket_name, socket_name_u);
|
||||
+ spa->timeout_data.handler = my_timeout_h;
|
||||
+ if (notify_tag != NULL) spa->timeout_data.notify_tag = strdup(notify_tag);
|
||||
+ else spa->timeout_data.notify_tag = NULL;
|
||||
+ } else {
|
||||
+ rtpp_log_write(RTPP_LOG_ERR, spa->log, "Unable to allocate memory");
|
||||
+ free(my_timeout_h);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- } else if (socket_name_u == NULL && spa->timeout_data.handler != NULL) {
|
||||
- spa->timeout_data.handler = NULL;
|
||||
- rtpp_log_write(RTPP_LOG_INFO, spa->log, "disabling timeout handler");
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/rtpp_notify.c b/rtpp_notify.c
|
||||
index e92c9ec..e6b30e4 100644
|
||||
--- a/rtpp_notify.c
|
||||
+++ b/rtpp_notify.c
|
||||
@@ -42,10 +42,24 @@
|
||||
#include "rtpp_session.h"
|
||||
#include "rtpp_util.h"
|
||||
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+#include <xmlrpc.h>
|
||||
+#include <xmlrpc_client.h>
|
||||
+#define XMLRPC_CLIENT_NAME "XML-RPC RTPProxy Client"
|
||||
+#define XMLRPC_CLIENT_VERSION "0.2"
|
||||
+#endif
|
||||
+
|
||||
struct rtpp_notify_wi
|
||||
{
|
||||
char *notify_buf;
|
||||
int len;
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+ char *call_id;
|
||||
+ int call_id_len;
|
||||
+ char *param;
|
||||
+ int param_len;
|
||||
+ int custom_handler;
|
||||
+#endif
|
||||
struct rtpp_timeout_handler *th;
|
||||
rtpp_log_t glog;
|
||||
struct rtpp_notify_wi *next;
|
||||
@@ -258,6 +272,13 @@ rtpp_notify_schedule(struct cfg *cf, struct rtpp_session *sp)
|
||||
if (wi == NULL)
|
||||
return -1;
|
||||
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+ if (th != cf->timeout_handler)
|
||||
+ wi->custom_handler = 1;
|
||||
+ else
|
||||
+ wi->custom_handler = 0;
|
||||
+#endif
|
||||
+
|
||||
wi->th = th;
|
||||
if (sp->timeout_data.notify_tag == NULL) {
|
||||
/* two 5-digit numbers, space, \0 and \n */
|
||||
@@ -289,6 +310,59 @@ rtpp_notify_schedule(struct cfg *cf, struct rtpp_session *sp)
|
||||
len = snprintf(wi->notify_buf, len, "%s\n",
|
||||
sp->timeout_data.notify_tag);
|
||||
}
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+
|
||||
+ // rtpp_log_write(RTPP_LOG_ERR, wi->glog, "Timeout socket is: %s (%p)\n", wi->th->socket_name, wi->th->socket_name);
|
||||
+
|
||||
+ if (strncmp("xmlrpc:", wi->th->socket_name, 7) == 0) {
|
||||
+ // Copy the Socket-Name
|
||||
+ len = strlen(wi->th->socket_name)+1;
|
||||
+ if (wi->param == NULL) {
|
||||
+ wi->param = malloc(len);
|
||||
+ if (wi->param == NULL) {
|
||||
+ rtpp_notify_queue_return_free_item(wi);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ notify_buf = realloc(wi->param, len);
|
||||
+ if (notify_buf == NULL) {
|
||||
+ rtpp_notify_queue_return_free_item(wi);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ wi->param = notify_buf;
|
||||
+ }
|
||||
+ memset(wi->param, '\0', len);
|
||||
+ len = snprintf(wi->param, len, "%s",
|
||||
+ wi->th->socket_name);
|
||||
+ wi->param_len = len;
|
||||
+
|
||||
+ // rtpp_log_write(RTPP_LOG_ERR, wi->glog, "wi->param %s (%p)\n", wi->param, wi->param);
|
||||
+
|
||||
+ // Copy the Call-ID:
|
||||
+ len = strlen(sp->call_id)+1;
|
||||
+ if (wi->call_id == NULL) {
|
||||
+ wi->call_id = malloc(len);
|
||||
+ if (wi->call_id == NULL) {
|
||||
+ rtpp_notify_queue_return_free_item(wi);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ notify_buf = realloc(wi->call_id, len);
|
||||
+ if (notify_buf == NULL) {
|
||||
+ rtpp_notify_queue_return_free_item(wi);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ wi->call_id = notify_buf;
|
||||
+ }
|
||||
+ memset(wi->call_id, '\0', len);
|
||||
+ len = snprintf(wi->call_id, len, "%s",
|
||||
+ sp->call_id);
|
||||
+ wi->call_id_len = len;
|
||||
+
|
||||
+ // rtpp_log_write(RTPP_LOG_ERR, wi->glog, "wi->call_id %s (%p)\n", wi->call_id, wi->call_id);
|
||||
+
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
wi->glog = cf->stable.glog;
|
||||
|
||||
@@ -345,29 +419,72 @@ reconnect_timeout_handler(rtpp_log_t log, struct rtpp_timeout_handler *th)
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+static int
|
||||
+do_xmlrpc_timeout_notification(rtpp_log_t log, struct rtpp_notify_wi *wi) {
|
||||
+ xmlrpc_env env;
|
||||
+ xmlrpc_value *result;
|
||||
+
|
||||
+ /* Start up our XML-RPC client library. */
|
||||
+ xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, XMLRPC_CLIENT_NAME, XMLRPC_CLIENT_VERSION);
|
||||
+ xmlrpc_env_init(&env);
|
||||
+
|
||||
+ /* Get the dialog-Info: */
|
||||
+ result = xmlrpc_client_call(&env, wi->param+7,
|
||||
+ "dlg_terminate_dlg", "(s)",
|
||||
+ wi->call_id);
|
||||
+ if (env.fault_occurred) {
|
||||
+ rtpp_log_write(RTPP_LOG_ERR, wi->glog, "%s: XML-RPC Fault: %s (%d)\n", wi->call_id, env.fault_string, env.fault_code);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Dispose of our result value. */
|
||||
+ xmlrpc_DECREF(result);
|
||||
+
|
||||
+ /* Shutdown our XML-RPC client library. */
|
||||
+ xmlrpc_env_clean(&env);
|
||||
+ xmlrpc_client_cleanup();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static void
|
||||
do_timeout_notification(struct rtpp_notify_wi *wi, int retries)
|
||||
{
|
||||
int result;
|
||||
|
||||
- if (wi->th->connected == 0) {
|
||||
- reconnect_timeout_handler(wi->glog, wi->th);
|
||||
-
|
||||
- /* If connect fails, no notification will be sent */
|
||||
- if (wi->th->connected == 0) {
|
||||
- rtpp_log_write(RTPP_LOG_ERR, wi->glog, "unable to send timeout notification");
|
||||
- return;
|
||||
- }
|
||||
+ if (strncmp("xmlrpc:", wi->th->socket_name, 7) == 0) {
|
||||
+ result = do_xmlrpc_timeout_notification(wi->glog, wi);
|
||||
+ } else {
|
||||
+ if (wi->th->connected == 0) {
|
||||
+ reconnect_timeout_handler(wi->glog, wi->th);
|
||||
+
|
||||
+ /* If connect fails, no notification will be sent */
|
||||
+ if (wi->th->connected == 0) {
|
||||
+ rtpp_log_write(RTPP_LOG_ERR, wi->glog, "unable to send timeout notification");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ do {
|
||||
+ result = send(wi->th->fd, wi->notify_buf, wi->len - 1, 0);
|
||||
+ } while (result == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
- do {
|
||||
- result = send(wi->th->fd, wi->notify_buf, wi->len - 1, 0);
|
||||
- } while (result == -1 && errno == EINTR);
|
||||
-
|
||||
if (result < 0) {
|
||||
wi->th->connected = 0;
|
||||
rtpp_log_ewrite(RTPP_LOG_ERR, wi->glog, "failed to send timeout notification");
|
||||
if (retries > 0)
|
||||
do_timeout_notification(wi, retries - 1);
|
||||
}
|
||||
+#ifdef ENABLE_XMLRPC
|
||||
+ // In case we use a custom timeout handler, we have to free it.
|
||||
+ if (wi->th && (wi->custom_handler == 1)) {
|
||||
+ free(wi->th->socket_name);
|
||||
+ free(wi->th);
|
||||
+ wi->th = 0;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
diff --git a/rtpp_session.c b/rtpp_session.c
|
||||
index 03e3d8a..51b3319 100644
|
||||
--- a/rtpp_session.c
|
||||
+++ b/rtpp_session.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "rtpp_record.h"
|
||||
#include "rtpp_session.h"
|
||||
#include "rtpp_util.h"
|
||||
+#include "rtpp_notify.h"
|
||||
|
||||
void
|
||||
init_hash_table(struct cfg_stable *cf)
|
||||
@ -0,0 +1,150 @@
|
||||
Index: modules/uac/from.c
|
||||
===================================================================
|
||||
diff -u -r1.3 modules/uac/from.c
|
||||
--- modules/uac/from.c 26 Feb 2005 18:04:20 -0000 1.3
|
||||
+++ modules/uac/from.c 24 Mar 2005 16:29:27 -0000
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "../tm/tm_load.h"
|
||||
|
||||
#include "from.h"
|
||||
-#define FL_FROM_ALTERED (1<<31)
|
||||
|
||||
extern str from_param;
|
||||
extern int from_restore_mode;
|
||||
Index: parser/msg_parser.h
|
||||
===================================================================
|
||||
RCS file: /cvsroot/ser/sip_router/parser/msg_parser.h,v
|
||||
retrieving revision 1.56
|
||||
diff -u -r1.56 msg_parser.h
|
||||
--- parser/msg_parser.h 28 Feb 2005 15:28:24 -0000 1.56
|
||||
+++ parser/msg_parser.h 24 Mar 2005 22:13:04 -0000
|
||||
@@ -73,8 +73,8 @@
|
||||
#define FL_FORCE_ACTIVE 2 /* force active SDP */
|
||||
#define FL_SDP_IP_AFS 4 /* SDP IP rewritten */
|
||||
#define FL_SDP_PORT_AFS 8 /* SDP port rewritten */
|
||||
-#define FL_SHM_CLONE 16 /* msg cloned in SHM as a single chunk */
|
||||
-
|
||||
+#define FL_SHM_CLONE 16 /* msg cloned in SHM as a single chunk */
|
||||
+#define FL_FROM_ALTERED 32 /* from is altered */
|
||||
|
||||
#define IFISMETHOD(methodname,firstchar) \
|
||||
if ( (*tmp==(firstchar) || *tmp==((firstchar) | 32)) && \
|
||||
Index: modules/tm/t_msgbuilder.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/ser/sip_router/modules/tm/t_msgbuilder.c,v
|
||||
retrieving revision 1.41
|
||||
diff -u -r1.41 t_msgbuilder.c
|
||||
--- modules/tm/t_msgbuilder.c 23 Feb 2005 17:16:06 -0000 1.41
|
||||
+++ modules/tm/t_msgbuilder.c 24 Mar 2005 22:13:04 -0000
|
||||
@@ -75,6 +75,72 @@
|
||||
(_p)+=(_str).len; \
|
||||
} while(0);
|
||||
|
||||
+#define LC(_cp) ((*(_cp))|0x20)
|
||||
+static int extract_from( char *buf, int len, str *from)
|
||||
+{
|
||||
+ char *end, *p;
|
||||
+ char *b;
|
||||
+ int state;
|
||||
+
|
||||
+ p = buf;
|
||||
+ end = buf+len;
|
||||
+ state = 1;
|
||||
+ b = 0;
|
||||
+
|
||||
+ while(p<end) {
|
||||
+ switch (*p) {
|
||||
+ case '\n':
|
||||
+ case '\r':
|
||||
+ switch (state) {
|
||||
+ case 4: state=5;break;
|
||||
+ case 5: case 6: state=6;break;
|
||||
+ default : state=2;break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case ' ':
|
||||
+ case '\t':
|
||||
+ switch (state) {
|
||||
+ case 4: case 6: state=5; break;
|
||||
+ case 2: state=1; break;/*folded line*/
|
||||
+ }
|
||||
+ break;
|
||||
+ case ':':
|
||||
+ switch (state) {
|
||||
+ case 4: state=5;break;
|
||||
+ case 6: goto found;
|
||||
+ case 2: state=1;break;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'f':
|
||||
+ case 'F':
|
||||
+ if (state==5) break;
|
||||
+ if (state==6) goto found;
|
||||
+ if (state!=2) {state = 1;break;}
|
||||
+ /* hdr starting with 'f' */
|
||||
+ b = p;
|
||||
+ if (p+3<end && LC(p+1)=='r' && LC(p+2)=='o' && LC(p+3)=='m')
|
||||
+ p+=3;
|
||||
+ state = 4; /* "f" or "from" found */
|
||||
+ break;
|
||||
+ default:
|
||||
+ switch (state) {
|
||||
+ case 2:case 4: state=1; break;
|
||||
+ case 6: ;goto found;
|
||||
+ }
|
||||
+ }
|
||||
+ p++;
|
||||
+ }
|
||||
+
|
||||
+ LOG(L_CRIT,"BUG:tm:extract_from: no from found in outgoing buffer\n");
|
||||
+ return -1;
|
||||
+found:
|
||||
+ from->s = b;
|
||||
+ from->len = p-b;
|
||||
+ DBG("-----from= <%.*s>\n",from->len,from->s);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Build a local request based on a previous request; main
|
||||
customers of this function are local ACK and local CANCEL
|
||||
*/
|
||||
@@ -88,6 +154,7 @@
|
||||
int branch_len;
|
||||
str branch_str;
|
||||
struct hostport hp;
|
||||
+ str from;
|
||||
|
||||
#ifdef _OBSO
|
||||
if ( Trans->uac[branch].last_received<100)
|
||||
@@ -98,6 +165,12 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+ if (!Trans->uas.request || !(Trans->uas.request->msg_flags&FL_FROM_ALTERED)
|
||||
+ || extract_from( Trans->uac[branch].request.buffer,
|
||||
+ Trans->uac[branch].request.buffer_len, &from)!=0) {
|
||||
+ from = Trans->from;
|
||||
+ }
|
||||
+
|
||||
/* method, separators, version: "CANCEL sip:p2@iptel.org SIP/2.0" */
|
||||
*len=SIP_VERSION_LEN + method_len + 2 /* spaces */ + CRLF_LEN;
|
||||
*len+=Trans->uac[branch].uri.len;
|
||||
@@ -119,7 +192,7 @@
|
||||
}
|
||||
*len+= via_len;
|
||||
/*headers*/
|
||||
- *len+=Trans->from.len+Trans->callid.len+to->len+
|
||||
+ *len+=from.len+Trans->callid.len+to->len+
|
||||
+Trans->cseq_n.len+1+method_len+CRLF_LEN;
|
||||
|
||||
|
||||
@@ -154,7 +227,7 @@
|
||||
append_mem_block(p,via,via_len);
|
||||
|
||||
/*other headers*/
|
||||
- append_str( p, Trans->from );
|
||||
+ append_str( p, from );
|
||||
append_str( p, Trans->callid );
|
||||
append_str( p, *to );
|
||||
|
||||
@ -0,0 +1,172 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# iptel.org real world configuration
|
||||
#
|
||||
|
||||
# ----------- global configuration parameters ------------------------
|
||||
|
||||
# we're debugging now
|
||||
|
||||
debug=9 # debug level (cmd line: -dddddddddd)
|
||||
fork=no
|
||||
log_stderror=yes # (cmd line: -E)
|
||||
|
||||
#fork=yes
|
||||
#children=16
|
||||
#log_stderror=no # (cmd line: -E)
|
||||
|
||||
check_via=yes # (cmd. line: -v)
|
||||
dns=on # (cmd. line: -r)
|
||||
rev_dns=yes # (cmd. line: -R)
|
||||
|
||||
# experimental usage at port 5060
|
||||
#port=9060
|
||||
#port=8060
|
||||
port=5060
|
||||
# advertise IP address in Via (as opposed to advertising DNS name
|
||||
# which is annoying for downstream servers and some phones can
|
||||
# not handle DNS at all)
|
||||
#listen=195.37.77.101
|
||||
#listen=193.175.135.170
|
||||
# ------------------ module loading ----------------------------------
|
||||
|
||||
loadmodule "../sip_router/modules/sl/sl.so"
|
||||
loadmodule "../sip_router/modules/print/print.so"
|
||||
loadmodule "../sip_router/modules/tm/tm_mod.so"
|
||||
#loadmodule "../sip_router/modules/acc/acc.so"
|
||||
loadmodule "../sip_router/modules/rr/rr.so"
|
||||
loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
|
||||
#loadmodule "../sip_router/modules/mysql/mysql.so"
|
||||
loadmodule "../sip_router/modules/usrloc/usrloc.so"
|
||||
#loadmodule "../sip_router/modules/auth/auth.so"
|
||||
#loadmodule "../sip_router/modules/cpl/cpl.so"
|
||||
loadmodule "../sip_router/modules/radius_acc/radius_acc.so"
|
||||
loadmodule "../sip_router/modules/registrar/registrar.so"
|
||||
|
||||
|
||||
# ----------------- setting module-specific parameters ---------------
|
||||
|
||||
# -- usrloc params --
|
||||
|
||||
# use in-RAM usrloc
|
||||
#modparam("usrloc", "use_db", 0)
|
||||
|
||||
# -- acc params --
|
||||
# report ACKs too for sake of completeness -- as we account PSTN
|
||||
# destinations which are RR, ACKs should show up
|
||||
#modparam("acc", "report_ack", 1)
|
||||
# don't bother me with early media reports (I don't like 183
|
||||
# too much anyway...ever thought of timer C hitting after
|
||||
# listening to music-on-hold for five minutes?)
|
||||
#modparam("acc", "early_media", 0)
|
||||
#modparam("acc", "log_level", 1)
|
||||
# that is the flag for which we will account -- don't forget to
|
||||
# set the same one :-)
|
||||
#modparam("acc", "acc_flag", 1 )
|
||||
# we are interested only in succesful transactions
|
||||
#modparam("acc", "failed_transactions", 0 )
|
||||
|
||||
|
||||
# -- acc params --
|
||||
# report ACKs too for sake of completeness -- as we account PSTN
|
||||
# destinations which are RR, ACKs should show up
|
||||
modparam("radius_acc", "report_ack", 1)
|
||||
# don't bother me with early media reports (I don't like 183
|
||||
# too much anyway...ever thought of timer C hitting after
|
||||
# listening to music-on-hold for five minutes?)
|
||||
modparam("radius_acc", "early_media", 0)
|
||||
modparam("radius_acc", "log_level", 1)
|
||||
# that is the flag for which we will account -- don't forget to
|
||||
# set the same one :-)
|
||||
modparam("radius_acc", "acc_flag", 1 )
|
||||
# we are interested only in succesful transactions
|
||||
modparam("radius_acc", "failed_transactions", 0 )
|
||||
|
||||
# -- tm params --
|
||||
modparam("tm", "fr_timer", 30 )
|
||||
modparam("tm", "fr_inv_timer", 60 )
|
||||
|
||||
# ------------------------- request routing logic -------------------
|
||||
|
||||
# main routing logic
|
||||
|
||||
route{
|
||||
|
||||
# filter local stateless ACK generated by authentication of mf replies
|
||||
sl_filter_ACK();
|
||||
|
||||
# filter too old messages
|
||||
log("LOG: Checking maxfwd\n");
|
||||
if (!mf_process_maxfwd_header("10")) {
|
||||
log("LOG: Too many hops\n");
|
||||
sl_send_reply("483","Too Many Hops");
|
||||
break;
|
||||
};
|
||||
|
||||
# len_gt *after* max_fwd, otherwise an "INVITE sip:sos@0.0.0.0"
|
||||
# will cause "message too big" for a short message
|
||||
|
||||
if (len_gt( max_len )) {
|
||||
sl_send_reply("513", "Riesengross -- Message too large");
|
||||
break;
|
||||
};
|
||||
|
||||
# Do strict routing if route headers present
|
||||
if (method=="INVITE") {
|
||||
addRecordRoute();
|
||||
} else {
|
||||
rewriteFromRoute();
|
||||
};
|
||||
|
||||
|
||||
# that is outbound request...
|
||||
|
||||
if (!(uri=~"fox\.iptel\.org([;:].*)*"
|
||||
| uri=~"[@:\.]195\.37\.77\.101([;:].*)*" )) {
|
||||
route(2);
|
||||
# break from route (2) return -- stop then !
|
||||
break;
|
||||
};
|
||||
# here we continue with requests for our domain...
|
||||
|
||||
if (method=="REGISTER") {
|
||||
# update Contact database
|
||||
log("LOG: REGISTER is authorized, saving location\n");
|
||||
save("location");
|
||||
break;
|
||||
};
|
||||
|
||||
# native SIP destinations are handled using our USRLOC DB
|
||||
if (!lookup("location")) {
|
||||
if (method=="ACK") {
|
||||
log("Ooops -- an ACK made it here -- probably UAC screwed up to-tags\n");
|
||||
break;
|
||||
};
|
||||
log("LOG: Unable to lookup contact, sending 404\n");
|
||||
sl_send_reply("404", "Not Found");
|
||||
break;
|
||||
};
|
||||
|
||||
# label for accounting
|
||||
setflag(1);
|
||||
# we now know we may, we know where, let it go out now!
|
||||
if (!t_relay()) {
|
||||
sl_reply_error();
|
||||
break;
|
||||
};
|
||||
}
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
# routing logic for outbound requests targeted out of our domain
|
||||
# -- use outbound proxy iptel.org (note that except to FOKUS/PBX,
|
||||
# or itpel.org users, requests will be challenged)
|
||||
route[2] {
|
||||
log("LOG: that's a request to outside");
|
||||
# label for accounting
|
||||
setflag(1);
|
||||
if (!t_relay_to("fox.iptel.org", "5060")) {
|
||||
sl_reply_error();
|
||||
break;
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
/*
|
||||
*
|
||||
* simple atomic ops testing program
|
||||
* (no paralel stuff, just see if the opcodes are "legal")
|
||||
*
|
||||
* Compile with: gcc -Wall -O3 -D__CPU_i386 on x86 machines
|
||||
* gcc -Wall -O3 -D__CPU_x86_64 on amd64 machines
|
||||
* gcc -mips2 -Wall -O2 -D__CPU_mips2 on mips machines
|
||||
* gcc -m64 -Wall -O2 -D__CPU_mips64 on mips64 machines
|
||||
* gcc -O3 -Wall -D__CPU_ppc on powerpc machines
|
||||
* gcc -m64 -O3 -Wall -D__CPU_ppc64 on powerpc machines
|
||||
* gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE on
|
||||
* ultrasparc machines
|
||||
* -- andrei
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define CC_GCC_LIKE_ASM
|
||||
|
||||
#include "../atomic_ops.h"
|
||||
|
||||
#ifdef ATOMIC_OPS_USE_LOCK
|
||||
/* hack to make lock work */
|
||||
#include "../lock_ops.h"
|
||||
|
||||
gen_lock_t* _atomic_lock;
|
||||
|
||||
gen_lock_t dummy_lock;
|
||||
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int r;
|
||||
atomic_t v;
|
||||
#ifdef ATOMIC_OPS_USE_LOCK
|
||||
/* init the lock (emulate atomic_ops.c) */
|
||||
_atomic_lock=&dummy_lock;
|
||||
if (lock_init(_atomic_lock)==0){
|
||||
fprintf(stderr, "ERROR: failed to initialize the lock\n");
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOSMP
|
||||
printf("no-smp mode\n");
|
||||
#else
|
||||
printf("smp mode\n");
|
||||
#endif
|
||||
|
||||
printf("starting memory barrier opcode tests...\n");
|
||||
membar();
|
||||
printf(" membar() .............................. ok\n");
|
||||
membar_write();
|
||||
printf(" membar_write() ........................ ok\n");
|
||||
membar_read();
|
||||
printf(" membar_read() ......................... ok\n");
|
||||
|
||||
printf("\nstarting atomic ops basic tests...\n");
|
||||
|
||||
mb_atomic_set(&v, 1);
|
||||
printf(" atomic_set, v should be 1 ............. %2d\n", mb_atomic_get(&v));
|
||||
mb_atomic_inc(&v);
|
||||
printf(" atomic_inc, v should be 2 ............. %2d\n", mb_atomic_get(&v));
|
||||
r=mb_atomic_inc_and_test(&v);
|
||||
printf(" atomic_inc_and_test, v should be 3 ... %2d\n", mb_atomic_get(&v));
|
||||
printf(" r should be 0 ... %2d\n", r);
|
||||
|
||||
mb_atomic_dec(&v);
|
||||
printf(" atomic_dec, v should be 2 ............. %2d\n", mb_atomic_get(&v));
|
||||
r=mb_atomic_dec_and_test(&v);
|
||||
printf(" atomic_dec_and_test, v should be 1 ... %2d\n", mb_atomic_get(&v));
|
||||
printf(" r should be 0 ... %2d\n", r);
|
||||
r=mb_atomic_dec_and_test(&v);
|
||||
printf(" atomic_dec_and_test, v should be 0 ... %2d\n", mb_atomic_get(&v));
|
||||
printf(" r should be 1 ... %2d\n", r);
|
||||
r=mb_atomic_dec_and_test(&v);
|
||||
printf(" atomic_dec_and_test, v should be -1 ... %2d\n", mb_atomic_get(&v));
|
||||
printf(" r should be 0 ... %2d\n", r);
|
||||
|
||||
mb_atomic_and(&v, 2);
|
||||
printf(" atomic_and, v should be 2 ............. %2d\n", mb_atomic_get(&v));
|
||||
|
||||
mb_atomic_or(&v, 5);
|
||||
r=mb_atomic_get_and_set(&v, 0);
|
||||
printf(" atomic_or, v should be 7 ............. %2d\n", r);
|
||||
printf(" atomic_get_and_set, v should be 0 ..... %2d\n", mb_atomic_get(&v));
|
||||
|
||||
|
||||
printf("\ndone.\n");
|
||||
#ifdef ATOMIC_OPS_USE_LOCK
|
||||
lock_destroy(_atomic_lock);
|
||||
#endif
|
||||
return 0;
|
||||
#ifdef ATOMIC_OPS_USE_LOCK
|
||||
error:
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,301 @@
|
||||
/*
|
||||
*
|
||||
* simple atomic ops testing program
|
||||
* (no paralel stuff, just see if the opcodes are "legal")
|
||||
*
|
||||
* Defines: TYPE - not defined => use atomic_t and the corresponding
|
||||
* atomic functions
|
||||
* - long => use volatile long* and the atomic_*_long functions
|
||||
* - int => use volatile int* and the atomic_*_int functions
|
||||
* MEMBAR - if defined use mb_atomic_* instead of atomic_*
|
||||
* NOSMP - use non smp versions
|
||||
* NOASM - don't use asm inline version
|
||||
* __CPU_xxx - use __CPU_xxx code
|
||||
* SPARC64_MODE - compile for a sparc 64 in 64 bit mode (gcc -m64
|
||||
* must be used on solaris in this case)
|
||||
* Example:
|
||||
* gcc -Wall -O3 -D__CPU_i386 -DNOSMP -DMEMBAR -DTYPE=long atomic_test2.c
|
||||
*
|
||||
* Compile with: gcc -Wall -O3 -D__CPU_i386 ... on x86 machines
|
||||
* gcc -Wall -O3 -D__CPU_x86_64 ... on amd64 machines
|
||||
* gcc -mips2 -Wall -O2 -D__CPU_mips2 ... on mips machines
|
||||
* gcc -m64 -Wall -O2 -D__CPU_mips64 ... on mips64 machines
|
||||
* gcc -O3 -Wall -D__CPU_ppc ... on powerpc machines
|
||||
* gcc -m64 -O3 -Wall -D__CPU_ppc64 ... on powerpc machines
|
||||
* gcc -m64 -O3 -Wall -D__CPU_sparc64 -DSPARC64_MODE ... on
|
||||
* ultrasparc machines
|
||||
* gcc -mcpu=v9 -O3 -Wall -D__CPU_sparc64 ... for 32 bit code
|
||||
* (sparc32plus) on
|
||||
* ultrasparc machines
|
||||
* gcc -O3 -Wall -D__CPU_sparc ... on sparc v8 machines
|
||||
* -- andrei
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef NOASM
|
||||
#define CC_GCC_LIKE_ASM
|
||||
#endif
|
||||
|
||||
#include "../atomic_ops.h"
|
||||
|
||||
#if defined ATOMIC_OPS_USE_LOCK || defined MEMBAR_USES_LOCK || \
|
||||
defined ATOMIC_OPS_USE_LOCK_SET
|
||||
/* hack to make lock work */
|
||||
#include "../lock_ops.h"
|
||||
#endif
|
||||
|
||||
#ifdef MEMBAR_USES_LOCK
|
||||
gen_lock_t* __membar_lock=0; /* init in atomic_ops.c */
|
||||
gen_lock_t dummy_membar_lock;
|
||||
#endif
|
||||
|
||||
#ifdef ATOMIC_OPS_USE_LOCK_SET
|
||||
gen_lock_set_t* _atomic_lock_set=0;
|
||||
gen_lock_set_t dummy_atomic_lock_set;
|
||||
gen_lock_t locks_array[_ATOMIC_LS_SIZE];
|
||||
#elif defined ATOMIC_OPS_USE_LOCK
|
||||
gen_lock_t* _atomic_lock=0;
|
||||
gen_lock_t dummy_atomic_lock;
|
||||
#endif /* ATOMIC_OPS_USE_LOCK / _SET */
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined MB || defined MEMBAR
|
||||
#undef MB
|
||||
#define MB mb_
|
||||
#define MEMBAR_STR "membar "
|
||||
#else
|
||||
#define MB /* empty */
|
||||
#define MEMBAR_STR ""
|
||||
#endif
|
||||
|
||||
#ifndef TYPE
|
||||
#define SUF
|
||||
#define ATOMIC_TYPE atomic_t
|
||||
#define VALUE_TYPE volatile int
|
||||
#define get_val(v) (v->val)
|
||||
#else
|
||||
#define _SUF(T) _##T
|
||||
#define _SUF1(T) _SUF(T)
|
||||
#define SUF _SUF1(TYPE)
|
||||
#define ATOMIC_TYPE volatile TYPE
|
||||
#define VALUE_TYPE ATOMIC_TYPE
|
||||
#define get_val(v) (*v)
|
||||
#endif
|
||||
|
||||
|
||||
#define _STR(S) #S
|
||||
#define STR(S) _STR(S)
|
||||
|
||||
static char* flags=
|
||||
#ifdef NOASM
|
||||
"no_inline_asm "
|
||||
#endif
|
||||
#ifdef NOSMP
|
||||
"nosmp "
|
||||
#else
|
||||
"smp "
|
||||
#endif
|
||||
MEMBAR_STR
|
||||
#ifndef HAVE_ASM_INLINE_MEMBAR
|
||||
"no_asm_membar(slow) "
|
||||
#endif
|
||||
#ifndef HAVE_ASM_INLINE_ATOMIC_OPS
|
||||
"no_asm_atomic_ops"
|
||||
#ifdef ATOMIC_OPS_USE_LOCK_SET
|
||||
":use_lock_set"
|
||||
#elif defined ATOMIC_OPS_USE_LOCK
|
||||
":use_lock"
|
||||
#endif
|
||||
" "
|
||||
#endif
|
||||
#ifdef TYPE
|
||||
STR(TYPE) " "
|
||||
#else
|
||||
"atomic_t "
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
|
||||
/* macros for atomic_* functions */
|
||||
|
||||
#define _AT_DECL(OP, P, S) \
|
||||
P##atomic_##OP##S
|
||||
|
||||
|
||||
/* to make sure all the macro passed as params are expanded,
|
||||
* go through a 2 level deep macro decl. */
|
||||
#define _AT_DECL1(OP, P, S) _AT_DECL(OP, P, S)
|
||||
#define AT_DECL(OP) _AT_DECL1(OP, MB, SUF)
|
||||
|
||||
|
||||
#define at_set AT_DECL(set)
|
||||
#define at_get AT_DECL(get)
|
||||
|
||||
#define at_inc AT_DECL(inc)
|
||||
#define at_dec AT_DECL(dec)
|
||||
#define at_inc_and_test AT_DECL(inc_and_test)
|
||||
#define at_dec_and_test AT_DECL(dec_and_test)
|
||||
#define at_and AT_DECL(and)
|
||||
#define at_or AT_DECL(or)
|
||||
#define at_get_and_set AT_DECL(get_and_set)
|
||||
#define at_cmpxchg AT_DECL(cmpxchg)
|
||||
#define at_add AT_DECL(add)
|
||||
|
||||
|
||||
#define CHECK_ERR(txt, x, y) \
|
||||
if (x!=y) { \
|
||||
fprintf(stderr, "ERROR: line %d: %s failed: expected 0x%02x but got "\
|
||||
"0x%02x.\n", \
|
||||
__LINE__, #txt, (unsigned) x, (unsigned) y);\
|
||||
goto error; \
|
||||
}
|
||||
|
||||
#define VERIFY(ops, y) \
|
||||
ops ; \
|
||||
CHECK_ERR( ops, y, get_val(v))
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ATOMIC_TYPE var;
|
||||
VALUE_TYPE r;
|
||||
|
||||
ATOMIC_TYPE* v;
|
||||
|
||||
v=&var;
|
||||
|
||||
|
||||
#ifdef MEMBAR_USES_LOCK
|
||||
__membar_lock=&dummy_membar_lock;
|
||||
if (lock_init(__membar_lock)==0){
|
||||
fprintf(stderr, "ERROR: failed to initialize membar_lock\n");
|
||||
__membar_lock=0;
|
||||
goto error;
|
||||
}
|
||||
_membar_lock; /* start with the lock "taken" so that we can safely use
|
||||
unlock/lock sequences on it later */
|
||||
#endif
|
||||
#ifdef ATOMIC_OPS_USE_LOCK_SET
|
||||
/* init the lock (emulate atomic_ops.c) */
|
||||
dummy_atomic_lock_set.locks=&locks_array[0];
|
||||
_atomic_lock_set=&dummy_atomic_lock_set;
|
||||
if (lock_set_init(_atomic_lock_set)==0){
|
||||
fprintf(stderr, "ERROR: failed to initialize atomic_lock\n");
|
||||
_atomic_lock_set=0;
|
||||
goto error;
|
||||
}
|
||||
#elif defined ATOMIC_OPS_USE_LOCK
|
||||
/* init the lock (emulate atomic_ops.c) */
|
||||
_atomic_lock=&dummy_atomic_lock;
|
||||
if (lock_init(_atomic_lock)==0){
|
||||
fprintf(stderr, "ERROR: failed to initialize atomic_lock\n");
|
||||
_atomic_lock=0;
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("%s\n", flags);
|
||||
|
||||
printf("starting memory barrier opcode tests...\n");
|
||||
membar();
|
||||
printf(" membar() .............................. ok\n");
|
||||
membar_write();
|
||||
printf(" membar_write() ........................ ok\n");
|
||||
membar_read();
|
||||
printf(" membar_read() ......................... ok\n");
|
||||
membar_depends();
|
||||
printf(" membar_depends() ...................... ok\n");
|
||||
membar_enter_lock();
|
||||
printf(" membar_enter_lock() ................... ok\n");
|
||||
membar_leave_lock();
|
||||
printf(" membar_leave_lock() ................... ok\n");
|
||||
membar_atomic_op();
|
||||
printf(" membar_atomic_op() .................... ok\n");
|
||||
membar_atomic_setget();
|
||||
printf(" membar_atomic_setget() ................ ok\n");
|
||||
membar_read_atomic_op();
|
||||
printf(" membar_read_atomic_op() ............... ok\n");
|
||||
membar_read_atomic_setget();
|
||||
printf(" membar_read_atomic_setget() ........... ok\n");
|
||||
membar_write_atomic_op();
|
||||
printf(" membar_write_atomic_op() .............. ok\n");
|
||||
membar_write_atomic_setget();
|
||||
printf(" membar_write_atomic_setget() .......... ok\n");
|
||||
|
||||
printf("\nstarting atomic ops basic tests...\n");
|
||||
|
||||
VERIFY(at_set(v, 1), 1);
|
||||
printf(" atomic_set, v should be 1 ............. %2d\n", (int)at_get(v));
|
||||
VERIFY(at_inc(v), 2);
|
||||
printf(" atomic_inc, v should be 2 ............. %2d\n", (int)at_get(v));
|
||||
VERIFY(r=at_inc_and_test(v), 3);
|
||||
printf(" atomic_inc_and_test, v should be 3 ... %2d\n", (int)at_get(v));
|
||||
printf(" r should be 0 ... %2d\n", (int)r);
|
||||
|
||||
VERIFY(at_dec(v), 2);
|
||||
printf(" atomic_dec, v should be 2 ............. %2d\n", (int)at_get(v));
|
||||
VERIFY(r=at_dec_and_test(v), 1);
|
||||
printf(" atomic_dec_and_test, v should be 1 ... %2d\n", (int)at_get(v));
|
||||
printf(" r should be 0 ... %2d\n", (int)r);
|
||||
VERIFY(r=at_dec_and_test(v), 0);
|
||||
printf(" atomic_dec_and_test, v should be 0 ... %2d\n", (int)at_get(v));
|
||||
printf(" r should be 1 ... %2d\n", (int)r);
|
||||
VERIFY(r=at_dec_and_test(v), -1);
|
||||
printf(" atomic_dec_and_test, v should be -1 ... %2d\n", (int)at_get(v));
|
||||
printf(" r should be 0 ... %2d\n", (int)r);
|
||||
|
||||
VERIFY(at_and(v, 2), 2);
|
||||
printf(" atomic_and, v should be 2 ............. %2d\n", (int)at_get(v));
|
||||
|
||||
VERIFY(at_or(v, 5), 7);
|
||||
printf(" atomic_or, v should be 7 ............. %2d\n", (int)at_get(v));
|
||||
VERIFY(r=at_get_and_set(v, 0), 0);
|
||||
printf(" atomic_get_and_set, v should be 0 ..... %2d\n", (int)at_get(v));
|
||||
VERIFY(r=at_cmpxchg(v, 0, 7), 7);
|
||||
CHECK_ERR(cmpxchg, r, 0);
|
||||
printf(" atomic_cmpxchg, v should be 7 ......... %2d\n", (int)at_get(v));
|
||||
printf(" r should be 0 ......... %2d\n", (int)r);
|
||||
VERIFY(r=at_cmpxchg(v, 2, 3), 7);
|
||||
CHECK_ERR(cmpxchg, r, 7);
|
||||
printf(" atomic_cmpxchg (fail), v should be 7 .. %2d\n", (int)at_get(v));
|
||||
printf(" r should be 7 .. %2d\n", (int)r);
|
||||
VERIFY(r=at_add(v, 2), 9);
|
||||
CHECK_ERR(atomic_add, r, 9);
|
||||
printf(" atomic_add, v should be 9 ............. %2d\n", (int)at_get(v));
|
||||
printf(" r should be 9 ............. %2d\n", (int)r);
|
||||
VERIFY(r=at_add(v, -10), -1);
|
||||
CHECK_ERR(atomic_add, r, -1);
|
||||
printf(" atomic_add, v should be -1 ............ %2d\n", (int)at_get(v));
|
||||
printf(" r should be -1 ............ %2d\n", (int)r);
|
||||
|
||||
|
||||
printf("\ndone.\n");
|
||||
#ifdef MEMBAR_USES_LOCK
|
||||
lock_destroy(__membar_lock);
|
||||
#endif
|
||||
#ifdef ATOMIC_OPS_USE_LOCK_SET
|
||||
lock_set_destroy(_atomic_lock_set);
|
||||
#elif defined ATOMIC_OPS_USE_LOCK
|
||||
lock_destroy(_atomic_lock);
|
||||
#endif
|
||||
return 0;
|
||||
error:
|
||||
#ifdef MEMBAR_USES_LOCK
|
||||
if (__membar_lock)
|
||||
lock_destroy(__membar_lock);
|
||||
#endif
|
||||
#ifdef ATOMIC_OPS_USE_LOCK_SET
|
||||
if (_atomic_lock_set)
|
||||
lock_set_destroy(_atomic_lock_set);
|
||||
#elif defined ATOMIC_OPS_USE_LOCK
|
||||
if (_atomic_lock)
|
||||
lock_destroy(_atomic_lock);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@ -0,0 +1,444 @@
|
||||
|
||||
/* test program -> switch speed */
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2001-2003 FhG Fokus
|
||||
*
|
||||
* This file is part of ser, a free SIP server.
|
||||
*
|
||||
* ser is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version
|
||||
*
|
||||
* For a license to use the ser software under conditions
|
||||
* other than those described here, or to purchase support for this
|
||||
* software, please contact iptel.org by e-mail at the following addresses:
|
||||
* info@iptel.org
|
||||
*
|
||||
* ser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* parsing: compact form:
|
||||
* Via: v:
|
||||
* From: f:
|
||||
* To: t:
|
||||
* Cseq: n/a
|
||||
* Call-ID: i:
|
||||
* Contact: m:
|
||||
* Max-Forwards: n/a
|
||||
* Route: n/a
|
||||
*/
|
||||
|
||||
enum { INITIAL=0,
|
||||
VIA1, VIA2,
|
||||
FROM1, FROM2, FROM3,
|
||||
TO1,
|
||||
C_START, CSEQ2, CSEQ3,
|
||||
CALLID2, CALLID3, CALLID4, CALLID5, CALLID6,
|
||||
CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6,
|
||||
M_START, MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
|
||||
MAXFORWARDS6, MAXFORWARDS7, MAXFORWARDS8, MAXFORWARDS9, MAXFORWARDS10,
|
||||
MAXFORWARDS11,
|
||||
ROUTE1, ROUTE2, ROUTE3, ROUTE4,
|
||||
/* final states*/
|
||||
F_VIA=1000, F_FROM, F_TO, F_CSEQ, F_CALLID, F_CONTACT, F_MAXFORWARDS,
|
||||
F_ROUTE,
|
||||
I_START,
|
||||
|
||||
UNKNOWN_HEADER=200,
|
||||
BODY=220,
|
||||
LF=25000,
|
||||
};
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
char* t;
|
||||
register int state;
|
||||
int i;
|
||||
int err;
|
||||
err=0;
|
||||
|
||||
state=INITIAL;
|
||||
printf(" %s (%d)\n", argv[0], argc);
|
||||
if (argc<2){
|
||||
fprintf(stderr, " no parameters\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i=0;i<10000000;i++){
|
||||
|
||||
for(t=argv[1];*t;t++){
|
||||
switch(*t){
|
||||
case 'V':
|
||||
case 'v':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=VIA1;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
switch(state){
|
||||
case VIA1:
|
||||
state=VIA2;
|
||||
break;
|
||||
case CALLID5:
|
||||
state=CALLID6;
|
||||
break;
|
||||
case INITIAL:
|
||||
state=I_START;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
case 'a':
|
||||
switch(state){
|
||||
case VIA2:
|
||||
state=F_VIA;
|
||||
break;
|
||||
case C_START: /*CALLID1*/
|
||||
state=CALLID2;
|
||||
break;
|
||||
case CONTACT4:
|
||||
state=CONTACT5;
|
||||
break;
|
||||
case M_START:
|
||||
state=MAXFORWARDS2;
|
||||
break;
|
||||
case MAXFORWARDS8:
|
||||
state=MAXFORWARDS9;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'f':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=FROM1;
|
||||
break;
|
||||
case MAXFORWARDS4:
|
||||
state=MAXFORWARDS5;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
case 'r':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=ROUTE1;
|
||||
break;
|
||||
case FROM1:
|
||||
state=FROM2;
|
||||
break;
|
||||
case MAXFORWARDS6:
|
||||
state=MAXFORWARDS7;
|
||||
break;
|
||||
case MAXFORWARDS9:
|
||||
state=MAXFORWARDS10;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
case 'o':
|
||||
switch(state){
|
||||
case FROM2:
|
||||
state=FROM3;
|
||||
break;
|
||||
case TO1:
|
||||
state=F_TO;
|
||||
break;
|
||||
case C_START: /*CONTACT1 */
|
||||
state=CONTACT2;
|
||||
break;
|
||||
case ROUTE1:
|
||||
state=ROUTE2;
|
||||
break;
|
||||
case MAXFORWARDS5:
|
||||
state=MAXFORWARDS6;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
case 'm':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=M_START;
|
||||
break;
|
||||
case FROM3:
|
||||
state=F_FROM;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=TO1;
|
||||
break;
|
||||
case CONTACT3:
|
||||
state=CONTACT4;
|
||||
break;
|
||||
case CONTACT6:
|
||||
state=F_CONTACT;
|
||||
break;
|
||||
case ROUTE3:
|
||||
state=ROUTE4;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
state=C_START;
|
||||
break;
|
||||
case CONTACT5:
|
||||
state=CONTACT6;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
switch(state){
|
||||
case C_START:
|
||||
state=CSEQ2;
|
||||
break;
|
||||
case MAXFORWARDS11:
|
||||
state=F_MAXFORWARDS;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
case 'e':
|
||||
switch(state){
|
||||
case CSEQ2:
|
||||
state=CSEQ3;
|
||||
break;
|
||||
case ROUTE4:
|
||||
state=F_ROUTE;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
switch(state){
|
||||
case CSEQ3:
|
||||
state=F_CSEQ;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
case 'l':
|
||||
switch(state){
|
||||
case CALLID2:
|
||||
state=CALLID3;
|
||||
break;
|
||||
case CALLID3:
|
||||
state=CALLID4;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
switch(state){
|
||||
case CALLID6:
|
||||
state=F_CALLID;
|
||||
break;
|
||||
case MAXFORWARDS10:
|
||||
state=MAXFORWARDS11;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'N':
|
||||
case 'n':
|
||||
switch(state){
|
||||
case CONTACT2:
|
||||
state=CONTACT3;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
case 'x':
|
||||
switch(state){
|
||||
case MAXFORWARDS2:
|
||||
state=MAXFORWARDS3;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
switch(state){
|
||||
case CALLID4:
|
||||
state=CALLID5;
|
||||
break;
|
||||
case MAXFORWARDS3:
|
||||
state=MAXFORWARDS4;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
switch(state){
|
||||
case MAXFORWARDS7:
|
||||
state=MAXFORWARDS8;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
case 'u':
|
||||
switch(state){
|
||||
case ROUTE2:
|
||||
state=ROUTE3;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case ' ':
|
||||
switch(state){
|
||||
case INITIAL:
|
||||
break; /*eat space */
|
||||
case F_VIA:
|
||||
case F_FROM:
|
||||
case F_TO:
|
||||
case F_CSEQ:
|
||||
case F_CALLID:
|
||||
case F_CONTACT:
|
||||
case F_MAXFORWARDS:
|
||||
case F_ROUTE:
|
||||
break; /* eat trailing space*/
|
||||
case VIA1:
|
||||
/*compact form: v: */
|
||||
state=F_VIA;
|
||||
break;
|
||||
case FROM1:
|
||||
/*compact form f:*/
|
||||
state=F_FROM;
|
||||
break;
|
||||
case TO1:
|
||||
/*compact form t:*/
|
||||
state=F_TO;
|
||||
break;
|
||||
case I_START:
|
||||
/*compact form i: (Call-ID)*/
|
||||
state=F_CALLID;
|
||||
break;
|
||||
case M_START:
|
||||
/*compact form m: (Contact)*/
|
||||
state=F_CONTACT;
|
||||
break;
|
||||
case UNKNOWN_HEADER: break;
|
||||
default:
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
switch(state){
|
||||
case F_VIA:
|
||||
case VIA1: /* compact form*/
|
||||
case F_FROM:
|
||||
case FROM1: /*compact form*/
|
||||
case F_TO:
|
||||
case TO1: /*compact form*/
|
||||
case F_CSEQ:
|
||||
case F_CALLID:
|
||||
case I_START: /*compact form*/
|
||||
case F_CONTACT:
|
||||
case M_START: /*compact form*/
|
||||
case F_MAXFORWARDS:
|
||||
case F_ROUTE:
|
||||
// printf("found header, state=%d\n", state);
|
||||
state=INITIAL; /* reset to test*/
|
||||
break;
|
||||
case UNKNOWN_HEADER:
|
||||
default:
|
||||
/*printf("found unknown header, state=%d\n",
|
||||
state);*/
|
||||
err=1;
|
||||
state=INITIAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*fprintf(stderr, "Unexpected char <%c> encountered"
|
||||
" state=%d\n", *t, state);
|
||||
exit(-1);*/
|
||||
state=UNKNOWN_HEADER;
|
||||
}
|
||||
}
|
||||
|
||||
} //for i
|
||||
if (err) printf("Error unknown header\n");
|
||||
printf("final state=%d\n", state);
|
||||
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1 @@
|
||||
" unterminated string
|
||||
@ -0,0 +1,32 @@
|
||||
INVITE sip:jiri@bat.iptel.org SIP/2.0
|
||||
Max-Forwards: 10
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: d10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,6 @@
|
||||
INVITE sip:x@y.z SIP/2.0
|
||||
Via : SIP / 2.0
|
||||
/UDP
|
||||
193.175.133.193
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
INVITE sip:x@y.z SIP/2.0/UDP
|
||||
V: SIP/2.0/UDP 193.175.133.193
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
INVITE sip:x@y.z SIP/2.0/UDP
|
||||
|
||||
|
||||
@ -0,0 +1,401 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Tests for basex.h
|
||||
*
|
||||
* Copyright (C) 2008 iptelorg GmbH
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/*#define NO_BASE64_LOOKUP_TABLE
|
||||
#define SINGLE_REG */
|
||||
|
||||
#include "../basex.h"
|
||||
#include "profile.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define BASE64 64
|
||||
#define Q_BASE64 640
|
||||
#define BASE16 16
|
||||
|
||||
#ifndef BASEX
|
||||
#define BASEX BASE16
|
||||
#endif
|
||||
|
||||
#if BASEX == Q_BASE64
|
||||
|
||||
#warning Q_BASE64
|
||||
#define B_ENC q_base64_enc
|
||||
#define B_DEC q_base64_dec
|
||||
#define B_ENC_LEN(l) (((l)+2)/3*4)
|
||||
|
||||
#elif BASEX == BASE16
|
||||
|
||||
#warning BASE16
|
||||
#define B_ENC base16_enc
|
||||
#define B_DEC base16_dec
|
||||
#define B_ENC_LEN(l) ((l)*2)
|
||||
|
||||
#else
|
||||
|
||||
#warning BASE64
|
||||
#define B_ENC base64_enc
|
||||
#define B_DEC base64_dec
|
||||
#define B_ENC_LEN(l) (((l)+2)/3*4)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define QUOTE_MACRO(x) QUOTEME(x)
|
||||
#define QUOTEME(x) #x
|
||||
|
||||
static char* id="$Id$";
|
||||
static char* version="basex test 0.1 "
|
||||
"BASE" QUOTE_MACRO(BASEX) ": " QUOTE_MACRO(B_ENC) ", " QUOTE_MACRO(B_DEC) ""
|
||||
#if defined BASE64_LOOKUP_TABLE
|
||||
#ifdef BASE64_LOOKUP_LARGE
|
||||
" (large b64 lookup table)"
|
||||
#else
|
||||
" (lookup b64 table)"
|
||||
#endif
|
||||
#else
|
||||
" (no b64 lookup table)"
|
||||
#endif
|
||||
#if defined BASE16_LOOKUP_TABLE
|
||||
#ifdef BASE16_LOOKUP_LARGE
|
||||
" (large b16 lookup table)"
|
||||
#else
|
||||
" (lookup b16 table)"
|
||||
#endif
|
||||
#else
|
||||
" (no b16 lookup table)"
|
||||
#endif
|
||||
#if defined BASE64_READ_WHOLE_INTS || defined BASE16_READ_WHOLE_INTS
|
||||
" (read 4 bytes at a time)"
|
||||
#else
|
||||
" (read 1 byte at a time)"
|
||||
#endif
|
||||
;
|
||||
|
||||
static char* help_msg="\
|
||||
Usage: basex [-hv] ... [options]\n\
|
||||
Options:\n\
|
||||
-m min minimum length\n\
|
||||
-M max maximum length\n\
|
||||
-o offset offset from the start of the buffer (alignment tests)\n\
|
||||
-e offset offset from the start of the dst. buf. (alignment tests)\n\
|
||||
-n no. number of test loops\n\
|
||||
-v increase verbosity\n\
|
||||
-V version number\n\
|
||||
-h this help message\n\
|
||||
";
|
||||
|
||||
|
||||
/* profiling */
|
||||
struct profile_data pf1, pf2, pf3, pf4, pf5, pf6;
|
||||
|
||||
|
||||
void dump_profile_info(struct profile_data* pd)
|
||||
{
|
||||
printf("profiling for %s (%ld/%ld): %lld/%lld/%lld (max/avg/last),"
|
||||
" total %lld\n",
|
||||
pd->name, pd->entries, pd->exits, pd->max_cycles,
|
||||
pd->entries?pd->total_cycles/pd->entries:0, pd->cycles,
|
||||
pd->total_cycles);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int seed_prng()
|
||||
{
|
||||
int seed, rfd;
|
||||
|
||||
if ((rfd=open("/dev/urandom", O_RDONLY))!=-1){
|
||||
try_again:
|
||||
if (read(rfd, (void*)&seed, sizeof(seed))==-1){
|
||||
if (errno==EINTR) goto try_again; /* interrupted by signal */
|
||||
fprintf(stderr, "WARNING: could not read from /dev/urandom: "
|
||||
" %s (%d)\n", strerror(errno), errno);
|
||||
}
|
||||
close(rfd);
|
||||
}else{
|
||||
fprintf(stderr, "WARNING: could not open /dev/urandom: %s (%d)\n",
|
||||
strerror(errno), errno);
|
||||
}
|
||||
seed+=getpid()+time(0);
|
||||
srand(seed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* fill buf with random data*/
|
||||
void fill_rand(unsigned char* buf, int len)
|
||||
{
|
||||
unsigned char* end;
|
||||
int v;
|
||||
|
||||
/* find out how many random bytes we can get from rand() */
|
||||
#if RAND_MAX >= 0xffffffff
|
||||
#define RAND_BYTES 4
|
||||
#warning RAND_BYTES is 4
|
||||
#elif RAND_MAX >= 0xffffff
|
||||
#define RAND_BYTES 3
|
||||
#warning RAND_BYTES is 3
|
||||
#elif RAND_MAX >= 0xffff
|
||||
#define RAND_BYTES 2
|
||||
#warning RAND_BYTES is 2
|
||||
#else
|
||||
#define RAND_BYTES 1
|
||||
#endif
|
||||
|
||||
end=buf+len/RAND_BYTES*RAND_BYTES;
|
||||
for(;buf<end;buf+=RAND_BYTES){
|
||||
v=rand();
|
||||
buf[0]=v;
|
||||
#if RAND_BYTES > 1
|
||||
buf[1]=v>>8;
|
||||
#endif
|
||||
#if RAND_BYTES > 2
|
||||
buf[2]=v>>16;
|
||||
#endif
|
||||
#if RAND_BYTES > 4
|
||||
buf[3]=v>>24;
|
||||
#endif
|
||||
}
|
||||
v=rand();
|
||||
switch(end-buf){
|
||||
case 3:
|
||||
#if RAND_BYTES > 2
|
||||
buf[2]=v>>16;
|
||||
#else
|
||||
buf[2]=rand();
|
||||
#endif
|
||||
case 2:
|
||||
#if RAND_BYTES > 1
|
||||
buf[1]=v>>8;
|
||||
#else
|
||||
buf[1]=rand();
|
||||
#endif
|
||||
case 1:
|
||||
buf[0]=v;
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
int loops, min_len, max_len, offset, e_offset;
|
||||
unsigned char* ibuf;
|
||||
unsigned char* enc_buf;
|
||||
unsigned char* dec_buf;
|
||||
int ibuf_len, enc_buf_len, dec_buf_len;
|
||||
int offs, c_len, e_len, l;
|
||||
int r;
|
||||
int verbose;
|
||||
int c;
|
||||
char* tmp;
|
||||
|
||||
verbose=0;
|
||||
min_len=max_len=offset=-1;
|
||||
e_offset=0;
|
||||
loops=1024;
|
||||
opterr=0;
|
||||
while ((c=getopt(argc, argv, "n:m:M:o:e:vhV"))!=-1){
|
||||
switch(c){
|
||||
case 'n':
|
||||
loops=strtol(optarg, &tmp, 0);
|
||||
if ((tmp==0)||(*tmp)||(loops<0)){
|
||||
fprintf(stderr, "bad number: -%c %s\n", c, optarg);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
min_len=strtol(optarg, &tmp, 0);
|
||||
if ((tmp==0)||(*tmp)||(min_len<0)){
|
||||
fprintf(stderr, "bad number: -%c %s\n", c, optarg);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
max_len=strtol(optarg, &tmp, 0);
|
||||
if ((tmp==0)||(*tmp)||(max_len<0)){
|
||||
fprintf(stderr, "bad number: -%c %s\n", c, optarg);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
offset=strtol(optarg, &tmp, 0);
|
||||
if ((tmp==0)||(*tmp)||(offset<0)){
|
||||
fprintf(stderr, "bad number: -%c %s\n", c, optarg);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 'e':
|
||||
e_offset=strtol(optarg, &tmp, 0);
|
||||
if ((tmp==0)||(*tmp)||(e_offset<0)){
|
||||
fprintf(stderr, "bad number: -%c %s\n", c, optarg);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'V':
|
||||
printf("version: %s\n", version);
|
||||
printf("%s\n", id);
|
||||
exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
printf("version: %s\n", version);
|
||||
printf("%s", help_msg);
|
||||
exit(0);
|
||||
break;
|
||||
case '?':
|
||||
if (isprint(optopt))
|
||||
fprintf(stderr, "Unknown option `-%c\n", optopt);
|
||||
else
|
||||
fprintf(stderr, "Unknown character `\\x%x\n", optopt);
|
||||
goto error;
|
||||
case ':':
|
||||
fprintf(stderr, "Option `-%c requires an argument.\n",
|
||||
optopt);
|
||||
goto error;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
if (min_len==-1 && max_len==-1){
|
||||
min_len=0;
|
||||
max_len=4*1024*1024;
|
||||
}else if (min_len==-1)
|
||||
min_len=0;
|
||||
else if (max_len==-1)
|
||||
max_len=min_len;
|
||||
/* init */
|
||||
ibuf_len=max_len;
|
||||
ibuf=malloc(ibuf_len);
|
||||
if (ibuf==0){
|
||||
fprintf(stderr, "ERROR: 1. memory allocation error (%d bytes)\n",
|
||||
ibuf_len);
|
||||
exit(-1);
|
||||
}
|
||||
enc_buf_len=B_ENC_LEN(ibuf_len);
|
||||
enc_buf=malloc(enc_buf_len+e_offset);
|
||||
if (enc_buf==0){
|
||||
fprintf(stderr, "ERROR: 2. memory allocation error (%d bytes)\n",
|
||||
enc_buf_len);
|
||||
exit(-1);
|
||||
}
|
||||
enc_buf+=e_offset; /* make sure it's off by e_offset bytes from the
|
||||
aligned stuff malloc returns */
|
||||
dec_buf_len=ibuf_len;
|
||||
dec_buf=malloc(dec_buf_len+e_offset);
|
||||
if (dec_buf==0){
|
||||
fprintf(stderr, "ERROR: 3. memory allocation error (%d bytes)\n",
|
||||
dec_buf_len+e_offset);
|
||||
exit(-1);
|
||||
}
|
||||
dec_buf+=e_offset; /* make sure it's off by e_offset bytes from the
|
||||
aligned stuff malloc returns */
|
||||
|
||||
|
||||
seed_prng();
|
||||
/* profile */
|
||||
profile_init(&pf1, "encode");
|
||||
profile_init(&pf2, "decode");
|
||||
|
||||
init_basex();
|
||||
if (verbose)
|
||||
printf("starting (loops %d, min size %d, max size %d, offset %d,"
|
||||
", e_offset %d, buffer sizes %d %d %d)\n",
|
||||
loops, min_len, max_len, offset, e_offset, ibuf_len,
|
||||
enc_buf_len, dec_buf_len);
|
||||
|
||||
for (r=0; r<loops; r++){
|
||||
if (min_len!=max_len)
|
||||
/* test encode/decode random data w/ random length*/
|
||||
c_len= min_len+(int)((float)(max_len-min_len+1)*
|
||||
(rand()/(RAND_MAX+1.0)));
|
||||
else
|
||||
/* test encode /decode random data w/ fixed lenght*/
|
||||
c_len=max_len;
|
||||
if (offset==-1)
|
||||
/* offset between 0 & MIN(clen,3) */
|
||||
offs= (int)((float)(MIN(c_len,3)+1)*(rand()/(RAND_MAX+1.0)));
|
||||
else if (offset>c_len)
|
||||
offs=0;
|
||||
else
|
||||
offs=offset;
|
||||
if (verbose>2)
|
||||
printf("loop %d, current len %d, offset %d, start %p\n",
|
||||
r, c_len-offs, offs, &ibuf[offs]);
|
||||
else if ((verbose >1) && (r %10==0)) putchar('.');
|
||||
|
||||
fill_rand(ibuf, c_len);
|
||||
|
||||
c_len-=offs;
|
||||
e_len=B_ENC_LEN(c_len);
|
||||
profile_start(&pf1);
|
||||
l=B_ENC(&ibuf[offs], c_len, enc_buf, e_len);
|
||||
profile_end(&pf1);
|
||||
if (l != e_len){
|
||||
fprintf(stderr, "ERROR: invalid length for encoding: %d "
|
||||
"instead of %d (loops=%d)\n", l, e_len, r);
|
||||
exit(-1);
|
||||
}
|
||||
profile_start(&pf2);
|
||||
l=B_DEC(enc_buf, e_len, dec_buf, c_len);
|
||||
profile_end(&pf2);
|
||||
if (l != c_len){
|
||||
fprintf(stderr, "ERROR: invalid length for decoding: %d "
|
||||
"instead of %d (loops=%d)\n", l, c_len, r);
|
||||
exit(-1);
|
||||
}
|
||||
if (memcmp(&ibuf[offs], dec_buf, c_len)!=0){
|
||||
fprintf(stderr, "ERROR: decoding mismatch "
|
||||
"(loops=%d, c_len=%d)\n", r, c_len);
|
||||
abort();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if (verbose >1) putchar('\n');
|
||||
/* encode len data and decode it, print profiling info*/
|
||||
dump_profile_info(&pf1);
|
||||
dump_profile_info(&pf2);
|
||||
return 0;
|
||||
error:
|
||||
exit(-1);
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
# test results for basex.c
|
||||
|
||||
|
||||
pentium-m (core2):
|
||||
gcc -g -Wall -O9 -mtune=pentium-m -mcpu=pentium-m -D__CPU_x86 ${DEFS} \
|
||||
../basex.c basex.c -o basex
|
||||
|
||||
4 8 16 32 40 64 80 128
|
||||
lookup:
|
||||
base16_enc4 83 96 125 177 205 291 345 509
|
||||
base16_dec4
|
||||
base16_enc 79 97 150 208 240 326 390 559
|
||||
base16_dec 76 96 152 217 249 350 402 588
|
||||
|
||||
lookup(DEFS=-DBASEX=BASE64)::
|
||||
base16_enc4 211
|
||||
base16_dec4 252
|
||||
base16_enc 231
|
||||
base16_dec 251
|
||||
lookup_Large (DEFS=-DBASE16_LOOKUP_LARGE -DBASEX=BASE64):
|
||||
base16_enc4 218
|
||||
base16_dec4 236
|
||||
base16_enc 199
|
||||
base16_dec 236
|
||||
|
||||
no lookup (DEFS=NO_BASE64_LOOKUP_TABLE -DBASEX=BASE64):
|
||||
base64_enc 156 1005
|
||||
181 1242
|
||||
lookup (DEFS=-DBASEX=BASE64):
|
||||
base64_enc 82 101 120 185 209 302 335 521
|
||||
base64_dec 89 103 140 198 208 289 359 546
|
||||
lookup_large (DEFS=-DBASE64_LOOKUP_LARGE -DBASEX=BASE64):
|
||||
base64_enc 79 85 103 157 186 268 276 421
|
||||
base64_dec 93 103 126 188 207 281 348 510
|
||||
|
||||
lookup_8k (DEFS=-DBASE64_LOOKUP_8K -DBASEX=BASE64), -e 1
|
||||
base64_enc 77 94 177 422
|
||||
lookup_8k words (like above but -e 0)
|
||||
base64_enc 77 156 329
|
||||
|
||||
|
||||
ultrasparc:
|
||||
gcc -g -Wall -O9 -mtune=ultrasparc -mcpu=ultrasparc -D__CPU_sparc64 ${DEFS} \
|
||||
../basex.c basex.c -o basex
|
||||
|
||||
no lookup (DEFS=-DNO_BASE64_LOOKUP_TABLE -DBASEX=BASE64):
|
||||
base64_enc 728
|
||||
1425
|
||||
lookup (DEFS=-DBASEX=BASE64):
|
||||
base64_enc 314
|
||||
260
|
||||
lookup_large (DEFS=-DBASE64_LOOKUP_LARGE -DBASEX=BASE64):
|
||||
base64_enc 295
|
||||
|
||||
lookup_8k (DEFS=-DBASE64_LOOKUP_8K -DBASEX=BASE64), -e 1
|
||||
base64_enc 323
|
||||
250
|
||||
lookup_8k words (like above but -e 0)
|
||||
base64_enc 91 118 296
|
||||
101 117 249
|
||||
@ -0,0 +1,10 @@
|
||||
BYE sip:211111948@195.37.77.101;transport=tcp;r2=on;ftag=e495220a31344eb39a6bf44ee3b01303;lr=on SIP/2.0
|
||||
Max-Forwards: 10
|
||||
Via: SIP/2.0/UDP 192.246.69.223;branch=z9hG4bK1ac2.64b19ee4.0
|
||||
From: <sip:xxx@iptel.org>;tag=as38468f70
|
||||
To: "christian@iptel.org" <sip:christian@iptel.org>;tag=e495220a31344eb39a6bf44ee3b01303;epid=f15c896fef
|
||||
Contact: <sip:404@65.39.205.112:5028>
|
||||
Call-ID: axxxxxef5cec10dd5f4dca871b764cb83ee73c@192.168.1.100
|
||||
CSeq: 102 BYE
|
||||
Content-Length: 0
|
||||
|
||||
@ -0,0 +1,207 @@
|
||||
/* $Id$
|
||||
*
|
||||
* test bit_scan operations from bit_scan.h
|
||||
* (both for correctness and speed)
|
||||
*
|
||||
* Copyright (C) 2007 iptelorg GmbH
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Example gcc command line:
|
||||
* gcc -O9 -Wall -DCC_GCC_LIKE_ASM -D__CPU_x86 bit_scan_test.c ../bit_scan.c
|
||||
* -o bit_scan_test
|
||||
*
|
||||
* History:
|
||||
* --------
|
||||
* 2007-06-23 created by andrei
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define BIT_SCAN_DEBRUIJN
|
||||
#define BIT_SCAN_BRANCH
|
||||
#define BIT_SCAN_SLOW
|
||||
|
||||
#include "../bit_scan.h"
|
||||
#ifdef NO_PROFILE
|
||||
#define profile_init(x,y) do{}while(0)
|
||||
#define profile_start(x) do{}while(0)
|
||||
#define profile_end(x) do{}while(0)
|
||||
#define PROFILE_PRINT(x) do{}while(0)
|
||||
#else
|
||||
#include "profile.h"
|
||||
#endif
|
||||
|
||||
#define CHECK(txt, v1, val, f, pd) \
|
||||
do{ \
|
||||
unsigned long long ret; \
|
||||
profile_start(pd); \
|
||||
ret=(unsigned long long)f(val); \
|
||||
profile_end(pd); \
|
||||
if ((unsigned long long)v1!=ret){ \
|
||||
fprintf(stderr, "ERROR:" #f ": %s, expected %llx (%llx), got"\
|
||||
" %llx\n", \
|
||||
(txt), (unsigned long long)v1, \
|
||||
(unsigned long long)val, ret); \
|
||||
exit(-1); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#ifndef PROFILE_PRINT
|
||||
#define PROFILE_PRINT(pd) \
|
||||
do{ \
|
||||
printf("profile: %s (%ld/%ld) total %llu max %llu average %llu\n", \
|
||||
(pd)->name, (pd)->entries, (pd)->exits, \
|
||||
(pd)->total_cycles, (pd)->max_cycles, \
|
||||
(pd)->entries? \
|
||||
(pd)->total_cycles/(unsigned long long)(pd)->entries:0ULL ); \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int r;
|
||||
unsigned int v;
|
||||
unsigned long long ll;
|
||||
int i;
|
||||
#ifndef NO_PROFILE
|
||||
struct profile_data pdf1, pdf2, pdf4, pdf5, pdf6, pdf8;
|
||||
struct profile_data pdl1, pdl2, pdl4, pdl5, pdl6, pdl8;
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
struct profile_data pdf3, pdf7, pdl3, pdl7;
|
||||
#endif
|
||||
struct profile_data pdf_32, pdf_64, pdl_32, pdl_64;
|
||||
struct profile_data pdf_long, pdl_long;
|
||||
#endif /* NO_PROFILE */
|
||||
|
||||
profile_init(&pdf1, "first_debruijn32");
|
||||
profile_init(&pdf2, "first_slow32");
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
profile_init(&pdf3, "first_asm32");
|
||||
#endif
|
||||
profile_init(&pdf4, "first_br32");
|
||||
profile_init(&pdf5, "first_debruijn64");
|
||||
profile_init(&pdf6, "first_slow64");
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
profile_init(&pdf7, "first_asm64");
|
||||
#endif
|
||||
profile_init(&pdf8, "first_br64");
|
||||
profile_init(&pdl1, "last_debruijn32");
|
||||
profile_init(&pdl2, "last_slow32");
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
profile_init(&pdl3, "last_asm32");
|
||||
#endif
|
||||
profile_init(&pdl4, "last_br32");
|
||||
profile_init(&pdl5, "last_debruijn64");
|
||||
profile_init(&pdl6, "last_slow64");
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
profile_init(&pdl7, "last_asm64");
|
||||
#endif
|
||||
profile_init(&pdl8, "last_br64");
|
||||
|
||||
profile_init(&pdf_32, "scan_forward32");
|
||||
profile_init(&pdf_64, "scan_forward64");
|
||||
profile_init(&pdl_32, "scan_reverse32");
|
||||
profile_init(&pdl_64, "scan_reverse64");
|
||||
profile_init(&pdf_long, "scan_forward_l");
|
||||
profile_init(&pdl_long, "scan_reverse_l");
|
||||
|
||||
|
||||
for (i=0; i<100; i++){
|
||||
for (r=0; r<32; r++){
|
||||
v=(1U<<r);
|
||||
CHECK("first debruijn 32bit", r, v, bit_scan_forward_debruijn32, &pdf1);
|
||||
CHECK("first slow 32bit", r, v, bit_scan_forward_slow32, &pdf2);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
CHECK("first asm 32bit", r, v, bit_scan_forward_asm32, &pdf3);
|
||||
#endif
|
||||
CHECK("first br 32bit", r, v, bit_scan_forward_br32, &pdf4);
|
||||
CHECK("scan_forward32", r, v, bit_scan_forward32, &pdf_32);
|
||||
if (sizeof(long)<=4){
|
||||
CHECK("scan_forward_l", r, v, bit_scan_forward, &pdf_long);
|
||||
}
|
||||
v+=(v-1);
|
||||
CHECK("last debruijn 32bit", r, v, bit_scan_reverse_debruijn32, &pdl1);
|
||||
CHECK("last slow 32bit", r, v, bit_scan_reverse_slow32, &pdl2);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
CHECK("last asm 32bit", r, v, bit_scan_reverse_asm32, &pdl3);
|
||||
#endif
|
||||
CHECK("last br 32bit", r, v, bit_scan_reverse_br32, &pdl4);
|
||||
CHECK("scan_reverse32", r, v, bit_scan_reverse32, &pdl_32);
|
||||
if (sizeof(long)<=4){
|
||||
CHECK("scan_reverse_l", r, v, bit_scan_reverse, &pdl_long);
|
||||
}
|
||||
}
|
||||
for (r=0; r<64; r++){
|
||||
ll=(1ULL<<r);
|
||||
CHECK("first debruijn 64bit", r, ll, bit_scan_forward_debruijn64, &pdf5);
|
||||
CHECK("first slow 64bit", r, ll, bit_scan_forward_slow64, &pdf6);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
CHECK("first asm 64bit", r, ll, bit_scan_forward_asm64, &pdf7);
|
||||
#endif
|
||||
CHECK("first br 64bit", r, ll, bit_scan_forward_br64, &pdf8);
|
||||
CHECK("scan_forward64", r, ll, bit_scan_forward64, &pdf_64);
|
||||
if (sizeof(long)>4){
|
||||
CHECK("scan_forward_l", r, ll, bit_scan_forward, &pdf_long);
|
||||
}
|
||||
ll+=ll-1;
|
||||
CHECK("last debruijn 64bit", r, ll, bit_scan_reverse_debruijn64, &pdl5);
|
||||
CHECK("last slow 64bit", r, ll, bit_scan_reverse_slow64, &pdl6);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
CHECK("last asm 64bit", r, ll, bit_scan_reverse_asm64, &pdl7);
|
||||
#endif
|
||||
CHECK("last br 64bit", r, ll, bit_scan_reverse_br64, &pdl8);
|
||||
CHECK("scan_reverse64", r, ll, bit_scan_reverse64, &pdl_64);
|
||||
if (sizeof(long)>4){
|
||||
CHECK("scan_reverse_l", r, ll, bit_scan_reverse, &pdl_long);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PROFILE_PRINT(&pdf1);
|
||||
PROFILE_PRINT(&pdf2);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
PROFILE_PRINT(&pdf3);
|
||||
#endif
|
||||
PROFILE_PRINT(&pdf4);
|
||||
PROFILE_PRINT(&pdl1);
|
||||
PROFILE_PRINT(&pdl2);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
PROFILE_PRINT(&pdl3);
|
||||
#endif
|
||||
PROFILE_PRINT(&pdl4);
|
||||
PROFILE_PRINT(&pdf5);
|
||||
PROFILE_PRINT(&pdf6);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
PROFILE_PRINT(&pdf7);
|
||||
#endif
|
||||
PROFILE_PRINT(&pdf8);
|
||||
PROFILE_PRINT(&pdl5);
|
||||
PROFILE_PRINT(&pdl6);
|
||||
#ifdef HAS_BIT_SCAN_ASM
|
||||
PROFILE_PRINT(&pdl7);
|
||||
#endif
|
||||
PROFILE_PRINT(&pdl8);
|
||||
|
||||
PROFILE_PRINT(&pdf_32);
|
||||
PROFILE_PRINT(&pdf_64);
|
||||
PROFILE_PRINT(&pdf_long);
|
||||
PROFILE_PRINT(&pdl_32);
|
||||
PROFILE_PRINT(&pdl_64);
|
||||
PROFILE_PRINT(&pdl_long);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
|
||||
backtrace
|
||||
@ -0,0 +1,14 @@
|
||||
BYE sip:jiri@bat.iptel.org SIP/2.0
|
||||
Max-Forwards: 0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=df6250bb14ccda4a69dc0502173d02b2.e0e.0
|
||||
Via: SIP/2.0/UDP 213.20.228.21:13671
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=9c77afe9-71ec-4c52-a009-f2869fba848b
|
||||
To: <sip:jiri@bat.iptel.org>;tag=9c77afe9-71ec-4c52-a009-f2869fba848b
|
||||
Call-ID: bcd1134d-a36f-4647-ae9f-124c157d2db1@213.20.228.21
|
||||
CSeq: 4 BYE
|
||||
Contact: <sip:213.20.228.21:13671>
|
||||
User-Agent: Windows RTC/10
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3ceffa4400000001d587052d1c8c510923023da8846e64fa", response="daaa8ef489b5ac91420b8a818bf5581d"
|
||||
Content-Length: 0
|
||||
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
BYE sip:christian@iptel.org SIP/2.0
|
||||
Max-Forwards: 10
|
||||
Record-Route: <sip:christian@192.246.69.223;ftag=as38468f70;lr=on>
|
||||
Via: SIP/2.0/UDP 192.246.69.223;branch=z9hG4bK1ac2.64b19ee4.0
|
||||
Via: SIP/2.0/UDP 65.39.205.112:5028;branch=z9hG4bK28091bb9
|
||||
Route: <sip:211111948@195.37.77.101;r2=on;ftag=e495220a31344eb39a6bf44ee3b01303;lr=on>,<sip:211111948@195.37.77.101;transport=tcp;r2=on;ftag=e495220a31344eb39a6bf44ee3b01303;lr=on>
|
||||
From: <sip:xxx@iptel.org>;tag=as38468f70
|
||||
To: "christian@iptel.org" <sip:christian@iptel.org>;tag=e495220a31344eb39a6bf44ee3b01303;epid=f15c896fef
|
||||
Contact: <sip:404@65.39.205.112:5028>
|
||||
Call-ID: xxxef5cec10dd5f4dca871b764cb83ee73c@192.168.1.100
|
||||
CSeq: 102 BYE
|
||||
User-Agent: Asterisk PBX
|
||||
Content-Length: 0
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
# config file for centauri
|
||||
|
||||
route{
|
||||
src_ip=~"testing" log("packet from fokus\n"); route(1);
|
||||
/* drop all others */
|
||||
|
||||
}
|
||||
|
||||
|
||||
route[1]{
|
||||
(src_ip==192.168.46.0/24 or src_ip=~"^dorian") forward("fox.iptel.org");
|
||||
src_ip=="centauri.fokus.gmd.de" log("Possible loop, dropping\n"); drop
|
||||
src_ip==0.0.0.0/0 log("forwarding denied\n"); drop
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
OPTIONS sip:henrxx@iptel.com SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.101:9
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 OPTIONS
|
||||
To: sip:tester@iptel.org
|
||||
Expires: 180
|
||||
Max-Forwards: 9
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,54 @@
|
||||
#
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# echo: rewrite userpart or r-uri to value from From header field
|
||||
#
|
||||
|
||||
debug=3 # debug level (cmd line: -dddddddddd)
|
||||
fork=no
|
||||
log_stderror=yes
|
||||
|
||||
memlog=4
|
||||
|
||||
check_via=no # (cmd. line: -v)
|
||||
dns=no # (cmd. line: -r)
|
||||
rev_dns=no # (cmd. line: -R)
|
||||
port=5060
|
||||
children=4
|
||||
fifo="/tmp/ser_fifo"
|
||||
|
||||
listen=192.168.2.16
|
||||
|
||||
# ------------------ module loading ----------------------------------
|
||||
|
||||
# Uncomment this if you want to use SQL database
|
||||
#loadmodule "/usr/local/lib/ser/modules/mysql.so"
|
||||
|
||||
loadmodule "modules/sl/sl.so"
|
||||
loadmodule "modules/exec/exec.so"
|
||||
|
||||
route {
|
||||
|
||||
log(1, "request received\n");
|
||||
|
||||
if (method=="REGISTER") {
|
||||
log(1, "register received\n");
|
||||
sl_send_reply("200", "ok happy registratiion");
|
||||
break;
|
||||
};
|
||||
|
||||
if (exec_dset('
|
||||
set -x
|
||||
SIP_UID_FROM=`echo $SIP_HF_FROM | sed -e "s/^.*sip:\([a-zA-Z0-9_\.]*\)@.*$/\1/g"`
|
||||
echo sip:$SIP_UID_FROM@vm04.foobar.com
|
||||
echo sip:$SIP_UID_FROM@proxy01.foobar.com
|
||||
echo>/dev/null ')) {
|
||||
log(1, "trying to rewrite\n");
|
||||
sl_send_reply("300", "redirect");
|
||||
} else {
|
||||
sl_send_reply("500", "exec error");
|
||||
log(1, "alas, rewriting failed\n");
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 iptelorg GmbH
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* endianness.h tests
|
||||
* compile/run with:
|
||||
* gcc -Wall endian_test.c ../endianness.c -o endian_test; ./endian_test
|
||||
*/
|
||||
/*
|
||||
* History:
|
||||
* --------
|
||||
* 2008-06-13 created by andrei
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Macro names:
|
||||
* linux: __BYTE_ORDER == __LITTLE_ENDIAN | __BIG_ENDIAN
|
||||
* BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
|
||||
* bsd: _BYTE_ORDER == _LITTLE_ENDIAN | _BIG_ENDIAN
|
||||
* BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
|
||||
* solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
|
||||
*
|
||||
* Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be
|
||||
* used always, some OSes define both of them for BYTE_ORDER use
|
||||
* (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
|
||||
* _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
|
||||
*
|
||||
* is sys/param.h universal ?
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../endianness.h"
|
||||
/*
|
||||
* Tested:
|
||||
* linux: y
|
||||
* freebsd: y
|
||||
* openbsd:
|
||||
* netbsd:
|
||||
* solaris: y
|
||||
* darwin:
|
||||
* cygwin:
|
||||
*
|
||||
* Header files:
|
||||
* linux: <endian.h> , <sys/param.h>
|
||||
* bsd: <sys/param.h> or <sys/endian.h>
|
||||
* solaris: <sys/param.h>
|
||||
* openbsd
|
||||
* netbsd
|
||||
* solaris
|
||||
* cywin
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Macro names:
|
||||
* linux: __BYTE_ORDER == __LITTLE_ENDIAN | __BIG_ENDIAN
|
||||
* BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
|
||||
* bsd: _BYTE_ORDER == _LITTLE_ENDIAN | _BIG_ENDIAN
|
||||
* BYTE_ORDER == LITTLE_ENDIAN | BIG_ENDIAN
|
||||
* solaris: _LITTLE_ENDIAN | _BIG_ENDIAN
|
||||
*
|
||||
* Note: BIG_ENDIAN, LITTLE_ENDIAN, _BIG_ENDIAN, _LITTLE_ENDIAN cannot be
|
||||
* used always, some OSes define both of them for BYTE_ORDER use
|
||||
* (e.g. linux defines both BIG_ENDIAN & LITTLE_ENDIAN, bsds define
|
||||
* _BIG_ENDIAN, _LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN)
|
||||
*
|
||||
* is sys/param.h universal ?
|
||||
*/
|
||||
|
||||
/* test only */
|
||||
#if defined __BYTE_ORDER && defined __LITTLE_ENDIAN
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#warning little endian (via __BYTE_ORDER)
|
||||
#define __BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined __BYTE_ORDER && defined __BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#warning big endian (via __BYTE_ORDER)
|
||||
#define __BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined __BYTE_ORDER && !defined __BYTE_ORDER_FOUND
|
||||
#error __BYTE_ORDER defined, but w/ a strange value
|
||||
#endif
|
||||
|
||||
#if defined _BYTE_ORDER && defined _LITTLE_ENDIAN
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#warning little endian (via _BYTE_ORDER)
|
||||
#define _BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined _BYTE_ORDER && defined _BIG_ENDIAN
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
#warning big endian (via _BYTE_ORDER)
|
||||
#define _BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined _BYTE_ORDER && !defined _BYTE_ORDER_FOUND
|
||||
#error _BYTE_ORDER defined, but w/ a strange value
|
||||
#endif
|
||||
|
||||
#if defined BYTE_ORDER && defined LITTLE_ENDIAN
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#warning little endian (via BYTE_ORDER)
|
||||
#define BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined BYTE_ORDER && defined BIG_ENDIAN
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#warning big endian (via BYTE_ORDER)
|
||||
#define BYTE_ORDER_FOUND
|
||||
#endif
|
||||
#endif
|
||||
#if defined BYTE_ORDER && !defined BYTE_ORDER_FOUND
|
||||
#error BYTE_ORDER defined, but w/ a strange value
|
||||
#endif
|
||||
|
||||
#if defined _LITTLE_ENDIAN
|
||||
#warning _LITTLE_ENDIAN defined
|
||||
#endif
|
||||
#if defined _BIG_ENDIAN
|
||||
#warning _BIG_ENDIAN defined
|
||||
#endif
|
||||
#if defined LITTLE_ENDIAN
|
||||
#warning LITTLE_ENDIAN defined
|
||||
#endif
|
||||
#if defined BIG_ENDIAN
|
||||
#warning BIG_ENDIAN defined
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret=0;
|
||||
if (endianness_sanity_check()!=0){
|
||||
printf("ERROR: sanity checks failed\n");
|
||||
ret=-1;
|
||||
}
|
||||
if (is_little_endian()){
|
||||
#ifdef __IS_LITTLE_ENDIAN
|
||||
printf("OK: little endian confirmed\n");
|
||||
#else
|
||||
printf("ERROR: macro claims BIG ENDIAN, but it's little\n");
|
||||
return -1;
|
||||
#endif
|
||||
}else{
|
||||
#ifdef __IS_BIG_ENDIAN
|
||||
printf("OK: big endian confirmed\n");
|
||||
#else
|
||||
printf("ERROR: macro claims LITTLE ENDIAN, but it's big\n");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 FhG Fokus
|
||||
*
|
||||
* This file is part of ser, a free SIP server.
|
||||
*
|
||||
* ser is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* For a license to use the ser software under conditions
|
||||
* other than those described here, or to purchase support for this
|
||||
* software, please contact iptel.org by e-mail at the following addresses:
|
||||
* info@iptel.org
|
||||
*
|
||||
* ser is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
@ -0,0 +1,33 @@
|
||||
#
|
||||
# configuration for Stress testing
|
||||
#
|
||||
# $ID: $
|
||||
#
|
||||
|
||||
|
||||
debug=3 # debug level (cmd line: -dddddddddd)
|
||||
#fork=yes # (cmd. line: -D)
|
||||
fork=yes
|
||||
fork=no
|
||||
log_stderror=yes # (cmd line: -E)
|
||||
#log_stderror=no # (cmd line: -E)
|
||||
|
||||
|
||||
children=4
|
||||
check_via=no # (cmd. line: -v)
|
||||
dns=off # (cmd. line: -r)
|
||||
rev_dns=off # (cmd. line: -R)
|
||||
#port=5070
|
||||
listen=10.0.0.179
|
||||
#listen=127.0.0.1
|
||||
#listen=192.168.57.33
|
||||
loop_checks=0
|
||||
# for more info: sip_router -h
|
||||
|
||||
#modules
|
||||
|
||||
|
||||
route{
|
||||
#forward(uri:host, uri:port);
|
||||
forward(127.0.0.1, 5090);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# wrapper arroung gcc, that intercepts --version and reports instead
|
||||
# $GCC_VERSION
|
||||
#
|
||||
|
||||
if [ -n "$GCC_VERSION" ]; then
|
||||
for o in $@; do
|
||||
if [ "$o" = "--version" ] ; then
|
||||
echo $GCC_VERSION
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
gcc $@
|
||||
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# test make cfg with all the gcc versions in gcc_versions.txt
|
||||
# should be run from the main sip-router directory
|
||||
# Depends on: test/gcc_version.sh and test/gcc_versions.txt
|
||||
|
||||
if [ ! -e test/gcc_version.sh -o ! -r test/gcc_versions.txt -o ! -r Makefile ]
|
||||
then
|
||||
echo "ERROR: wrong path, this test must be run from the main"\
|
||||
" sip-router directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while read v ; do
|
||||
GCC_VERSION=$v make CC=test/gcc_version.sh cfg-defs >/dev/null
|
||||
if [ $? -ne 0 -o ! -r config.mak ]; then
|
||||
echo "ERROR: make cfg failed for version \"$v\""
|
||||
exit 1
|
||||
fi
|
||||
COMPILER=`egrep -o -- "-DCOMPILER='\"[^\"' ]+ [2-9]\.[0-9]{1,2}(\.[0-9]{1,2})?\"'" config.mak`
|
||||
if [ $? -ne 0 -o -z "$COMPILER" ]; then
|
||||
echo "ERROR: bad ver: \"$v\" => `egrep -o -- "-DCOMPILER='[^']*'" config.mak`"
|
||||
exit 1
|
||||
fi
|
||||
echo "ok: \"$v\" => $COMPILER"
|
||||
done < test/gcc_versions.txt
|
||||
@ -0,0 +1,25 @@
|
||||
2.7.1
|
||||
2.8.1
|
||||
egcs-2.91.66
|
||||
2.95.3
|
||||
2.95.4
|
||||
3.0.4
|
||||
gcc (GCC) 3.2
|
||||
gcc-3.2 (GCC) 3.2.3 (Debian)
|
||||
gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1809)
|
||||
gcc (GCC) 3.3.3 (NetBSD nb3 20040520)
|
||||
gcc (GCC) 3.3.5 (propolice)
|
||||
gcc-3.3 (GCC) 3.3.5 (Debian 1:3.3.5-6)
|
||||
gcc-3.3 (GCC) 3.3.5 (Debian 1:3.3.5-13)
|
||||
gcc (GCC) 3.4.2 [FreeBSD] 20040728
|
||||
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
|
||||
gcc-3.4 (GCC) 3.4.4 20041218 (prerelease) (Debian 3.4.3-7)
|
||||
powerpc-apple-darwin8-gcc-3.5.0 (GCC) 3.5.0 20041026 (Apple Computer, Inc. build 4059)
|
||||
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer, Inc. build 4061)
|
||||
gcc-4.0 (GCC) 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)
|
||||
gcc-4.0 (GCC) 4.0.4 20060904 (prerelease) (Debian 4.0.3-7)
|
||||
gcc-4.0.1 (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
|
||||
gcc-4.1 (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)
|
||||
gcc-4.2 (GCC) 4.2.4 (Debian 4.2.4-6)
|
||||
gcc-4.3 (Debian 4.3.3-8) 4.3.3
|
||||
gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]
|
||||
@ -0,0 +1,43 @@
|
||||
#
|
||||
# configuration for Stress testing
|
||||
#
|
||||
# $ID: $
|
||||
#
|
||||
|
||||
|
||||
debug=9 # debug level (cmd line: -dddddddddd)
|
||||
#fork=yes # (cmd. line: -D)
|
||||
fork=no
|
||||
log_stderror=yes # (cmd line: -E)
|
||||
#log_stderror=no # (cmd line: -E)
|
||||
|
||||
|
||||
children=4
|
||||
check_via=no # (cmd. line: -v)
|
||||
dns=off # (cmd. line: -r)
|
||||
rev_dns=off # (cmd. line: -R)
|
||||
#port=5070
|
||||
#listen=10.0.0.179
|
||||
#listen=192.168.57.33
|
||||
loop_checks=0
|
||||
# for more info: sip_router -h
|
||||
|
||||
#modules
|
||||
#loadmodule "modules/print/print.so"
|
||||
loadmodule "modules/textops/textops.so"
|
||||
loadmodule "modules/tm/tm.so"
|
||||
loadmodule "modules/maxfwd/maxfwd.so"
|
||||
loadmodule "modules/sl/sl.so"
|
||||
|
||||
|
||||
route{
|
||||
sl_filter_ACK();
|
||||
|
||||
if ( !mf_process_maxfwd_header("10") )
|
||||
{
|
||||
sl_send_reply("483","To Many Hops");
|
||||
drop();
|
||||
};
|
||||
|
||||
t_relay();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in `find . -name '*.[hc]'` ; do
|
||||
mv $i $i.pregpl
|
||||
awk -f test/gplize.awk $i.pregpl > $i
|
||||
done
|
||||
@ -0,0 +1,62 @@
|
||||
# add copyright banner after the first comment
|
||||
#
|
||||
# text taken from file_copyright.txt
|
||||
|
||||
BEGIN {
|
||||
status=0;
|
||||
}
|
||||
|
||||
|
||||
status==1 {
|
||||
print
|
||||
next
|
||||
}
|
||||
|
||||
# end of comment not encountered yet
|
||||
|
||||
{ comment_begin=0 }
|
||||
|
||||
/\/\*/ { comment_begin=1; }
|
||||
|
||||
|
||||
/\*\// {
|
||||
status=1
|
||||
# if it was a one-line comment print it and start a new comment
|
||||
if (comment_begin==1) {
|
||||
print
|
||||
print "/*"
|
||||
}
|
||||
|
||||
print " *"
|
||||
print " * Copyright (C) 2001-2004 FhG Fokus"
|
||||
print " *"
|
||||
print " * This file is part of ser, a free SIP server."
|
||||
print " *"
|
||||
print " * ser is free software; you can redistribute it and/or modify"
|
||||
print " * it under the terms of the GNU General Public License as published by"
|
||||
print " * the Free Software Foundation; either version 2 of the License, or"
|
||||
print " * (at your option) any later version"
|
||||
print " *"
|
||||
print " * For a license to use the ser software under conditions"
|
||||
print " * other than those described here, or to purchase support for this"
|
||||
print " * software, please contact iptel.org by e-mail at the following addresses:"
|
||||
print " * info@iptel.org"
|
||||
print " *"
|
||||
print " * ser is distributed in the hope that it will be useful,"
|
||||
print " * but WITHOUT ANY WARRANTY; without even the implied warranty of"
|
||||
print " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
|
||||
print " * GNU General Public License for more details."
|
||||
print " *"
|
||||
print " * You should have received a copy of the GNU General Public License "
|
||||
print " * along with this program; if not, write to the Free Software "
|
||||
print " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
|
||||
print " */"
|
||||
print ""
|
||||
|
||||
# don't print the original end of comment
|
||||
next
|
||||
}
|
||||
|
||||
# end of comment not encountered yet -- print the line
|
||||
|
||||
{ print }
|
||||
@ -0,0 +1,21 @@
|
||||
INVITE sip:andrei@mobile69 SIP/2.0
|
||||
Via: SIP/2.0/UDP dorian.fokus.gmd.de
|
||||
From: "test" <sip:andrei@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 INVITE
|
||||
Expires: 180
|
||||
Max-Forwards: 0
|
||||
User-Agent: testing lookups
|
||||
Accept: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7170@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100:5040; rport
|
||||
Max-Forwards: 10
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: d10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7271@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100:5040
|
||||
Max-Forwards: 10
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: d10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 452
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7271@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.99:5040
|
||||
Max-Forwards: 1
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: r10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7271@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100:5040
|
||||
Max-Forwards: 3
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: r10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7170@bat.iptel.org:9 SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100:5040
|
||||
Max-Forwards: 1
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: r10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,33 @@
|
||||
INVITE sip:7170@bat.iptel.org:9 SIP/2.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100:5040
|
||||
Max-Forwards: 1
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: r10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,23 @@
|
||||
INVITE sip:p2@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 192.168.99.100:5040
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 INVITE
|
||||
Expires: 180
|
||||
Max-Forwards: 0
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 218
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,23 @@
|
||||
INVITE sip:p2@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 193.175.133.193
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
To: <sip:p2@iptel.org>
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 INVITE
|
||||
Expires: 180
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,23 @@
|
||||
INVITE sip:p2@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 193.175.133.193
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
To: <sip:p2@iptel.org>
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq:101
|
||||
Expires: 180
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,23 @@
|
||||
INVITE sip:p2@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 193.175.133.193
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
To: <sip:p2@iptel.org>
|
||||
Call-ID; b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 INVITE
|
||||
Expires: 180
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,23 @@
|
||||
INVITE sip:p2@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP 193.175.133.193;branch=
|
||||
From: "GMD FOKUS iptlab" <sip:jiri@iptel.org>;tag=b96b0300ed30f1286-2f5d
|
||||
To: <sip:p2@iptel.org>
|
||||
Call-ID: b96b0300-88d30f-66da-63aa@195.37.78.190
|
||||
CSeq: 101 INVITE
|
||||
Expires: 180
|
||||
User-Agent: Cisco-SIP-IP-Phone/2
|
||||
Accept: application/sdp
|
||||
Contact: sip:jiri@195.37.78.190:5060
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 225
|
||||
|
||||
|
||||
v=0
|
||||
o=CiscoSystemsSIP-IPPhone-UserAgent 14474 8233 IN IP4 195.37.78.190
|
||||
s=SIP Call
|
||||
c=IN IP4 195.37.78.190
|
||||
t=0 0
|
||||
m=audio 18456 RTP/AVP 0 8 18 101
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-11
|
||||
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* simple locking test program
|
||||
* (no paralles stuff)
|
||||
*
|
||||
* Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
|
||||
* gcc -mips2 -O2 -D__CPU_mips2 on mips machines.
|
||||
* -- andrei
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../fastlock.h"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
fl_lock_t lock;
|
||||
int r;
|
||||
|
||||
lock=0;
|
||||
printf("starting locking basic tests...\n");
|
||||
|
||||
r=try_lock(&lock);
|
||||
printf(" try_lock should return 0 ... %d\n", r);
|
||||
printf(" lock should be 1 now ... %d\n", lock);
|
||||
r=try_lock(&lock);
|
||||
printf(" tsl should return -1 ... %d\n", r);
|
||||
printf(" lock should still be 1 now ... %d\n", lock);
|
||||
release_lock(&lock);
|
||||
printf(" release_lock: lock should be 0 now ... %d\n", lock);
|
||||
printf("try_lock once more...\n");
|
||||
r=try_lock(&lock);
|
||||
printf(" try_lock should return 0 ... %d\n", r);
|
||||
printf(" lock should be 1 now ... %d\n", lock);
|
||||
release_lock(&lock);
|
||||
get_lock(&lock);
|
||||
printf(" get_lock, lock should be 1 now ... %d\n", lock);
|
||||
printf("\ndone.\n");
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
NAME=locking_test
|
||||
|
||||
CC=gcc
|
||||
CFLAGS= -O2 -Wall
|
||||
DEFS=
|
||||
LIBS=
|
||||
INCLUDE=
|
||||
PTHREAD_LIBS= -lpthread
|
||||
|
||||
OS = $(shell uname -s)
|
||||
|
||||
|
||||
ifeq ($(OS), SunOS)
|
||||
LIBS+= -lrt
|
||||
CFLAGS+=-mv8 -Wa,-xarch=v8plus
|
||||
PTHREAD_LIBS= -lpthread
|
||||
endif
|
||||
ifeq ($(OS), FreeBSD)
|
||||
PTHREAD_LIBS= -lc_r
|
||||
endif
|
||||
|
||||
$(NAME): $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DNO_LOCK -o $@ $< $(LIBS)
|
||||
|
||||
|
||||
$(NAME)_sysv: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DSYSV_SEM -o $@ $(INCLUDE) $< $(LIBS)
|
||||
|
||||
|
||||
$(NAME)_flock: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DFLOCK -o $@ $(INCLUDE) $< $(LIBS)
|
||||
|
||||
$(NAME)_posix: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DPOSIX_SEM -o $@ $(INCLUDE) $< $(LIBS) \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
$(NAME)_pmutex: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DPTHREAD_MUTEX -o $@ $(INCLUDE) $< $(LIBS) \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
$(NAME)_fastlock: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DFAST_LOCK -o $@ $(INCLUDE) $< $(LIBS)
|
||||
|
||||
$(NAME)_futex: $(NAME).c
|
||||
gcc $(CFLAGS) $(DEFS) -DFUTEX -o $@ $(INCLUDE) $< $(LIBS)
|
||||
|
||||
all: $(NAME) $(NAME)_sysv $(NAME)_posix $(NAME)_pmutex \
|
||||
$(NAME)_fastlock
|
||||
|
||||
ifneq ($(OS), SunOS)
|
||||
|
||||
all: $(NAME)_flock
|
||||
|
||||
endif
|
||||
|
||||
clean:
|
||||
-@rm $(NAME) $(NAME)_sysv $(NAME)_flock $(NAME)_posix \
|
||||
$(NAME)_pmutex $(NAME)_fastlock
|
||||
@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
nolock flock sysv posix pmutex fastl
|
||||
|
||||
Linux 2* Athlon 1200, 2.4.16:
|
||||
real 0.044/ 14.713 9.330 2.670 1.730 0.400
|
||||
user 0.040 2.610 2.950 2.670 1.720 0.400
|
||||
sys 0.000 12.110 6.370 0.000 0.010 0.000
|
||||
* 1 334.386 212.045 60.681 39.318 9.090
|
||||
|
||||
Linux 2*PIII, 2.4.17:
|
||||
real 0.056 17.771 14.476 3.099 1.902 0.603
|
||||
user 0.050 4.130 5.120 3.100 1.900 0.600
|
||||
sys 0.000 13.650 9.350 0.000 0.000 0.000
|
||||
* 1 317.339 258.500 55.339 33.964 10.767
|
||||
|
||||
Solaris 8:
|
||||
real 0.105 n/a 48.490 27.492 3.602 1.284
|
||||
user 0.090 n/a 29.330 27.410 3.590 1.270
|
||||
sys 0.010 n/a 19.110 0.010 0.010 0.020
|
||||
* 1 n/a 461.809 257.142 34.304 12.228
|
||||
|
||||
FreeBSD, PII 333:
|
||||
real: 0.147 43.952 54.428 37.385 15.706 1.863
|
||||
user: 0.121 12.761 13.131 31.958 13.402 1.606
|
||||
sys: 0.001 25.149 33.732 0.017 0.017 0.001
|
||||
* 1 299.061 370.258 254.319 106.843 12.673
|
||||
|
||||
|
||||
nolock= no locking, just a loop
|
||||
flock= using flock
|
||||
sysv = using SYSV semaphores
|
||||
posix = using POSIX1003.1b semaphores (sem_wait, sem_post)
|
||||
pmutex = using pthread_mutex*
|
||||
fastl = using fastlock.h from ser (hand made assembler locks)
|
||||
|
||||
Test: time ./locking_test* -c 10000000
|
||||
(sip_router/test/locking/*)
|
||||
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
INVITE sip:jiri@bat.iptel.org SIP/2.0
|
||||
Max-Forwards: 10
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=1848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=2848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=3848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=8848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=9848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=5848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=6848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=7848eaf6f622ebaf1762f34e5d08ec2e.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=b03d645a795fe2572631dbe15438fabd.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=59c7c421d731de1ce1e1e4c6e83150f2.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=3b33b0d029964ec5330922ff50b34c79.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=781aa36a12b7b99b2316a8ed32123fc9.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=a93680d322702022416a5a661aaf573d.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=5a94858405aeaae679632efed7e1ff0b.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=70509dba8d202a0116d2e51cd474a1d4.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=7056d40a2cfa30ff299705fc791f4303.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=ac7cf460ba831233121eead26af76d5a.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=2c4d2ac0b10115c704d28c2b360bcb6f.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=e0282bc88aed37191911cbb5ded27379.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=c7d6a97d4b6762877410653db5643775.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=a0c4944760b9f9693209f719e7aa177c.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=4147b5297bc5a8e0c3ec58fe6fd9bf6c.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=557cfe12fa9372a0a309ffebcdef3110.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.100;branch=ce741cd8b427d1722d4f746922a9d3a2.836.0
|
||||
Via: SIP/2.0/UDP 195.37.77.101;branch=838cccacb7d33e12c5e097f9090adfe1.836.0
|
||||
Via: SIP/2.0/UDP 213.20.128.35:9315
|
||||
From: "jiri" <sip:jiri@iptel.org>;tag=76ff7a07-c091-4192-84a0-d56e91fe104f
|
||||
To: <sip:jiri@bat.iptel.org>
|
||||
Call-ID: d10815e0-bf17-4afa-8412-d9130a793d96@213.20.128.35
|
||||
CSeq: 2 INVITE
|
||||
Contact: <sip:213.20.128.35:9315>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Proxy-Authorization: Digest username="jiri", realm="iptel.org", algorithm="MD5", uri="sip:jiri@bat.iptel.org", nonce="3cef753900000001771328f5ae1b8b7f0d742da1feb5753c", response="53fe98db10e1074b03b3e06438bda70f"
|
||||
Content-Type: application/sdp
|
||||
Content-Length: 451
|
||||
|
||||
v=0
|
||||
o=jku2 0 0 IN IP4 213.20.128.35
|
||||
s=session
|
||||
c=IN IP4 213.20.128.35
|
||||
b=CT:1000
|
||||
t=0 0
|
||||
m=audio 54742 RTP/AVP 97 111 112 6 0 8 4 5 3 101
|
||||
a=rtpmap:97 red/8000
|
||||
a=rtpmap:111 SIREN/16000
|
||||
a=fmtp:111 bitrate=16000
|
||||
a=rtpmap:112 G7221/16000
|
||||
a=fmtp:112 bitrate=24000
|
||||
a=rtpmap:6 DVI4/16000
|
||||
a=rtpmap:0 PCMU/8000
|
||||
a=rtpmap:8 PCMA/8000
|
||||
a=rtpmap:4 G723/8000
|
||||
a=rtpmap:5 DVI4/8000
|
||||
a=rtpmap: 3 GSM/8000
|
||||
a=rtpmap:101 telephone-event/8000
|
||||
a=fmtp:101 0-16
|
||||
@ -0,0 +1,11 @@
|
||||
MESSAGE sip:01756843@sms.iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP fesarius.fokus.gmd.de:5000
|
||||
From: "bogdan" <sip:bogdan@iptel.org>;tag=0e99b1e7-ff50-4875-94ef-4ca5c27e2705
|
||||
To: sip:cucu@sms.iptel.org;cucu=bau;tag=xyz
|
||||
Call-ID: 02b1191c-447e-4bd0-b771-c039fc0d9d84@195.37.78.169
|
||||
CSeq: 7 MESSAGE
|
||||
Contact: <sip:195.37.78.169:11457>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Content-Type: text/plain
|
||||
Content-Length: 4
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
MESSAGE sip:756843@iptel.org SIP/2.0
|
||||
Via: SIP/2.0/UDP bat.iptel.org:9
|
||||
From: "bogdan" <sip:bogdan@iptel.org>;tag=0e99b1e7-ff50-4875-94ef-4ca5c27e2705
|
||||
xCall-ID: 02b1191c-447e-4bd0-b771-c039fc0d9d84@195.37.78.169
|
||||
CSeq: 7 MESSAGE
|
||||
Contact: <sip:195.37.78.169:11457>
|
||||
User-Agent: Windows RTC/1.0
|
||||
text/plain
|
||||
Content-Length: 4
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
MESSAGE sip:+49160567535@fesarius.fokus.gmd.de SIP/2.0
|
||||
Via: SIP/2.0/UDP fesarius.fokus.gmde.de:9
|
||||
From: sip:bogdan@fesarius.fokus.gmd.de;tag=16df4fe56e8782ecaa5d53ae36fb9240
|
||||
To: sip:dcm@fesarius.fokus.gmd.de
|
||||
Call-ID: 02b1191c-447e-4bd0-b771-c039fc0d9d84@195.37.78.169
|
||||
CSeq: 7 MESSAGE
|
||||
Contact: <sip:195.37.78.169:11457>
|
||||
User-Agent: Windows RTC/1.0
|
||||
Content-Type: text/plain
|
||||
Content-Length: 13
|
||||
|
||||
cucu
|
||||
bau
|
||||
miau
|
||||
@ -0,0 +1,97 @@
|
||||
/*
|
||||
*
|
||||
* simple locking test program
|
||||
* (no paralles stuff)
|
||||
*
|
||||
* Compile with: gcc -D__CPU_i386 -O3 on x86 machines and
|
||||
* gcc -mips2 -O2 -D__CPU_mips on mips machines.
|
||||
* -- andrei
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef volatile int fl_lock_t;
|
||||
|
||||
|
||||
|
||||
int tsl(fl_lock_t* lock)
|
||||
{
|
||||
long val;
|
||||
|
||||
#ifdef __CPU_mips
|
||||
long tmp=0;
|
||||
|
||||
asm volatile(
|
||||
".set noreorder\n\t"
|
||||
"1: ll %1, %2 \n\t"
|
||||
" li %0, 1 \n\t"
|
||||
" sc %0, %2 \n\t"
|
||||
" beqz %0, 1b \n\t"
|
||||
" nop \n\t"
|
||||
".set reorder\n\t"
|
||||
: "=&r" (tmp), "=&r" (val), "=m" (*lock)
|
||||
: "0" (tmp), "m" (*lock)
|
||||
: "cc"
|
||||
);
|
||||
#elif defined __CPU_i386
|
||||
val=1;
|
||||
asm volatile(
|
||||
" xchg %b1, %0" : "=q" (val), "=m" (*lock) : "0" (val)
|
||||
);
|
||||
#else
|
||||
#error "cpu type not defined, add -D__CPU_<type> when compiling"
|
||||
#endif
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void release_lock(fl_lock_t* lock)
|
||||
{
|
||||
#ifdef __CPU_mips
|
||||
int tmp;
|
||||
tmp=0;
|
||||
asm volatile(
|
||||
".set noreorder \n\t"
|
||||
" sync \n\t"
|
||||
" sw $0, %0 \n\t"
|
||||
".set reorder \n\t"
|
||||
: /*no output*/ : "m" (*lock) : "memory"
|
||||
);
|
||||
#elif defined __CPU_i386
|
||||
asm volatile(
|
||||
" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
|
||||
);
|
||||
#else
|
||||
#error "cpu type not defined, add -D__CPU_<type> when compiling"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
fl_lock_t lock;
|
||||
int r;
|
||||
|
||||
lock=0;
|
||||
printf("starting locking basic tests...\n");
|
||||
|
||||
r=tsl(&lock);
|
||||
printf(" tsl should return 0 ... %d\n", r);
|
||||
printf(" lock should be 1 now ... %d\n", lock);
|
||||
r=tsl(&lock);
|
||||
printf(" tsl should return 1 ... %d\n", r);
|
||||
printf(" lock should still be 1 now ... %d\n", lock);
|
||||
release_lock(&lock);
|
||||
printf(" release_lock: lock should be 0 now ... %d\n", lock);
|
||||
printf("trying tsl once more...\n");
|
||||
r=tsl(&lock);
|
||||
printf(" tsl should return 0 ... %d\n", r);
|
||||
printf(" lock should be 1 now ... %d\n", lock);
|
||||
printf("\ndone.\n");
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
route{
|
||||
|
||||
(src_ip=~'(dorian)|(ekina)|(terix)' & method=~'^inv') \
|
||||
forward(centauri.fokus.gmd.de);
|
||||
src_ip=~"^192\.168\.[0-9]{1,3}\.[0-9]{1,3}$" \
|
||||
log(1,"msg. from a private network\n"); route(1);
|
||||
src_ip==0.0.0.0/0 log(1, " droping msg\n"); drop;
|
||||
}
|
||||
|
||||
route[1]{
|
||||
src_ip==192.168.46.61 log("possible loop, dropping\n"); drop;
|
||||
(src_ip==192.168.46.0/24) log("routing with rt2\n");route(2); log("we're back\n");
|
||||
src_ip==0.0.0.0/0 log(1, "we'll drop this one too\n"); drop;
|
||||
}
|
||||
|
||||
route[2]{
|
||||
(method=~'^ACK' and uri=~'.*fokus') forward("fox.iptel.org");
|
||||
! method=~'^INV' forward(193.175.135.179); /* dorian */
|
||||
method=~'.' log("spying...\n"); send(dorian,8000); \
|
||||
forward("fox.iptel.org");
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
|
||||
|
||||
1 linux-i386/gcc2.95
|
||||
2 linux-i386/gcc3.3
|
||||
3 linux-i386/icc
|
||||
4 freebsd_4.5-i386/gcc
|
||||
5 freebsd_5.0-i386/gcc3.2
|
||||
6 openbsd_3.1-i386/gcc
|
||||
7 netbsd_1.6-ultrasparc/gcc
|
||||
8 solaris_8.0-ultrasparc/gcc
|
||||
9 solaris_8.0-ultrasparc/sun cc 5.3
|
||||
|
||||
W - warnings
|
||||
E - errors
|
||||
I - could not compile due to missing includes
|
||||
L - could not compile due to missing libraries
|
||||
l - locking problems
|
||||
o - ok
|
||||
|
||||
P - possible proto problems (tcp)
|
||||
D - dead/not finished
|
||||
|
||||
checked:
|
||||
7 - 2003-05-06
|
||||
8 - 2003-05-09
|
||||
1-4 2003-05-23
|
||||
6 - 2003-05-23
|
||||
5 - 2003-05-26
|
||||
|
||||
|
||||
module_name 1 2 3 4 5 6 7 8 9
|
||||
core o o o o o o o o
|
||||
acc o I I I o* o* I I I
|
||||
auth o o o o o o o o o
|
||||
auth_db o o o o o o o o o
|
||||
auth_radius o I I I I I I I I
|
||||
cpl P o o o o o o o o o
|
||||
cpl-c D I I I I I I I I I
|
||||
dbtext o o o o o o o o o
|
||||
domain o o o o o o o o o
|
||||
enum o o o o o o o o o
|
||||
exec o o o o o o o o o
|
||||
ext o o o o o o o o o
|
||||
extcmd o o o o o o o o o
|
||||
group o o o o o o o o o
|
||||
group_radius W I I I I I I I I
|
||||
jabber o o o o o o o W+ W
|
||||
mangler o o o o o o o o o
|
||||
maxfwd o o o o o o o o o
|
||||
msilo o o o o o o o o o
|
||||
mysql o o o o I o o o o
|
||||
nathelper o o o o o o o o o
|
||||
pa o o o o o o o o o
|
||||
pdt o o o o o o o o o
|
||||
persmissions o o o o o o o o o
|
||||
pike o o o o o o o o o
|
||||
postgress I I I I I I I I I
|
||||
print o o o o o o o o o
|
||||
registrar o o o o o o o o o
|
||||
rr o o o o o o o o o
|
||||
sl o o o o o o o o o
|
||||
sms o o o o o o o o o
|
||||
snmp D I I I I I I I I I
|
||||
textops o o o o o o o o o
|
||||
tm o o o o o o o o o
|
||||
uri o o o o o o o o o
|
||||
uri_radius o I I I I I I I I
|
||||
usrloc o o o o o o o o o
|
||||
vm o o o o o o o o o
|
||||
|
||||
|
||||
[*] - w/o radius & mysql
|
||||
[+] - -I warning (bad cpp?)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue