2
0
Эх сурвалжийг харах

cleanup: _TOTAG removed, backwards compatibility callback defs introduced

Jiri Kuthan 22 жил өмнө
parent
commit
851f8e6ff3

+ 4 - 4
modules/tm/h_table.c

@@ -23,6 +23,10 @@
  * 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
+ *
+ * History
+ * -------
+ * 2003-03-16  removed _TOTAG (jiri)
  */
 
 #include "defs.h"
@@ -108,10 +112,6 @@ void free_cell( struct cell* dead_cell )
 		sip_msg_free_unsafe( dead_cell->uas.request );
 	if ( dead_cell->uas.response.buffer )
 		shm_free_unsafe( dead_cell->uas.response.buffer );
-#ifdef _TOTAG
-	if (dead_cell->uas.to_tag.s)
-		shm_free_unsafe(dead_cell->uas.to_tag.s);
-#endif
 
 	/* completion callback */
 	if (dead_cell->cbp) shm_free_unsafe(dead_cell->cbp);

+ 1 - 6
modules/tm/h_table.h

@@ -26,6 +26,7 @@
  *
  * History:
  * --------
+ * 2003-03-16  removed _TOTAG (jiri)
  * 2003-03-01  kr set through a function now (jiri)
  */
 
@@ -124,12 +125,6 @@ typedef struct ua_server
 	 * we need them for dialog-wise matching of ACKs;
 	 * the pointer shows to shmem-ed reply */
 	str				 local_totag;
-#ifdef _TOTAG
-	str              to_tag;
-#endif
-#ifdef _OBSO
-	unsigned int     isACKed;
-#endif
 }ua_server_type;
 
 

+ 17 - 0
modules/tm/t_hooks.h

@@ -23,6 +23,10 @@
  * 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
+ *
+ * History:
+ * --------
+ * 2003-03-16 backwards-compatibility callback names introduced (jiri)
  */
 
 
@@ -35,6 +39,13 @@
 struct sip_msg;
 struct cell;
 
+/* backwards compatibility hooks */
+#define TMCB_REPLY TMCB_RESPONSE_OUT
+#define TMCB_E2EACK TMCB_E2EACK_IN
+#define TMCB_REPLY_IN TMCB_RESPONSE_IN
+#define TMCB_REQUEST_OUT TMCB_REQUEST_FWDED
+#define TMCB_ON_NEGATIVE_TMCB_ON_FAILURE
+
 typedef enum { 
 		/* input events */
 		TMCB_RESPONSE_IN=1, TMCB_REQUEST_IN, TMCB_E2EACK_IN, 
@@ -76,6 +87,12 @@ typedef enum {
  *    this value before derefing -- you will cause a segfault
  *    otherwise.
  *
+ *    Also note, that reply callbacks are not called if a transaction
+ *    is dropped silently. That's the case when noisy_ctimer is
+ *    disabled (by default) and C-timer hits. The proxy server then
+ *    drops state silently, doesn't use callbacks and expects the
+ *    transaction to complete statelessly.
+ *
  *  TMCB_ON_FAILURE -- called on receipt of a reply or timer;
  *  it means all branches completed with a failure; that's 
  *  a chance for example to add new transaction branches

+ 1 - 45
modules/tm/t_reply.c

@@ -27,6 +27,7 @@
  *
  * History:
  * --------
+ * 2003-03-16  removed _TOTAG (jiri)
  * 2003-03-01  kr set through a function now (jiri)
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
  * 2003-02-18  replaced TOTAG_LEN w/ TOTAG_VALUE_LEN (TOTAG_LEN was defined
@@ -603,17 +604,6 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
 		goto error2;
 	}
 
-#ifdef _TOTAG
-	if(to_tag){
-	    trans->uas.to_tag.s = (char*)shm_resize( trans->uas.to_tag.s, to_tag_len );
-	    if(! trans->uas.to_tag.s ){
-			LOG(L_ERR, "ERROR: t_reply: cannot allocate shmem buffer\n");
-			goto error2; 
-	    }
-	    trans->uas.to_tag.len = to_tag_len;
-	    memcpy( trans->uas.to_tag.s, to_tag, to_tag_len );
-	}
-#endif
 
 	rb = & trans->uas.response;
 	rb->activ_type=code;
@@ -671,12 +661,6 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
 	return 1;
 
 error3:
-#ifdef _TOTAG
-	if (to_tag) {
-		shm_free(trans->uas.to_tag.s);
-		trans->uas.to_tag.s=0;
-	}
-#endif
 error2:
 	if (lock) UNLOCK_REPLIES( trans );
 	pkg_free ( buf );
@@ -788,9 +772,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
 	struct sip_msg *relayed_msg;
 	struct bookmark bm;
 	int totag_retr;
-#ifdef _TOTAG
-	str	to_tag;
-#endif
 	enum rps reply_status;
 	/* retransmission structure of outbound reply and request */
 	struct retr_buf *uas_rb;
@@ -891,26 +872,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
 			update_local_tags(t, &bm, uas_rb->buffer, buf);
 		}
 		tm_stats->replied_localy++;
-#ifdef _TOTAG
-		/* to tag now */
-		if (relayed_code>=300 && t->is_invite) {
-			if (relayed_msg!=FAKED_REPLY) {
-				to_tag=get_to(relayed_msg)->tag_value;
-				t->uas.to_tag.s=(char *)shm_resize( t->uas.to_tag.s,
-					to_tag.len );
-				if (!t->uas.to_tag.s) {
-					LOG(L_ERR, "ERROR: no shmem for to-tag\n");
-					goto error04;
-				}
-				t->uas.to_tag.len=to_tag.len;
-				memcpy(t->uas.to_tag.s, to_tag.s, to_tag.len );
-			} else {
-				if (t->uas.to_tag.s) shm_free(t->uas.to_tag.s);
-				t->uas.to_tag.s=0;
-				t->uas.to_tag.len=0;
-			}
-		}
-#endif
 
 		/* update the status ... */
 		t->uas.status = relayed_code;
@@ -939,11 +900,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
 	/* success */
 	return reply_status;
 
-#ifdef _TOTAG
-error04:
-	shm_free( uas_rb->buffer );
-	uas_rb->buffer=0;
-#endif
 error03:
 	pkg_free( buf );
 error02: