]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
unpull a number of patches from the previous darcs merge to try to eliminate some...
authorMichael Jerris <mike@jerris.com>
Fri, 25 Jan 2008 17:42:24 +0000 (17:42 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 25 Jan 2008 17:42:24 +0000 (17:42 +0000)
Wed Jan 23 11:05:58 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: asserting in proper place when handling queue tail
Shall I unpull this patch? (4/553)  [ynWvpxqadjk], or ? for help: y

Wed Jan 23 11:05:23 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: ignore tags in nta_leg_by_dialog() if they are empty strings
Shall I unpull this patch? (5/553)  [ynWvpxqadjk], or ? for help: y

Tue Jan 22 13:59:44 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: added NTATAG_GRAYLIST().

  Use NTATAG_GRAYLIST() as ttl value for sres_set_cached_srv_priority().
Shall I unpull this patch? (14/553)  [ynWvpxqadjk], or ? for help: y

Tue Jan 22 13:57:38 EST 2008  Pekka.Pessi@nokia.com
  * sres: added ttl parameter to sres_set_cached_srv_priority() and sres_cache_set_srv_priority().
Shall I unpull this patch? (15/553)  [ynWvpxqadjk], or ? for help: y

Tue Jan 22 11:15:04 EST 2008  Pekka.Pessi@nokia.com
  * sip_util.c: updated sip_response_terminates_dialog() as per RFC 5057.

  Changes handling of 423 in case of SUBSCRIBE.
Shall I unpull this patch? (22/553)  [ynWvpxqadjk], or ? for help: y

Mon Jan 21 14:06:35 EST 2008  Pekka.Pessi@nokia.com
  * soa.c: using session state in soa_set_activity()

  The media mode bits are set using (local) session description instead of
  remote offer/answer when O/A has been completed.
Shall I unpull this patch? (26/553)  [ynWvpxqadjk], or ? for help: y

Fri Jan 11 12:11:12 EST 2008  Pekka.Pessi@nokia.com
  * nta.c: NetModule hack re-prioritizing SRV records

  Original hack by Stefan Leuenberger <Stefan.Leuenberger@netmodule.com>.

  The hack reprioritizes the SRV records used with transaction in case a
  server refuses connection or it does not answer.
Shall I unpull this patch? (51/553)  [ynWvpxqadjk], or ? for help: y

Fri Jan 11 09:28:46 EST 2008  Pekka.Pessi@nokia.com
  * su_addrinfo.c: if su_getaddrinfo() service is NULL, try both with "0" and NULL
Shall I unpull this patch? (53/553)  [ynWvpxqadjk], or ? for help: y

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7354 d0543943-73ff-0310-b7d9-9358b9ac24b2

14 files changed:
libs/sofia-sip/libsofia-sip-ua/nta/nta.c
libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
libs/sofia-sip/libsofia-sip-ua/soa/soa.c
libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h
libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h
libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_addrinfo.h
libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c

index 3107ca88b640448a2a8e2c49ce33133bb337d975..818d5afa4e19f5189a82d0c80019738e18c2b2bb 100644 (file)
@@ -338,7 +338,7 @@ su_log_t nta_log[] = { SU_LOG_INIT("nta", "NTA_DEBUG", SU_DEBUG) };
  * NTATAG_BAD_REQ_MASK(), NTATAG_BAD_RESP_MASK(), NTATAG_BLACKLIST(),
  * NTATAG_CANCEL_2543(), NTATAG_CANCEL_487(), NTATAG_CLIENT_RPORT(),
  * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
- * NTATAG_EXTRA_100(), NTATAG_GRAYLIST(),
+ * NTATAG_EXTRA_100(),
  * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
  * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
  * NTATAG_REL100(), 
@@ -400,7 +400,6 @@ nta_agent_t *nta_agent_create(su_root_t *root,
     agent->sa_t4              = NTA_SIP_T4;
     agent->sa_t1x64          = 64 * NTA_SIP_T1;
     agent->sa_timer_c         = 185 * 1000;
-    agent->sa_graylist        = 600;
     agent->sa_drop_prob       = 0;
     agent->sa_is_a_uas        = 0;
     agent->sa_progress        = 60 * 1000;
@@ -895,7 +894,7 @@ void agent_kill_terminator(nta_agent_t *agent)
  * NTATAG_BAD_REQ_MASK(), NTATAG_BAD_RESP_MASK(), NTATAG_BLACKLIST(),
  * NTATAG_CANCEL_2543(), NTATAG_CANCEL_487(), NTATAG_CLIENT_RPORT(),
  * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
- * NTATAG_EXTRA_100(), NTATAG_GRAYLIST(),
+ * NTATAG_EXTRA_100(),
  * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
  * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
  * NTATAG_REL100(), 
@@ -945,7 +944,6 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
   unsigned sip_t4     = agent->sa_t4;
   unsigned sip_t1x64  = agent->sa_t1x64;
   unsigned timer_c    = agent->sa_timer_c;
-  unsigned graylist   = agent->sa_graylist;
   unsigned blacklist  = agent->sa_blacklist;
   int ua              = agent->sa_is_a_uas;
   unsigned progress   = agent->sa_progress;
@@ -989,7 +987,6 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
              NTATAG_DEBUG_DROP_PROB_REF(drop_prob),
              NTATAG_DEFAULT_PROXY_REF(proxy),
              NTATAG_EXTRA_100_REF(extra_100),
-             NTATAG_GRAYLIST_REF(graylist),
              NTATAG_MAXSIZE_REF(maxsize),
              NTATAG_MAX_PROCEEDING_REF(max_proceeding),
              NTATAG_MAX_FORWARDS_REF(max_forwards),
@@ -1143,12 +1140,6 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
     outgoing_queue_adjust(agent, agent->sa_out.inv_proceeding, timer_c);
   }
 
-  if (graylist > 24 * 60 * 60)
-    graylist = 24 * 60 * 60;
-  agent->sa_graylist = graylist;
-
-  if (blacklist > 24 * 60 * 60)
-    blacklist = 24 * 60 * 60;
   agent->sa_blacklist = blacklist;
 
   if (progress == 0)
@@ -1211,7 +1202,7 @@ void agent_set_udp_params(nta_agent_t *self, usize_t udp_mtu)
  * NTATAG_CANCEL_2543_REF(), NTATAG_CANCEL_487_REF(),
  * NTATAG_CLIENT_RPORT_REF(), NTATAG_CONTACT_REF(), 
  * NTATAG_DEBUG_DROP_PROB_REF(), NTATAG_DEFAULT_PROXY_REF(),
- * NTATAG_EXTRA_100_REF(), NTATAG_GRAYLIST_REF(),
+ * NTATAG_EXTRA_100_REF(),
  * NTATAG_MAXSIZE_REF(), NTATAG_MAX_FORWARDS_REF(), NTATAG_MCLASS_REF(),
  * NTATAG_MERGE_482_REF(), NTATAG_MAX_PROCEEDING_REF(),
  * NTATAG_PASS_100_REF(), NTATAG_PASS_408_REF(), NTATAG_PRELOAD_REF(),
@@ -1260,7 +1251,6 @@ int agent_get_params(nta_agent_t *agent, tagi_t *tags)
             NTATAG_DEBUG_DROP_PROB(agent->sa_drop_prob),
             NTATAG_DEFAULT_PROXY(agent->sa_default_proxy),
             NTATAG_EXTRA_100(agent->sa_extra_100),
-            NTATAG_GRAYLIST(agent->sa_graylist),
             NTATAG_MAXSIZE(agent->sa_maxsize),
                 NTATAG_MAX_PROCEEDING(agent->sa_max_proceeding),
             NTATAG_MAX_FORWARDS(agent->sa_max_forwards->mf_count),
@@ -4133,9 +4123,6 @@ int addr_cmp(url_t const *a, url_t const *b)
  *                     it must math
  * @param local_uri    ignored
  *
- * @note
- * If @a remote_tag or @a local_tag is an empty string (""), the tag is
- * ignored when matching legs.
  */
 nta_leg_t *nta_leg_by_dialog(nta_agent_t const *agent,
                             url_t const *request_uri,
@@ -4237,9 +4224,9 @@ nta_leg_t *leg_find(nta_agent_t const *sa,
     if (!remote_tag != !from_tag && !local_tag != !to_tag)
       continue;
 
-    if (local_tag && to_tag && strcasecmp(local_tag, to_tag) && to_tag[0])
+    if (local_tag && to_tag && strcasecmp(local_tag, to_tag))
       continue;
-    if (remote_tag && from_tag && strcasecmp(remote_tag, from_tag) && from_tag[0])
+    if (remote_tag && from_tag && strcasecmp(remote_tag, from_tag))
       continue;
 
     if (leg_url && request_uri && url_cmp(leg_url, request_uri))
@@ -7662,7 +7649,6 @@ void outgoing_queue(outgoing_queue_t *queue,
   if (outgoing_is_queued(orq))
     outgoing_remove(orq);
 
-  assert(orq->orq_next == NULL);
   assert(*queue->q_tail == NULL);
 
   orq->orq_timeout = set_timeout(orq->orq_agent, queue->q_timeout);
@@ -7686,7 +7672,7 @@ void outgoing_remove(nta_outgoing_t *orq)
   if ((*orq->orq_prev = orq->orq_next))
     orq->orq_next->orq_prev = orq->orq_prev;
   else
-    orq->orq_queue->q_tail = orq->orq_prev;
+    orq->orq_queue->q_tail = orq->orq_prev, assert(!*orq->orq_queue->q_tail);
 
   orq->orq_queue->q_length--;
   orq->orq_next = NULL;
@@ -8842,8 +8828,8 @@ struct sipdns_query
   char const *sq_proto;
   char const *sq_domain;
   char     sq_port[6];         /* port number */
-  uint16_t sq_otype;           /* origin type of query data (0 means request) */
-  uint16_t sq_type;            /* query type */
+
+  uint16_t sq_type;
   uint16_t sq_priority;                /* priority or preference  */
   uint16_t sq_weight;          /* preference or weight */
 };
@@ -9074,65 +9060,6 @@ outgoing_try_another(nta_outgoing_t *orq)
   outgoing_reset_timer(orq);
   outgoing_queue(orq->orq_agent->sa_out.resolving, orq);
 
-  if (orq->orq_status > 0)
-    /* PP: don't hack priority if a preliminary response has been received */
-    ;
-  else if (orq->orq_agent->sa_graylist == 0)
-    /* PP: priority hacking disabled */
-    ;
-  /* NetModule hack: 
-   * Move server that did not work to end of queue in sres cache
-   *
-   * the next request does not try to use the server that is currently down
-   *
-   * @TODO: fix cases with only A or AAAA answering, or all servers down.
-   */
-  else if (sr && sr->sr_target) {
-    struct sipdns_query *sq;
-
-    /* find latest A/AAAA record */
-    sq = sr->sr_head;
-    if (!sq || (sr->sr_a_aaaa1 != sr->sr_a_aaaa2 && sq->sq_type == sr->sr_a_aaaa1))
-       sq = sr->sr_done;       
-    
-    if (sq && sq->sq_otype == sres_type_srv) {
-      char const *target = sq->sq_domain, *proto = sq->sq_proto;
-      unsigned prio = sq->sq_priority, maxprio = prio;
-
-      SU_DEBUG_5(("nta: no response from %s:%s;transport=%s\n", target, sq->sq_port, proto));
-
-      for (sq = sr->sr_head; sq; sq = sq->sq_next) 
-       if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
-         maxprio = sq->sq_priority;
-
-      for (sq = sr->sr_done; sq; sq = sq->sq_next)
-       if (sq->sq_otype == sres_type_srv && sq->sq_priority > maxprio)
-         maxprio = sq->sq_priority;
-
-      for (sq = sr->sr_done; sq; sq = sq->sq_next) {
-       int modified;
-
-       if (sq->sq_type != sres_type_srv || strcmp(proto, sq->sq_proto))
-         continue;
-
-       /* modify the SRV record(s) corresponding to the latest A/AAAA record */
-       modified = sres_set_cached_srv_priority(
-         orq->orq_agent->sa_resolver, 
-         sq->sq_domain, 
-         target,
-         sq->sq_port[0] ? (uint16_t)strtoul(sq->sq_port, NULL, 10) : 0,
-         orq->orq_agent->sa_graylist,
-         maxprio + 1);
-
-       if (modified >= 0)
-         SU_DEBUG_3(("nta: reduced priority of %d %s SRV records (increase value to %u)\n",
-                     modified, sq->sq_domain, maxprio + 1));
-       else
-         SU_DEBUG_3(("nta: failed to reduce %s SRV priority\n", sq->sq_domain));
-      }
-    }
-  }
-
   return outgoing_resolve_next(orq);
 }
 
@@ -9411,7 +9338,6 @@ void outgoing_answer_naptr(sres_context_t *orq,
     sq = su_zalloc(home, (sizeof *sq) + rlen);
 
     *tail = sq, tail = &sq->sq_next;    
-    sq->sq_otype = sres_type_naptr;
     sq->sq_priority = na->na_prefer;
     sq->sq_weight = j;
     sq->sq_type = type;
@@ -9512,11 +9438,11 @@ outgoing_answer_srv(sres_context_t *orq, sres_query_t *q,
     if (sq) {
       *tail = sq, tail = &sq->sq_next;
 
-      sq->sq_otype = sres_type_srv;
       sq->sq_type = sr->sr_a_aaaa1;
       sq->sq_proto = sq0->sq_proto;
       sq->sq_domain = memcpy(sq + 1, srv->srv_target, tlen);
       snprintf(sq->sq_port, sizeof(sq->sq_port), "%u", srv->srv_port);
+
       sq->sq_priority = srv->srv_priority;
       sq->sq_weight = srv->srv_weight;
     }
index b8e29ff18bf2ba38b287d1a7e0be1f8bbcefa01c..613c5313fce1a8085f03adc27235901222c8d7e4 100644 (file)
@@ -167,8 +167,6 @@ struct nta_agent_s
   /** SIP timer C - interval between provisional responses receivedxs */
   unsigned              sa_timer_c;
 
-  /** Graylisting period */
-  unsigned              sa_graylist;
   /** Blacklisting period */
   unsigned              sa_blacklist;
 
index 58efc6f27af49c3d80b1c52c03ebf51e8a7d16a8..7b46e68ae3845d535064aa7f23217775f6f872b4 100644 (file)
@@ -643,31 +643,6 @@ tag_typedef_t ntatag_progress = UINTTAG_TYPEDEF(progress);
  */
 tag_typedef_t ntatag_timer_c = UINTTAG_TYPEDEF(timer_c);
 
-/**@def NTATAG_GRAYLIST(x)
- *
- * Avoid failed servers.
- *
- * The NTATAG_GRAYLIST() provides the time that the servers are avoided
- * after a request sent to them has been failed. Avoiding means that if a
- * domain provides multiple servers, the failed servers are tried last.
- *
- * @par Used with
- *    nua_create(), nua_set_params(),
- *    nta_agent_create(), nta_agent_set_params()
- *
- * @par Parameter type
- *     unsigned int
- *
- * @par Values
- *    - Number of seconds that server is kept in graylist, from 0 to 86400.
- *
- * @par Default Value
- *    - 600 (graylist server for 10 minutes)
- *
- * @sa NTATAG_BLACKLIST(), NTATAG_TIMEOUT_408()
- */
-tag_typedef_t ntatag_graylist = UINTTAG_TYPEDEF(graylist);
-
 /**@def NTATAG_BLACKLIST(x)
  *
  * Add Retry-After header to error responses returned to application.
@@ -685,7 +660,7 @@ tag_typedef_t ntatag_graylist = UINTTAG_TYPEDEF(graylist);
  *     unsigned int
  *
  * @par Values
- *    - Value of @i delta-seconds in @RetryAfter header, from 0 to 86400
+ *    - Value of delta-seconds in @RetryAfter header
  *
  * @par Default Value
  *    - 0 (no Retry-After is included)
index 0b7ffb4e931565a466819cd92c446c3088899c5c..82e4b1c96944549c0f6eed2d4b18b7595ed2f561 100644 (file)
@@ -203,12 +203,6 @@ NTA_DLL extern tag_typedef_t ntatag_timer_c;
 NTA_DLL extern tag_typedef_t ntatag_timer_c_ref;
 #define NTATAG_TIMER_C_REF(x) ntatag_timer_c_ref, tag_uint_vr(&(x))
 
-NTA_DLL extern tag_typedef_t ntatag_graylist;
-#define NTATAG_GRAYLIST(x)  ntatag_graylist, tag_uint_v((x))
-
-NTA_DLL extern tag_typedef_t ntatag_graylist_ref;
-#define NTATAG_GRAYLIST_REF(x) ntatag_graylist_ref, tag_uint_vr(&(x))
-
 NTA_DLL extern tag_typedef_t ntatag_blacklist;
 #define NTATAG_BLACKLIST(x)  ntatag_blacklist, tag_uint_v((x))
 
index 3862de7f73279985342b3f0fd3cdf5edf7e5ed8b..5d371ea98e6a03b885c5cbb797a2740a942c9995 100644 (file)
@@ -883,7 +883,8 @@ sip_security_client_select(sip_security_client_t const *client,
  * decide whether to gracefully terminate or not, the
  * @a *return_graceful_terminate_usage is left unmodified.
  *
- * @RFC 5057
+ * @sa 
+ * http://www.ietf.org/internet-drafts/draft-ietf-sipping-dialogusage-02.txt
  */
 int sip_response_terminates_dialog(int response_code,
                                   sip_method_t method,
@@ -1059,6 +1060,8 @@ int sip_response_terminates_dialog(int response_code,
       usage in an existing dialog, no new usage is created and existing
       usages are unaffected.
     */
+    *return_graceful_terminate_usage = 0;
+    return 0;
 
   case 423: /** @par 423 Interval Too Brief 
 
@@ -1067,6 +1070,8 @@ int sip_response_terminates_dialog(int response_code,
       subscribe usage is not destroyed (or otherwise affected).  No
       other usages of the dialog are affected.
     */
+    *return_graceful_terminate_usage = 0;
+    return sip_method_subscribe == method ? terminate_usage : no_effect;
 
   case 428: /** @par 428 Use Identity Header
 
@@ -1074,6 +1079,8 @@ int sip_response_terminates_dialog(int response_code,
       the usage.  The usage is not affected.  The dialog is only
       affected by a change in its local @CSeq.  No other usages of the
       dialog are affected. */
+    *return_graceful_terminate_usage = 0;
+    return 0;
 
   case 429: /** @par 429 Provide Referrer Identity 
 
index 86898005145940e64ecf97e9e37bebd06fb24ddb..e5a6e2e7d6020d6878a07199d82c46a337b8afb1 100644 (file)
@@ -70,6 +70,10 @@ static char const __func__[] = "soa";
 /* ======================================================================== */
 
 /* Internal prototypes */
+void soa_set_activity(soa_session_t *ss,
+                     sdp_media_t const *,
+                     int remote);
+
 su_inline int soa_media_is_ready(soa_session_t const *ss);
 
 enum soa_sdp_kind { 
@@ -1167,7 +1171,7 @@ int soa_base_set_remote_sdp(soa_session_t *ss,
   if (!new_version)
     return 0;
     
-  soa_set_activity(ss, sdp->sdp_media, soa_activity_remote);
+  soa_set_activity(ss, sdp->sdp_media, 1);
 
   ss->ss_remote_version++;
   
@@ -1450,7 +1454,7 @@ int soa_base_generate_offer(soa_session_t *ss,
   if (!sdp)
     return -1;
 
-  soa_set_activity(ss, sdp->sdp_media, soa_activity_local); /* Wanted activity */
+  soa_set_activity(ss, sdp->sdp_media, 0);
 
   ss->ss_offer_sent = 1;
   ss->ss_answer_recv = 0;
@@ -1538,7 +1542,8 @@ int soa_base_generate_answer(soa_session_t *ss,
     su_free(ss->ss_home, ss->ss_rsession);
   ss->ss_rsession = rsession;
 
-  soa_set_activity(ss, l_sdp->sdp_media, soa_activity_session);
+  soa_set_activity(ss, l_sdp->sdp_media, 0);
+  soa_set_activity(ss, r_sdp->sdp_media, 1);
 
   ss->ss_offer_recv = 1;
   ss->ss_answer_sent = 1;
@@ -1619,7 +1624,8 @@ int soa_base_process_answer(soa_session_t *ss,
     su_free(ss->ss_home, ss->ss_rsession);
   ss->ss_rsession = rsession;
 
-  soa_set_activity(ss, l_sdp->sdp_media, soa_activity_session);
+  soa_set_activity(ss, l_sdp->sdp_media, 0);
+  soa_set_activity(ss, r_sdp->sdp_media, 1);
 
   ss->ss_answer_recv = 1;
   ss->ss_complete = 1;
@@ -1686,7 +1692,7 @@ int soa_base_process_reject(soa_session_t *ss,
   if (!l_sdp)
     return -1;
 
-  soa_set_activity(ss, l_sdp->sdp_media, soa_activity_session);
+  soa_set_activity(ss, l_sdp->sdp_media, 0);
 
   ss->ss_offer_sent = 0;
 
@@ -1777,7 +1783,8 @@ void soa_base_terminate(soa_session_t *ss, char const *option)
   ss->ss_oa_rounds = 0;
 
   soa_description_free(ss, ss->ss_remote);
-  soa_set_activity(ss, NULL, soa_activity_session);
+  soa_set_activity(ss, NULL, 0);
+  soa_set_activity(ss, NULL, 1);
 }
 
 /** Return true if the SDP Offer/Answer negotation is complete.
@@ -1882,75 +1889,56 @@ int soa_media_is_ready(soa_session_t const *ss)
 
 void soa_set_activity(soa_session_t *ss,
                      sdp_media_t const *m,
-                     enum soa_activity activity)
+                     int remote)
 {
   struct soa_media_activity *ma;
   sdp_connection_t const *c;
-  int mode, swap;
-  int l_audio = SOA_ACTIVE_DISABLED, r_audio = SOA_ACTIVE_DISABLED;
-  int l_video = SOA_ACTIVE_DISABLED, r_video = SOA_ACTIVE_DISABLED;
-  int l_chat = SOA_ACTIVE_DISABLED,  r_chat = SOA_ACTIVE_DISABLED;
-  int l_image = SOA_ACTIVE_DISABLED, r_image = SOA_ACTIVE_DISABLED;
+  int mode;
+  int ma_audio = SOA_ACTIVE_DISABLED;
+  int ma_video = SOA_ACTIVE_DISABLED;
+  int ma_chat = SOA_ACTIVE_DISABLED;
+  int ma_image = SOA_ACTIVE_DISABLED;
+  int *p;
+
+  remote = !!remote;
 
-  int *l, *r;
+  ma = remote ? ss->ss_remote_activity : ss->ss_local_activity;
 
   for (; m; m = m->m_next) {
     if (m->m_type == sdp_media_audio)
-      l = &l_audio, r = &r_audio;
+      p = &ma_audio;
     else if (m->m_type == sdp_media_video)
-      l = &l_video, r = &r_video;
+      p = &ma_video;
     else if (m->m_type == sdp_media_image)
-      l = &l_image, r = &r_image;
+      p = &ma_image;
     else if (strcasecmp(m->m_type_name, "message") == 0)
-      l = &l_chat, r = &r_chat;
+      p = &ma_chat;
     else
       continue;
 
     if (m->m_rejected) {
-      if (*l < 0) *l = SOA_ACTIVE_REJECTED;
-      if (*r < 0) *r = SOA_ACTIVE_REJECTED;
+      if (*p < 0)
+       *p = SOA_ACTIVE_REJECTED;
       continue;
     }
 
-    mode = m->m_mode, swap = ((mode << 1) & 2) | ((mode >> 1) & 1);
+    mode = m->m_mode;
 
     c = sdp_media_connections((sdp_media_t *)m);
 
-    switch (activity) {
-    case soa_activity_local:
-      *l &= SOA_ACTIVE_SENDRECV;
-      *l |= c && c->c_mcast ? swap : mode;
-      break;
-    case soa_activity_remote:
-      *r &= SOA_ACTIVE_SENDRECV;
-      *r = c && c->c_mcast ? mode : swap;
-      break;
-    case soa_activity_session:
-      *l &= SOA_ACTIVE_SENDRECV;
-      *l |= c && c->c_mcast ? swap : mode;
-      *r &= SOA_ACTIVE_SENDRECV;
-      *r = c && c->c_mcast ? swap : mode;
-      break;
-    }
-  }
+    if (remote != (c && c->c_mcast))
+      mode = ((mode << 1) & 2) | ((mode >> 1) & 1);
 
-  if (activity == soa_activity_local ||
-      activity == soa_activity_session) {
-    ma = ss->ss_local_activity;
-    ma->ma_audio = l_audio;
-    ma->ma_video = l_video;
-    ma->ma_image = l_image;
-    ma->ma_chat = l_chat;
+    if (*p < 0)
+      *p = mode;
+    else
+      *p |= mode;
   }
 
-  if (activity == soa_activity_remote ||
-      activity == soa_activity_session) {
-    ma = ss->ss_remote_activity;
-    ma->ma_audio = r_audio;
-    ma->ma_video = r_video;
-    ma->ma_image = r_image;
-    ma->ma_chat = r_chat;
-  }
+  ma->ma_audio = ma_audio;
+  ma->ma_video = ma_video;
+  ma->ma_image = ma_image;
+  ma->ma_chat = ma_chat;
 }
 
 /* ----------------------------------------------------------------------*/
index f61bd7401335cd5e75342682dd06203c9aee9581..8ff75d0773431d3ce4dff19ed7c96e53f6502510 100644 (file)
@@ -238,11 +238,8 @@ SOFIAPUBFUN int soa_has_received_sdp(soa_session_t const *ss);
 SOFIAPUBFUN int soa_set_status(soa_session_t *ss,
                               int status, char const *phrase);
 
-enum soa_activity { soa_activity_local, soa_activity_remote, soa_activity_session };
-
 SOFIAPUBFUN void soa_set_activity(soa_session_t *ss, 
-                                 sdp_media_t const *m, 
-                                 enum soa_activity activity);
+                                 sdp_media_t const *m, int remote);
 
 SOFIAPUBFUN int soa_description_set(soa_session_t *ss, 
                                    struct soa_description *ssd,
index cbd808a46832d070b6f8dc00db95142059e3cb3a..d1414283a1202c41467b92e33d4cb0af477c5840 100644 (file)
@@ -1376,7 +1376,7 @@ int test_asynch_offer_answer(struct context *ctx)
 {
   BEGIN();
 
-#if 0                          /* This has never been implemented */
+#if 0
   int n;
   
   char const *caps = NONE, *offer = NONE, *answer = NONE;
index b8d33b59bddeb7d624e961c73018bad277e4cce3..668bcb67ef82196cd3b6eec49fc3635db39b9ae6 100644 (file)
@@ -218,13 +218,21 @@ sres_record_t **sres_cached_answers_sockaddr(sres_resolver_t *res,
                                              uint16_t type,
                                             struct sockaddr const *addr);
 
-/**Modify the priority of the specified SRV records. */
+/**Modify the priority of the specified SRV records.
+ * 
+ * @param res       pointer to resolver object
+ * @param service   domain name of the SRV records to search in cache
+ * @param target    target to lower the prio
+ * @param port      port number to lower the prio
+ * @param newprio   new priority value
+ *
+ * @return Number of modified records on success, -1 otherwise
+ */
 SRESPUBFUN
 int sres_set_cached_srv_priority(sres_resolver_t *res,
                                 char const *domain,
                                 char const *target,
                                 uint16_t port,
-                                uint32_t newttl,
                                 uint16_t newprio);
 
 
index 2639ce0c372a3dfa124426ab0dc09e0ddc31833a..19a0e612f743d80c5f673317bda3e71f7227bc2e 100644 (file)
@@ -107,8 +107,7 @@ SRESPUBFUN int sres_cache_set_srv_priority(sres_cache_t *,
                                           char const *domain,
                                           char const *target,
                                           uint16_t port,
-                                          uint32_t newttl,
-                                          uint16_t newprio);
+                                          uint16_t prio);
 
 #ifdef __cplusplus
 }
index a5bb9dc1edb995e7e7cec5be1d8c446e3decad25..ad2702aa650a2897594ab63e9872e9c482694c41 100644 (file)
@@ -1358,7 +1358,6 @@ sres_cached_answers_sockaddr(sres_resolver_t *res,
  * @param target   SRV target of the SRV record(s) to modify
  * @param port     port number of SRV record(s) to modify 
  *                 (in host byte order) 
- * @param ttl      new ttl for SRV records of the domain
  * @param priority new priority value (0=highest, 65535=lowest)
  *
  * @sa sres_cache_set_srv_priority()
@@ -1369,7 +1368,6 @@ int sres_set_cached_srv_priority(sres_resolver_t *res,
                                 char const *domain,
                                 char const *target,
                                 uint16_t port,
-                                uint32_t ttl,
                                 uint16_t priority)
 {
   char rooted_domain[SRES_MAXDNAME];
@@ -1383,8 +1381,7 @@ int sres_set_cached_srv_priority(sres_resolver_t *res,
     return -1;
 
   return sres_cache_set_srv_priority(res->res_cache, 
-                                    domain, target, port, 
-                                    ttl, priority);
+                                    domain, target, port, priority);
 }
 
 
index 5c2d6d2602b0b8b22042d9ef509e6b7ce819c9e8..ab8c954c0b51610e681c49e3267e315c0caee9aa 100644 (file)
@@ -483,7 +483,6 @@ void sres_cache_clean(sres_cache_t *cache, time_t now)
  * @param target   SRV target of the SRV record(s) to modify
  * @param port     port number of SRV record(s) to modify 
  *                 (in host byte order) 
- * @param ttl      new ttl
  * @param priority new priority value (0=highest, 65535=lowest)
  *
  * @sa sres_set_cached_srv_priority()
@@ -494,14 +493,12 @@ int sres_cache_set_srv_priority(sres_cache_t *cache,
                                char const *domain,
                                char const *target,
                                uint16_t port,
-                               uint32_t ttl,
                                uint16_t priority)
 {
   int ret = 0;
   unsigned hash;
   sres_rr_hash_entry_t **iter;
-  time_t expires;
-  
+
   if (cache == NULL || domain == NULL || target == NULL)
     return -1;
 
@@ -510,9 +507,6 @@ int sres_cache_set_srv_priority(sres_cache_t *cache,
   if (!LOCK(cache))
     return -1;
 
-  time(&expires);
-  expires += ttl;
-
   for (iter = sres_htable_hash(cache->cache_hash, hash);
        iter && *iter;
        iter = sres_htable_next(cache->cache_hash, iter)) {
@@ -520,17 +514,13 @@ int sres_cache_set_srv_priority(sres_cache_t *cache,
     
     if (rr && rr->sr_name &&
        sres_type_srv == rr->sr_type &&
+       (port == 0 || rr->sr_srv->srv_port == port) &&
+       rr->sr_srv->srv_target &&
+       strcasecmp(rr->sr_srv->srv_target, target) == 0 &&
        strcasecmp(rr->sr_name, domain) == 0) {
-
-      (*iter)->rr_expires = expires;
-      
-      if ((port == 0 || rr->sr_srv->srv_port == port) &&
-         rr->sr_srv->srv_target &&
-         strcasecmp(rr->sr_srv->srv_target, target) == 0) {
-       /* record found --> change priority of server */
-       rr->sr_srv->srv_priority = priority;
-       ret++;
-      }
+      /* record found --> change priority of server */
+      rr->sr_srv->srv_priority = priority;
+      ret++;
     }
   }
 
index b13a6952475aa9421c359af0eb9979a306b5e043..45368a98ffec44cfdd5196e609191e08c69a8ee1 100644 (file)
@@ -126,7 +126,7 @@ struct addrinfo {
 #define        AI_MASK         (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
 #endif
 
-/** @RFC1576 address info structure. */
+/** RFC 1576 address info structure. */
 typedef struct addrinfo su_addrinfo_t;
 
 /** Translate address and service. */
index f24e4f7dbb6b5d56b9ed154500ee0686177cee2c..5ce50e0d969d947ecbb269b57e9ee1aa0d209d9b 100644 (file)
@@ -893,7 +893,6 @@ int su_getaddrinfo(char const *node, char const *service,
 {
   int retval;
   su_addrinfo_t *ai;
-  char const *realservice = service;
 
   if (!service || service[0] == '\0')
     service = "0";
@@ -933,9 +932,6 @@ int su_getaddrinfo(char const *node, char const *service,
 
   retval = getaddrinfo(node, service, hints, res);
 
-  if (service != realservice && retval == EAI_SERVICE)
-    retval = getaddrinfo(node, realservice, hints, res);
-
   if (retval == 0) {
     for (ai = *res; ai; ai = ai->ai_next) {
       if (ai->ai_protocol)