Browse code

- support for sctp

Andrei Pelinescu-Onciul authored on 08/08/2008 20:45:40
Showing 2 changed files
... ...
@@ -49,7 +49,8 @@
49 49
  *  2004-03-31  fixed rport set instead of i bug (andrei)
50 50
  *  2005-03-02  if via has multiple bodies, and one of them is bad set
51 51
  *               also the first one as bad (andrei)
52
- *  2006-02-24  added support for comp parameter parsing (see rfc3486) (andrei)
52
+ *  2006-02-24  added support for comp parameter parsing, see rfc3486 (andrei)
53
+ *  2008-08-08  SCTP support (andrei)
53 54
  */
54 55
 
55 56
 
... ...
@@ -90,6 +91,7 @@ enum {
90 90
 	UDP1, UDP2, FIN_UDP,
91 91
 	TCP_TLS1, TCP2, FIN_TCP,
92 92
 	          TLS2, FIN_TLS,
93
+	SCTP1, SCTP2, SCTP3, FIN_SCTP,
93 94
 	L_PROTO, F_PROTO
94 95
 };
95 96
 
... ...
@@ -1359,6 +1361,12 @@ parse_again:
1359 1359
 						vb->proto=PROTO_TLS;
1360 1360
 						state=F_HOST; /* start looking for host*/
1361 1361
 						goto main_via;
1362
+					case FIN_SCTP:
1363
+						/* finished proto parsing */
1364
+						vb->transport.len=tmp-vb->transport.s;
1365
+						vb->proto=PROTO_SCTP;
1366
+						state=F_HOST; /* start looking for host*/
1367
+						goto main_via;
1362 1368
 					case FIN_SIP:
1363 1369
 						vb->name.len=tmp-vb->name.s;
1364 1370
 						state=L_VER;
... ...
@@ -1512,6 +1520,10 @@ parse_again:
1512 1512
 					case TLS2:
1513 1513
 						state=FIN_TLS;
1514 1514
 						break;
1515
+					case F_PROTO:
1516
+						state=SCTP1;
1517
+						vb->transport.s=tmp;
1518
+						break;
1515 1519
 					default:
1516 1520
 						LOG(L_ERR, "ERROR: parse_via: bad char <%c> on"
1517 1521
 								" state %d\n", *tmp, state);
... ...
@@ -1543,6 +1555,9 @@ parse_again:
1543 1543
 					case TCP2:
1544 1544
 						state=FIN_TCP;
1545 1545
 						break;
1546
+					case SCTP3:
1547
+						state=FIN_SCTP;
1548
+						break;
1546 1549
 					default:
1547 1550
 						LOG(L_ERR, "ERROR: parse_via: bad char <%c> on"
1548 1551
 								" state %d\n", *tmp, state);
... ...
@@ -1581,6 +1596,9 @@ parse_again:
1581 1581
 						state=TCP_TLS1;
1582 1582
 						vb->transport.s=tmp;
1583 1583
 						break;
1584
+					case SCTP2:
1585
+						state=SCTP3;
1586
+						break;
1584 1587
 					default:
1585 1588
 						LOG(L_ERR, "ERROR: parse_via: bad char <%c> on"
1586 1589
 								" state %d\n", *tmp, state);
... ...
@@ -1593,6 +1611,9 @@ parse_again:
1593 1593
 					case TCP_TLS1:
1594 1594
 						state=TCP2;
1595 1595
 						break;
1596
+					case SCTP1:
1597
+						state=SCTP2;
1598
+						break;
1596 1599
 					default:
1597 1600
 						LOG(L_ERR, "ERROR: parse_via: bad char <%c> on"
1598 1601
 								" state %d\n", *tmp, state);
... ...
@@ -862,8 +862,10 @@ int naptr_proto_supported(char proto)
862 862
 			return !tls_disable;
863 863
 #endif /* USE_TLS */
864 864
 #endif /* USE_TCP */
865
+#ifdef USE_SCTP
865 866
 		case PROTO_SCTP:
866
-			return 0; /* not supported */
867
+			return !sctp_disable;
868
+#endif
867 869
 	}
868 870
 	return 0;
869 871
 }