summaryrefslogtreecommitdiff
path: root/channels/sip/include
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2010-07-08 22:08:07 +0000
committerMark Michelson <mmichelson@digium.com>2010-07-08 22:08:07 +0000
commitcd4ebd336f6fdd1fe5d2ad57f06654a9678d88d4 (patch)
treec05335b563c3f7cb9a3edbf3e101d8e1b80e0be4 /channels/sip/include
parent816f26c16ce6cf03cf97b7d0e7af64837283e79d (diff)
Add IPv6 to Asterisk.
This adds a generic API for accommodating IPv6 and IPv4 addresses within Asterisk. While many files have been updated to make use of the API, chan_sip and the RTP code are the files which actually support IPv6 addresses at the time of this commit. The way has been paved for easier upgrading for other files in the near future, though. Big thanks go to Simon Perrault, Marc Blanchet, and Jean-Philippe Dionne for their hard work on this. (closes issue #17565) Reported by: russell Patches: asteriskv6-test-report.pdf uploaded by russell (license 2) Review: https://reviewboard.asterisk.org/r/743 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/include')
-rw-r--r--channels/sip/include/dialog.h2
-rw-r--r--channels/sip/include/globals.h2
-rw-r--r--channels/sip/include/reqresp_parser.h14
-rw-r--r--channels/sip/include/sip.h27
4 files changed, 26 insertions, 19 deletions
diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h
index 8972c02d9..ed31b7774 100644
--- a/channels/sip/include/dialog.h
+++ b/channels/sip/include/dialog.h
@@ -34,7 +34,7 @@
struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
-struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
+struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *sin,
int useglobal_nat, const int intended_method, struct sip_request *req);
void sip_scheddestroy_final(struct sip_pvt *p, int ms);
void sip_scheddestroy(struct sip_pvt *p, int ms);
diff --git a/channels/sip/include/globals.h b/channels/sip/include/globals.h
index 0d7131d87..414d2189b 100644
--- a/channels/sip/include/globals.h
+++ b/channels/sip/include/globals.h
@@ -24,7 +24,7 @@
#ifndef _SIP_GLOBALS_H
#define _SIP_GLOBALS_H
-extern struct sockaddr_in bindaddr; /*!< UDP: The address we bind to */
+extern struct ast_sockaddr bindaddr; /*!< UDP: The address we bind to */
extern struct sched_context *sched; /*!< The scheduling context */
/*! \brief Definition of this channel for PBX channel registration */
diff --git a/channels/sip/include/reqresp_parser.h b/channels/sip/include/reqresp_parser.h
index 58784a621..d8631c982 100644
--- a/channels/sip/include/reqresp_parser.h
+++ b/channels/sip/include/reqresp_parser.h
@@ -28,7 +28,7 @@
* \note
* - Multiple scheme's can be specified ',' delimited. ex: "sip:,sips:"
* - If a component is not requested, do not split around it. This means
- * that if we don't have domain, we cannot split name:pass and domain:port.
+ * that if we don't have domain, we cannot split name:pass.
* - It is safe to call with ret_name, pass, domain, port pointing all to
* the same place.
* - If no secret parameter is provided, ret_name will return with both parts, user:secret
@@ -42,7 +42,8 @@
* general form we are expecting is sip:user:password;user-parameters@host:port;uri-parameters?headers
* \endverbatim
*/
-int parse_uri(char *uri, const char *scheme, char **ret_name, char **pass, char **domain, char **port, char **transport);
+int parse_uri(char *uri, const char *scheme, char **ret_name, char **pass,
+ char **domain, char **transport);
/*!
* \brief parses a URI in to all of its components and any trailing residue
@@ -51,7 +52,9 @@ int parse_uri(char *uri, const char *scheme, char **ret_name, char **pass, char
* \retval -1 on error.
*
*/
-int parse_uri_full(char *uri, const char *scheme, char **user, char **pass, char **host, char **port, struct uriparams *params, char **headers, char **residue);
+int parse_uri_full(char *uri, const char *scheme, char **user, char **pass,
+ char **domain, struct uriparams *params, char **headers,
+ char **residue);
/*!
* \brief Get caller id name from SIP headers, copy into output buffer
@@ -100,7 +103,10 @@ int get_in_brackets_full(char *tmp, char **out, char **residue);
* \retval 0 success
* \retval -1 failure
*/
-int parse_name_andor_addr(char *uri, const char *scheme, char **name, char **user, char **pass, char **host, char **port, struct uriparams *params, char **headers, char **remander);
+int parse_name_andor_addr(char *uri, const char *scheme, char **name,
+ char **user, char **pass, char **domain,
+ struct uriparams *params, char **headers,
+ char **remander);
/*! \brief Parse all contact header contacts
* \retval 0 success
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 13527517f..92fa68e82 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -646,7 +646,8 @@ enum sip_tcptls_alert {
*/
struct sip_proxy {
char name[MAXHOSTNAMELEN]; /*!< DNS name of domain/host or IP */
- struct sockaddr_in ip; /*!< Currently used IP address and port */
+ struct ast_sockaddr ip; /*!< Currently used IP address and port */
+ int port;
time_t last_dnsupdate; /*!< When this was resolved */
enum sip_transport transport;
int force; /*!< If it's an outbound proxy, Force use of this outbound proxy for all outbound requests */
@@ -702,6 +703,7 @@ struct sip_settings {
char default_subscribecontext[AST_MAX_CONTEXT];
struct ast_ha *contact_ha; /*! \brief Global list of addresses dynamic peers are not allowed to use */
format_t capability; /*!< Supported codecs */
+ int tcp_enabled;
};
/*! \brief The SIP socket definition */
@@ -1008,16 +1010,16 @@ struct sip_pvt {
long invite_branch; /*!< The branch used when we sent the initial INVITE */
int64_t sessionversion_remote; /*!< Remote UA's SDP Session Version */
unsigned int portinuri:1; /*!< Non zero if a port has been specified, will also disable srv lookups */
- struct sockaddr_in sa; /*!< Our peer */
- struct sockaddr_in redirip; /*!< Where our RTP should be going if not to us */
- struct sockaddr_in vredirip; /*!< Where our Video RTP should be going if not to us */
- struct sockaddr_in tredirip; /*!< Where our Text RTP should be going if not to us */
+ struct ast_sockaddr sa; /*!< Our peer */
+ struct ast_sockaddr redirip; /*!< Where our RTP should be going if not to us */
+ struct ast_sockaddr vredirip; /*!< Where our Video RTP should be going if not to us */
+ struct ast_sockaddr tredirip; /*!< Where our Text RTP should be going if not to us */
time_t lastrtprx; /*!< Last RTP received */
time_t lastrtptx; /*!< Last RTP sent */
int rtptimeout; /*!< RTP timeout time */
struct ast_ha *directmediaha; /*!< Which IPs are allowed to interchange direct media with this peer - copied from sip_peer */
- struct sockaddr_in recv; /*!< Received as */
- struct sockaddr_in ourip; /*!< Our IP (as seen from the outside) */
+ struct ast_sockaddr recv; /*!< Received as */
+ struct ast_sockaddr ourip; /*!< Our IP (as seen from the outside) */
enum transfermodes allowtransfer; /*!< REFER: restriction scheme */
struct ast_channel *owner; /*!< Who owns us (if we have an owner) */
struct sip_route *route; /*!< Head of linked list of routing steps (fm Record-Route) */
@@ -1209,7 +1211,7 @@ struct sip_peer {
ast_group_t pickupgroup; /*!< Pickup group */
struct sip_proxy *outboundproxy;/*!< Outbound proxy for this peer */
struct ast_dnsmgr_entry *dnsmgr;/*!< DNS refresh manager for peer */
- struct sockaddr_in addr; /*!< IP address of peer */
+ struct ast_sockaddr addr; /*!< IP address of peer */
unsigned int portinuri:1; /*!< Whether the port should be included in the URI */
struct sip_pvt *call; /*!< Call pointer */
int pokeexpire; /*!< Qualification: When to expire poke (qualify= checking) */
@@ -1217,7 +1219,7 @@ struct sip_peer {
int maxms; /*!< Qualification: Max ms we will accept for the host to be up, 0 to not monitor */
int qualifyfreq; /*!< Qualification: Qualification: How often to check for the host to be up */
struct timeval ps; /*!< Qualification: Time for sending SIP OPTION in sip_pke_peer() */
- struct sockaddr_in defaddr; /*!< Default IP address, used until registration */
+ struct ast_sockaddr defaddr; /*!< Default IP address, used until registration */
struct ast_ha *ha; /*!< Access control list */
struct ast_ha *contactha; /*!< Restrict what IPs are allowed in the Contact header (for registration) */
struct ast_ha *directmediaha; /*!< Restrict what IPs are allowed to interchange direct media with */
@@ -1281,7 +1283,7 @@ struct sip_registry {
int callid_valid; /*!< 0 means we haven't chosen callid for this registry yet. */
unsigned int ocseq; /*!< Sequence number we got to for REGISTERs for this registry */
struct ast_dnsmgr_entry *dnsmgr; /*!< DNS refresh manager for register */
- struct sockaddr_in us; /*!< Who the server thinks we are */
+ struct ast_sockaddr us; /*!< Who the server thinks we are */
int noncecount; /*!< Nonce-count */
char lastmsg[256]; /*!< Last Message sent/received */
};
@@ -1321,7 +1323,7 @@ struct sip_subscription_mwi {
unsigned int subscribed:1; /*!< Whether we are currently subscribed or not */
struct sip_pvt *call; /*!< Outbound subscription dialog */
struct ast_dnsmgr_entry *dnsmgr; /*!< DNS refresh manager for subscription */
- struct sockaddr_in us; /*!< Who the server thinks we are */
+ struct ast_sockaddr us; /*!< Who the server thinks we are */
};
/*!
@@ -1697,8 +1699,7 @@ struct contact {
char *name;
char *user;
char *pass;
- char *host;
- char *port;
+ char *domain;
struct uriparams params;
char *headers;
char *expires;