summaryrefslogtreecommitdiff
path: root/channels/sip/include
diff options
context:
space:
mode:
authorMatthew Nicholson <mnicholson@digium.com>2011-01-26 20:44:47 +0000
committerMatthew Nicholson <mnicholson@digium.com>2011-01-26 20:44:47 +0000
commit48a9694ed0772d09229919031effbb56ed253be2 (patch)
tree700b71361d4a128f480482d2b4d272b3b81bdfa2 /channels/sip/include
parent8db5da18cff776045ddb8d00e1d4d161b39aa299 (diff)
Merged revisions 304245 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r304245 | mnicholson | 2011-01-26 14:43:27 -0600 (Wed, 26 Jan 2011) | 20 lines Merged revisions 304244 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r304244 | mnicholson | 2011-01-26 14:42:16 -0600 (Wed, 26 Jan 2011) | 13 lines Merged revisions 304241 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r304241 | mnicholson | 2011-01-26 14:38:22 -0600 (Wed, 26 Jan 2011) | 6 lines This patch modifies chan_sip to route responses to the address the request came from. It also modifies chan_sip to respect the maddr parameter in the Via header. ABE-2664 Review: https://reviewboard.asterisk.org/r/1059/ ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304246 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/include')
-rw-r--r--channels/sip/include/reqresp_parser.h42
-rw-r--r--channels/sip/include/sip.h11
2 files changed, 49 insertions, 4 deletions
diff --git a/channels/sip/include/reqresp_parser.h b/channels/sip/include/reqresp_parser.h
index 8c8c59ad6..bb1831431 100644
--- a/channels/sip/include/reqresp_parser.h
+++ b/channels/sip/include/reqresp_parser.h
@@ -166,9 +166,43 @@ int sip_reqresp_parser_init(void);
void sip_reqresp_parser_exit(void);
/*!
- * \brief Parse the VIA header into it's parts.
- *
- * \note This will modify the string
+ * \brief Parse a Via header
+ *
+ * This function parses the Via header and processes it according to section
+ * 18.2 of RFC 3261 and RFC 3581. Since we don't have a transport layer, we
+ * only care about the maddr and ttl parms. The received and rport params are
+ * not parsed.
+ *
+ * \note This function fails to parse some odd combinations of SWS in parameter
+ * lists.
+ *
+ * \code
+ * VIA syntax. RFC 3261 section 25.1
+ * Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
+ * via-parm = sent-protocol LWS sent-by *( SEMI via-params )
+ * via-params = via-ttl / via-maddr
+ * / via-received / via-branch
+ * / via-extension
+ * via-ttl = "ttl" EQUAL ttl
+ * via-maddr = "maddr" EQUAL host
+ * via-received = "received" EQUAL (IPv4address / IPv6address)
+ * via-branch = "branch" EQUAL token
+ * via-extension = generic-param
+ * sent-protocol = protocol-name SLASH protocol-version
+ * SLASH transport
+ * protocol-name = "SIP" / token
+ * protocol-version = token
+ * transport = "UDP" / "TCP" / "TLS" / "SCTP"
+ * / other-transport
+ * sent-by = host [ COLON port ]
+ * ttl = 1*3DIGIT ; 0 to 255
+ * \endcode
+ */
+struct sip_via *parse_via(const char *header);
+
+/*
+ * \brief Free parsed Via data.
*/
-void get_viabranch(char *via, char **sent_by, char **branch);
+void free_via(struct sip_via *v);
+
#endif
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 385d9663b..57c155e14 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -789,6 +789,17 @@ struct sip_route {
char hop[0];
};
+/*! \brief Structure to store Via information */
+struct sip_via {
+ char *via;
+ const char *protocol;
+ const char *sent_by;
+ const char *branch;
+ const char *maddr;
+ unsigned int port;
+ unsigned char ttl;
+};
+
/*! \brief Domain data structure.
\note In the future, we will connect this to a configuration tree specific
for this domain