Browse code

cleanup: _TOTAG removed, backwards compatibility callback defs introduced

Jiri Kuthan authored on 16/03/2003 00:53:42
Showing 4 changed files
... ...
@@ -23,6 +23,10 @@
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
27
+ * History
28
+ * -------
29
+ * 2003-03-16  removed _TOTAG (jiri)
26 30
  */
27 31
 
28 32
 #include "defs.h"
... ...
@@ -108,10 +112,6 @@ void free_cell( struct cell* dead_cell )
108 112
 		sip_msg_free_unsafe( dead_cell->uas.request );
109 113
 	if ( dead_cell->uas.response.buffer )
110 114
 		shm_free_unsafe( dead_cell->uas.response.buffer );
111
-#ifdef _TOTAG
112
-	if (dead_cell->uas.to_tag.s)
113
-		shm_free_unsafe(dead_cell->uas.to_tag.s);
114
-#endif
115 115
 
116 116
 	/* completion callback */
117 117
 	if (dead_cell->cbp) shm_free_unsafe(dead_cell->cbp);
... ...
@@ -26,6 +26,7 @@
26 26
  *
27 27
  * History:
28 28
  * --------
29
+ * 2003-03-16  removed _TOTAG (jiri)
29 30
  * 2003-03-01  kr set through a function now (jiri)
30 31
  */
31 32
 
... ...
@@ -124,12 +125,6 @@ typedef struct ua_server
124 125
 	 * we need them for dialog-wise matching of ACKs;
125 126
 	 * the pointer shows to shmem-ed reply */
126 127
 	str				 local_totag;
127
-#ifdef _TOTAG
128
-	str              to_tag;
129
-#endif
130
-#ifdef _OBSO
131
-	unsigned int     isACKed;
132
-#endif
133 128
 }ua_server_type;
134 129
 
135 130
 
... ...
@@ -23,6 +23,10 @@
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
27
+ * History:
28
+ * --------
29
+ * 2003-03-16 backwards-compatibility callback names introduced (jiri)
26 30
  */
27 31
 
28 32
 
... ...
@@ -35,6 +39,13 @@
35 39
 struct sip_msg;
36 40
 struct cell;
37 41
 
42
+/* backwards compatibility hooks */
43
+#define TMCB_REPLY TMCB_RESPONSE_OUT
44
+#define TMCB_E2EACK TMCB_E2EACK_IN
45
+#define TMCB_REPLY_IN TMCB_RESPONSE_IN
46
+#define TMCB_REQUEST_OUT TMCB_REQUEST_FWDED
47
+#define TMCB_ON_NEGATIVE_TMCB_ON_FAILURE
48
+
38 49
 typedef enum { 
39 50
 		/* input events */
40 51
 		TMCB_RESPONSE_IN=1, TMCB_REQUEST_IN, TMCB_E2EACK_IN, 
... ...
@@ -76,6 +87,12 @@ typedef enum {
76 87
  *    this value before derefing -- you will cause a segfault
77 88
  *    otherwise.
78 89
  *
90
+ *    Also note, that reply callbacks are not called if a transaction
91
+ *    is dropped silently. That's the case when noisy_ctimer is
92
+ *    disabled (by default) and C-timer hits. The proxy server then
93
+ *    drops state silently, doesn't use callbacks and expects the
94
+ *    transaction to complete statelessly.
95
+ *
79 96
  *  TMCB_ON_FAILURE -- called on receipt of a reply or timer;
80 97
  *  it means all branches completed with a failure; that's 
81 98
  *  a chance for example to add new transaction branches
... ...
@@ -27,6 +27,7 @@
27 27
  *
28 28
  * History:
29 29
  * --------
30
+ * 2003-03-16  removed _TOTAG (jiri)
30 31
  * 2003-03-01  kr set through a function now (jiri)
31 32
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
32 33
  * 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,
603 604
 		goto error2;
604 605
 	}
605 606
 
606
-#ifdef _TOTAG
607
-	if(to_tag){
608
-	    trans->uas.to_tag.s = (char*)shm_resize( trans->uas.to_tag.s, to_tag_len );
609
-	    if(! trans->uas.to_tag.s ){
610
-			LOG(L_ERR, "ERROR: t_reply: cannot allocate shmem buffer\n");
611
-			goto error2; 
612
-	    }
613
-	    trans->uas.to_tag.len = to_tag_len;
614
-	    memcpy( trans->uas.to_tag.s, to_tag, to_tag_len );
615
-	}
616
-#endif
617 607
 
618 608
 	rb = & trans->uas.response;
619 609
 	rb->activ_type=code;
... ...
@@ -671,12 +661,6 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
671 661
 	return 1;
672 662
 
673 663
 error3:
674
-#ifdef _TOTAG
675
-	if (to_tag) {
676
-		shm_free(trans->uas.to_tag.s);
677
-		trans->uas.to_tag.s=0;
678
-	}
679
-#endif
680 664
 error2:
681 665
 	if (lock) UNLOCK_REPLIES( trans );
682 666
 	pkg_free ( buf );
... ...
@@ -788,9 +772,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
788 772
 	struct sip_msg *relayed_msg;
789 773
 	struct bookmark bm;
790 774
 	int totag_retr;
791
-#ifdef _TOTAG
792
-	str	to_tag;
793
-#endif
794 775
 	enum rps reply_status;
795 776
 	/* retransmission structure of outbound reply and request */
796 777
 	struct retr_buf *uas_rb;
... ...
@@ -891,26 +872,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
891 872
 			update_local_tags(t, &bm, uas_rb->buffer, buf);
892 873
 		}
893 874
 		tm_stats->replied_localy++;
894
-#ifdef _TOTAG
895
-		/* to tag now */
896
-		if (relayed_code>=300 && t->is_invite) {
897
-			if (relayed_msg!=FAKED_REPLY) {
898
-				to_tag=get_to(relayed_msg)->tag_value;
899
-				t->uas.to_tag.s=(char *)shm_resize( t->uas.to_tag.s,
900
-					to_tag.len );
901
-				if (!t->uas.to_tag.s) {
902
-					LOG(L_ERR, "ERROR: no shmem for to-tag\n");
903
-					goto error04;
904
-				}
905
-				t->uas.to_tag.len=to_tag.len;
906
-				memcpy(t->uas.to_tag.s, to_tag.s, to_tag.len );
907
-			} else {
908
-				if (t->uas.to_tag.s) shm_free(t->uas.to_tag.s);
909
-				t->uas.to_tag.s=0;
910
-				t->uas.to_tag.len=0;
911
-			}
912
-		}
913
-#endif
914 875
 
915 876
 		/* update the status ... */
916 877
 		t->uas.status = relayed_code;
... ...
@@ -939,11 +900,6 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
939 900
 	/* success */
940 901
 	return reply_status;
941 902
 
942
-#ifdef _TOTAG
943
-error04:
944
-	shm_free( uas_rb->buffer );
945
-	uas_rb->buffer=0;
946
-#endif
947 903
 error03:
948 904
 	pkg_free( buf );
949 905
 error02: