Commit 2a943d1b authored by Pekka Pessi's avatar Pekka Pessi

Added --enable-experimental command line option to ./configure script.

If --enable-experimental is given, #define SU_HAVE_EXPERIMENTAL as 1 in
<sofia-sip/su_configure.h>. The SU_HAVE_EXPERIMENTAL is used to enable
experimental features (currently including suppression of extra NOTIFYs and
NOTIFY bodies as specified in draft-niemi-sip-subnot-etag-01).

darcs-hash:20070202173259-65a35-b720bc2c5f7bc82f21fc21660966f5a7612a262c.gz
parent ec53c026
......@@ -45,4 +45,5 @@ ALIASES = \
"VERSION_1_12_4=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.4.txt\">1.12.4</a>" \
"VERSION_1_12_5=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
"NEW_1_12_5=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>" \
"EXP_1_12_5=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.5.txt\">1.12.5</a>, available if --enable-experimental configuration option is given" \
......@@ -54,11 +54,13 @@ BEGIN {
split("", NAMES);
split("", Comments);
split("", COMMENTS);
split("", experimental);
# indexed by the C name of the header
split("", Since); # Non-NUL if extra
split("", Extra); # Offset in extra headers
without_experimental = 0;
template="";
template1="";
template2="";
......@@ -155,11 +157,24 @@ function protos (name, comment, hash, since)
Extra[name] = extra++;
}
expr = (without_experimental > 0 && do_hash);
if (without_experimental > 0) {
printf "%s is %sexperimental\n", Comment, expr ? "" : "not ";
}
experimental[N] = expr;
if (PR) {
if (expr) {
print "#if SU_HAVE_EXPERIMENTAL" > PR;
}
replace(template, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template1, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template2, hash, name, NAME, comment, Comment, COMMENT, since);
replace(template3, hash, name, NAME, comment, Comment, COMMENT, since);
if (expr) {
print "#endif /* SU_HAVE_EXPERIMENTAL */" > PR;
}
}
}
......@@ -210,8 +225,19 @@ function process_footer (text)
for (i = 1; i <= n; i++) {
l = lines[i];
if (match(tolower(l), /#(xxxxxx(x_xxxxxxx)?|hash)#/)) {
expr = 0;
for (j = 1; j <= N; j++) {
l = lines[i];
if (expr != experimental[j]) {
expr = experimental[j];
if (expr) {
print "#if SU_HAVE_EXPERIMENTAL" > PR;
}
else {
print "#endif" > PR;
}
}
gsub(/#hash#/, hashes[j], l);
gsub(/#xxxxxxx_xxxxxxx#/, comments[j], l);
gsub(/#Xxxxxxx_Xxxxxxx#/, Comments[j], l);
......@@ -220,6 +246,10 @@ function process_footer (text)
gsub(/#XXXXXX#/, NAMES[j], l);
print l > PR;
}
if (expr) {
print "#endif" > PR;
}
} else {
print l > PR;
}
......@@ -333,10 +363,11 @@ function templates ()
}
/^#### EXTRA HEADER LIST STARTS HERE ####$/ { HLIST=1; templates(); }
HLIST && /^#### EXPERIMENTAL HEADER LIST STARTS HERE ####$/ {
without_experimental=total; }
HLIST && /^[a-z]/ { protos($1, $0, 0, $2); headers[total++] = $1; }
/^#### EXTRA HEADER LIST ENDS HERE ####$/ { HLIST=0; }
/^ *\/\* === Headers start here \*\// { in_header_list=1; templates(); }
/^ *\/\* === Headers end here \*\// { in_header_list=0; }
......@@ -366,10 +397,13 @@ in_header_list && /^ (sip|rtsp|http|msg|mp)_[a-z_0-9]+_t/ {
END {
if (failed) { exit };
if (without_experimental == 0)
without_experimental = total;
if (!NO_LAST) {
protos("unknown", "/**< Unknown headers */", -3);
protos("error", "/**< Erroneous headers */", -4);
protos("separator", "/**< Separator line between headers and payload */", -5);
protos("separator", "/**< Separator line between headers and body */", -5);
protos("payload", "/**< Message payload */", -6);
if (multipart)
protos("multipart", "/**< Multipart payload */", -7);
......@@ -426,7 +460,16 @@ END {
if (extra > 0) {
printf("struct %s {\n", extra_struct) > PT;
printf(" %s base;\n", module_struct) > PT;
printf(" msg_header_t *extra[%u];\n", extra) > PT;
if (total - without_experimental < extra) {
printf(" msg_header_t *extra[%u];\n",
extra - (total - without_experimental)) > PT;
}
if (total - without_experimental > 0) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
printf(" msg_header_t *extra[%u];\n",
total - without_experimental) > PT;
print "#endif" > PT;
}
printf("};\n\n") > PT;
module_struct = "struct " extra_struct;
}
......@@ -465,7 +508,13 @@ END {
else {
printf(" NULL, \n") > PT;
}
printf(" %d, %d, \n", MC_HASH_SIZE, total) > PT;
printf(" %d, \n", MC_HASH_SIZE) > PT;
printf ("#if SU_HAVE_EXPERIMENTAL\n" \
" %d,\n" \
"#else\n" \
" %d,\n" \
"#endif\n", \
total, without_experimental) > PT;
printf(" {\n") > PT;
for (i = 0; i < total; i++) {
......@@ -484,6 +533,7 @@ END {
}
header_hash[j] = n;
experimental2[j] = (i >= without_experimental);
}
for (i = 0; i < MC_HASH_SIZE; i++) {
......@@ -492,14 +542,23 @@ END {
n = header_hash[i];
flags = header_flags[n]; if (flags) flags = ",\n " flags;
if (experimental2[i]) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
}
if (Since[n]) {
printf(" { %s_%s_class, offsetof(struct %s, extra[%u])%s }%s\n",
printf(" { %s_%s_class,\n" \
" offsetof(struct %s, extra[%u])%s }%s\n",
tprefix, n, extra_struct, Extra[n], flags, c) > PT;
}
else {
printf(" { %s_%s_class, offsetof(%s_t, %s_%s)%s }%s\n",
tprefix, n, module, prefix, n, flags, c) > PT;
}
if (experimental2[i]) {
printf("#else\n { NULL, 0 }%s\n#endif\n", c) > PT;
}
}
else {
printf(" { NULL, 0 }%s\n", c) > PT;
......
......@@ -61,10 +61,12 @@ struct notifier_usage
enum nua_substate nu_substate; /**< Subscription state */
sip_time_t nu_expires; /**< Expiration time */
sip_time_t nu_requested; /**< Requested expiration time */
#if SU_HAVE_EXPERIMENTAL
char *nu_tag; /**< @ETag in last NOTIFY */
unsigned nu_etags:1; /**< Subscriber supports etags */
unsigned nu_appl_etags:1; /**< Application generates etags */
unsigned nu_no_body:1; /**< Suppress body */
#endif
};
static char const *nua_notify_usage_name(nua_dialog_usage_t const *du);
......@@ -243,11 +245,13 @@ int nua_subscribe_server_preprocess(nua_server_request_t *sr)
expires = sip->sip_expires->ex_delta;
nu->nu_requested = sip_now() + expires;
#if SU_HAVE_EXPERIMENTAL
nu->nu_etags =
sip_suppress_body_if_match(sip) ||
sip_suppress_notify_if_match(sip) ||
sip_has_feature(sr->sr_request.sip->sip_supported, "etags");
#endif
sr->sr_usage = du;
return sr->sr_status <= 100 ? 0 : sr->sr_status;
......@@ -309,6 +313,7 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
/* nu_requested is set by SUBSCRIBE and cleared when NOTIFY is sent */
if (nu && nu->nu_requested && substate != nua_substate_embryonic) {
#if SU_HAVE_EXPERIMENTAL
sip_t const *sip = sr->sr_request.sip;
sip_suppress_notify_if_match_t *snim = sip_suppress_notify_if_match(sip);
sip_suppress_body_if_match_t *sbim = sip_suppress_body_if_match(sip);
......@@ -320,6 +325,7 @@ int nua_subscribe_server_report(nua_server_request_t *sr, tagi_t const *tags)
else if (sbim && !strcasecmp(snim->snim_tag, nu->nu_tag))
notify = 1, nu->nu_no_body = 1;
else
#endif
notify = 1;
}
......@@ -499,6 +505,7 @@ static int nua_notify_client_init_etag(nua_client_request_t *cr,
msg_t *msg, sip_t *sip,
tagi_t const *tags)
{
#if SU_HAVE_EXPERIMENTAL
nua_handle_t *nh = cr->cr_owner;
struct notifier_usage *nu = nua_dialog_usage_private(cr->cr_usage);
nua_server_request_t *sr;
......@@ -563,6 +570,7 @@ static int nua_notify_client_init_etag(nua_client_request_t *cr,
if (sbim && !strcasecmp(sbim->sbim_tag, nu->nu_tag))
nu->nu_no_body = 1;
}
#endif
return 0;
}
......@@ -613,6 +621,7 @@ int nua_notify_client_request(nua_client_request_t *cr,
msg_header_replace_param(home, ss->ss_common, expires);
}
#if SU_HAVE_EXPERIMENTAL
if (nu->nu_tag && !sip->sip_etag)
msg_header_add_make(msg, (void *)sip, sip_etag_class, nu->nu_tag);
......@@ -621,6 +630,7 @@ int nua_notify_client_request(nua_client_request_t *cr,
msg_header_remove(msg, (void *)sip, (void *)sip->sip_payload);
msg_header_remove(msg, (void *)sip, (void *)sip->sip_content_length);
}
#endif
if (nu->nu_substate == nua_substate_terminated)
cr->cr_terminating = 1;
......
......@@ -757,6 +757,8 @@ char *sip_info_dup_one(sip_header_t *dst,
/* ====================================================================== */
#if SU_HAVE_EXPERIMENTAL
/**@SIP_HEADER sip_suppress_body_if_match Suppress-Body-If-Match Header
*
* The @b Suppress-Body-If-Match header field identifies a SIP event content
......@@ -773,7 +775,7 @@ char *sip_info_dup_one(sip_header_t *dst,
*
* @sa @RFC3265, draft-niemi-sip-subnot-etags-01.txt
*
* @NEW_1_12_5. Note that #sip_t does not contain @a
* @EXP_1_12_5. Note that #sip_t does not contain @a
* sip_suppress_body_if_match field, but sip_suppress_body_if_match()
* function should be used for accessing the @b Suppress-Body-If-Match
* header structure.
......@@ -839,7 +841,7 @@ issize_t sip_suppress_body_if_match_e(char b[], isize_t bsiz,
*
* @sa @RFC3265, draft-niemi-sip-subnot-etag-01
*
* @NEW_1_12_5. Note that #sip_t does not contain @a
* @EXP_1_12_5. Note that #sip_t does not contain @a
* sip_suppress_notify_if_match field, but sip_suppress_notify_if_match()
* function should be used for accessing the @b Suppress-Notify-If-Match
* header structure.
......@@ -887,4 +889,4 @@ issize_t sip_suppress_notify_if_match_e(char b[], isize_t bsiz,
return msg_generic_e(b, bsiz, h, f);
}
#endif
......@@ -4,10 +4,15 @@
# The line format is:
# C-name @SINCE sip_t-like-comment
#
# Put all experimental things after EXPERIMENTAL HEADER LIST STARTS HERE...
#
#### EXTRA HEADER LIST STARTS HERE ####
refer_sub @VERSION_1_12_5 /**< Refer-Sub header */
suppress_body_if_match @VERSION_1_12_5 /**< Suppress-Body-If-Match header */
suppress_notify_if_match @VERSION_1_12_5 /**< Suppress-Notify-If-Match header*/
refer_sub @NEW_1_12_5 /**< Refer-Sub header */
#### EXPERIMENTAL HEADER LIST STARTS HERE ####
suppress_body_if_match @EXP_1_12_5 /**< Suppress-Body-If-Match header */
suppress_notify_if_match @EXP_1_12_5 /**< Suppress-Notify-If-Match header */
#### EXTRA HEADER LIST ENDS HERE ####
......@@ -1667,6 +1667,7 @@ static int sip_header_test(void)
TEST(sip->sip_max_forwards->mf_count, 12);
TEST(sip->sip_min_expires->me_delta, 150);
#if SU_HAVE_EXPERIMENTAL
{
sip_suppress_body_if_match_t *sbim;
sip_suppress_notify_if_match_t *snim;
......@@ -1683,6 +1684,7 @@ static int sip_header_test(void)
TEST_SIZE(offsetof(msg_generic_t, g_value),
offsetof(sip_suppress_notify_if_match_t, snim_tag));
}
#endif
TEST_1(sip->sip_from->a_display);
TEST_S(sip->sip_from->a_display, "h");
......
......@@ -75,6 +75,12 @@
/** Define as 1 if you have OSX CoreFoundation interface */
#undef SU_HAVE_OSX_CF_API
/** Define as 1 if you want to enable experimental features.
*
* Use --enable-experimental with ./configure
*/
#undef SU_HAVE_EXPERIMENTAL
/** Define as 1 if you have inline functions */
#undef SU_HAVE_INLINE
/** Define as suitable declarator inline functions */
......
......@@ -46,6 +46,14 @@ else
SAC_SU_DEFINE([SU_HAVE_PTHREADS], 1, [Sofia SU uses pthreads])
fi
AC_ARG_ENABLE(experimental,
[ --enable-experimental enable experimental features (disabled)],
, enable_experimental=no)
if test $enable_experimental = yes ; then
SAC_SU_DEFINE([SU_HAVE_EXPERIMENTAL], 1, [Enable experimental features])
fi
dnl ===========================================================================
dnl Checks for typedefs, headers, structures, and compiler characteristics.
dnl ===========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment