sip_transport_tls.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJSIP_TRANSPORT_TLS_H__
  20. #define __PJSIP_TRANSPORT_TLS_H__
  21. /**
  22. * @file sip_transport_tls.h
  23. * @brief SIP TLS Transport.
  24. */
  25. #include <pjsip/sip_transport.h>
  26. #include <pj/pool.h>
  27. #include <pj/ssl_sock.h>
  28. #include <pj/string.h>
  29. #include <pj/sock_qos.h>
  30. PJ_BEGIN_DECL
  31. /**
  32. * @defgroup PJSIP_TRANSPORT_TLS TLS Transport
  33. * @ingroup PJSIP_TRANSPORT
  34. * @brief API to create and register TLS transport.
  35. * @{
  36. * The functions below are used to create TLS transport and register
  37. * the transport to the framework.
  38. */
  39. /**
  40. * The default SSL method to be used by PJSIP.
  41. * Default is PJSIP_TLSV1_METHOD
  42. */
  43. #ifndef PJSIP_SSL_DEFAULT_METHOD
  44. # define PJSIP_SSL_DEFAULT_METHOD PJSIP_TLSV1_METHOD
  45. #endif
  46. /** SSL protocol method constants. */
  47. typedef enum pjsip_ssl_method
  48. {
  49. PJSIP_SSL_UNSPECIFIED_METHOD = 0, /**< Default protocol method. */
  50. PJSIP_SSLV2_METHOD = 20, /**< Use SSLv2 method. */
  51. PJSIP_SSLV3_METHOD = 30, /**< Use SSLv3 method. */
  52. PJSIP_TLSV1_METHOD = 31, /**< Use TLSv1 method. */
  53. PJSIP_TLSV1_1_METHOD = 32, /**< Use TLSv1_1 method. */
  54. PJSIP_TLSV1_2_METHOD = 33, /**< Use TLSv1_2 method. */
  55. PJSIP_TLSV1_3_METHOD = 34, /**< Use TLSv1_3 method. */
  56. PJSIP_SSLV23_METHOD = 23, /**< Use SSLv23 method. */
  57. } pjsip_ssl_method;
  58. /**
  59. * The default enabled SSL proto to be used.
  60. * Default is all protocol above TLSv1 (TLSv1 & TLS v1.1 & TLS v1.2).
  61. */
  62. #ifndef PJSIP_SSL_DEFAULT_PROTO
  63. # define PJSIP_SSL_DEFAULT_PROTO (PJ_SSL_SOCK_PROTO_TLS1 | \
  64. PJ_SSL_SOCK_PROTO_TLS1_1 | \
  65. PJ_SSL_SOCK_PROTO_TLS1_2)
  66. #endif
  67. /**
  68. * This structure describe the parameter passed from on_accept_fail_cb().
  69. */
  70. typedef struct pjsip_tls_on_accept_fail_param {
  71. /**
  72. * Local address of the fail accept operation of the TLS listener.
  73. */
  74. const pj_sockaddr_t *local_addr;
  75. /**
  76. * Remote address of the fail accept operation of the TLS listener.
  77. */
  78. const pj_sockaddr_t *remote_addr;
  79. /**
  80. * Error status of the fail accept operation of the TLS listener.
  81. */
  82. pj_status_t status;
  83. /**
  84. * Last error code returned by native SSL backend. Note that this may be
  85. * zero, if the failure is not SSL related (e.g: accept rejection).
  86. */
  87. pj_status_t last_native_err;
  88. } pjsip_tls_on_accept_fail_param;
  89. /**
  90. * This structure describe the parameter passed from on_verify_cb().
  91. */
  92. typedef struct pjsip_tls_on_verify_param {
  93. /**
  94. * Describes local address.
  95. */
  96. const pj_sockaddr_t *local_addr;
  97. /**
  98. * Describes remote address.
  99. */
  100. const pj_sockaddr_t *remote_addr;
  101. /**
  102. * Describes transport direction.
  103. */
  104. pjsip_transport_dir tp_dir;
  105. /**
  106. * Describes active local certificate info.
  107. */
  108. pj_ssl_cert_info *local_cert_info;
  109. /**
  110. * Describes active remote certificate info.
  111. */
  112. pj_ssl_cert_info *remote_cert_info;
  113. /**
  114. * The SSL socket instance.
  115. */
  116. pj_ssl_sock_t *ssock;
  117. } pjsip_tls_on_verify_param;
  118. /**
  119. * TLS transport settings.
  120. */
  121. typedef struct pjsip_tls_setting
  122. {
  123. /**
  124. * Certificate of Authority (CA) list file.
  125. */
  126. pj_str_t ca_list_file;
  127. /**
  128. * Certificate of Authority (CA) list directory path.
  129. */
  130. pj_str_t ca_list_path;
  131. /**
  132. * Public endpoint certificate file, which will be used as client-
  133. * side certificate for outgoing TLS connection, and server-side
  134. * certificate for incoming TLS connection.
  135. */
  136. pj_str_t cert_file;
  137. /**
  138. * Optional private key of the endpoint certificate to be used.
  139. */
  140. pj_str_t privkey_file;
  141. /**
  142. * Certificate of Authority (CA) buffer. If ca_list_file, ca_list_path,
  143. * cert_file or privkey_file are set, this setting will be ignored.
  144. */
  145. pj_ssl_cert_buffer ca_buf;
  146. /**
  147. * Public endpoint certificate buffer, which will be used as client-
  148. * side certificate for outgoing TLS connection, and server-side
  149. * certificate for incoming TLS connection. If ca_list_file, ca_list_path,
  150. * cert_file or privkey_file are set, this setting will be ignored.
  151. */
  152. pj_ssl_cert_buffer cert_buf;
  153. /**
  154. * Optional private key buffer of the endpoint certificate to be used.
  155. * If ca_list_file, ca_list_path, cert_file or privkey_file are set,
  156. * this setting will be ignored.
  157. */
  158. pj_ssl_cert_buffer privkey_buf;
  159. /**
  160. * Lookup certificate from OS certificate store with specified criteria.
  161. *
  162. * Currently only used by TLS backend Windows Schannel, please check
  163. * pj_ssl_cert_load_from_store() for more info.
  164. */
  165. pj_ssl_cert_lookup_criteria cert_lookup;
  166. /**
  167. * Password to open private key.
  168. */
  169. pj_str_t password;
  170. /**
  171. * TLS protocol method from #pjsip_ssl_method. In the future, this field
  172. * might be deprecated in favor of <b>proto</b> field. For now, this field
  173. * is only applicable only when <b>proto</b> field is set to zero.
  174. *
  175. * Default is PJSIP_SSL_UNSPECIFIED_METHOD (0), which in turn will
  176. * use PJSIP_SSL_DEFAULT_METHOD, which default value is PJSIP_TLSV1_METHOD.
  177. */
  178. pjsip_ssl_method method;
  179. /**
  180. * TLS protocol type from #pj_ssl_sock_proto. Use this field to enable
  181. * specific protocol type. Use bitwise OR operation to combine the protocol
  182. * type.
  183. *
  184. * Default is PJSIP_SSL_DEFAULT_PROTO.
  185. */
  186. pj_uint32_t proto;
  187. /**
  188. * Number of ciphers contained in the specified cipher preference.
  189. * If this is set to zero, then default cipher list of the backend
  190. * will be used.
  191. *
  192. * Default: 0 (zero).
  193. */
  194. unsigned ciphers_num;
  195. /**
  196. * Ciphers and order preference. The #pj_ssl_cipher_get_availables()
  197. * can be used to check the available ciphers supported by backend.
  198. */
  199. pj_ssl_cipher *ciphers;
  200. /**
  201. * Number of curves contained in the specified curve preference.
  202. * If this is set to zero, then default curve list of the backend
  203. * will be used.
  204. *
  205. * Default: 0 (zero).
  206. */
  207. unsigned curves_num;
  208. /**
  209. * Curves and order preference. The #pj_ssl_curve_get_availables()
  210. * can be used to check the available curves supported by backend.
  211. */
  212. pj_ssl_curve *curves;
  213. /**
  214. * The supported signature algorithms. Set the sigalgs string
  215. * using this form:
  216. * "<DIGEST>+<ALGORITHM>:<DIGEST>+<ALGORITHM>"
  217. * Digests are: "RSA", "DSA" or "ECDSA"
  218. * Algorithms are: "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512"
  219. * Example: "ECDSA+SHA256:RSA+SHA256"
  220. */
  221. pj_str_t sigalgs;
  222. /**
  223. * Reseed random number generator.
  224. * For type #PJ_SSL_ENTROPY_FILE, parameter \a entropy_path
  225. * must be set to a file.
  226. * For type #PJ_SSL_ENTROPY_EGD, parameter \a entropy_path
  227. * must be set to a socket.
  228. *
  229. * Default value is PJ_SSL_ENTROPY_NONE.
  230. */
  231. pj_ssl_entropy_t entropy_type;
  232. /**
  233. * When using a file/socket for entropy #PJ_SSL_ENTROPY_EGD or
  234. * #PJ_SSL_ENTROPY_FILE, \a entropy_path must contain the path
  235. * to entropy socket/file.
  236. *
  237. * Default value is an empty string.
  238. */
  239. pj_str_t entropy_path;
  240. /**
  241. * Specifies TLS transport behavior on the server TLS certificate
  242. * verification result:
  243. * - If \a verify_server is disabled (set to PJ_FALSE), TLS transport
  244. * will just notify the application via #pjsip_tp_state_callback with
  245. * state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
  246. * - If \a verify_server is enabled (set to PJ_TRUE), TLS transport
  247. * will be shutdown and application will be notified with state
  248. * PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
  249. * error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
  250. *
  251. * In any cases, application can inspect #pjsip_tls_state_info in the
  252. * callback to see the verification detail.
  253. *
  254. * Default value is PJ_FALSE.
  255. */
  256. pj_bool_t verify_server;
  257. /**
  258. * Specifies TLS transport behavior on the client TLS certificate
  259. * verification result:
  260. * - If \a verify_client is disabled (set to PJ_FALSE), TLS transport
  261. * will just notify the application via #pjsip_tp_state_callback with
  262. * state PJSIP_TP_STATE_CONNECTED regardless TLS verification result.
  263. * - If \a verify_client is enabled (set to PJ_TRUE), TLS transport
  264. * will be shutdown and application will be notified with state
  265. * PJSIP_TP_STATE_DISCONNECTED whenever there is any TLS verification
  266. * error, otherwise PJSIP_TP_STATE_CONNECTED will be notified.
  267. *
  268. * In any cases, application can inspect #pjsip_tls_state_info in the
  269. * callback to see the verification detail.
  270. *
  271. * Default value is PJ_FALSE.
  272. */
  273. pj_bool_t verify_client;
  274. /**
  275. * When acting as server (incoming TLS connections), reject inocming
  276. * connection if client doesn't supply a TLS certificate.
  277. *
  278. * This setting corresponds to SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag.
  279. * Default value is PJ_FALSE.
  280. */
  281. pj_bool_t require_client_cert;
  282. /**
  283. * TLS negotiation timeout to be applied for both outgoing and
  284. * incoming connection. If both sec and msec member is set to zero,
  285. * the SSL negotiation doesn't have a timeout.
  286. */
  287. pj_time_val timeout;
  288. /**
  289. * Intial timeout interval to be applied to incoming transports
  290. * (i.e. server side) when no valid data received after a successful
  291. * connection.
  292. *
  293. * Default: PJSIP_TRANSPORT_SERVER_IDLE_TIME_FIRST
  294. */
  295. unsigned initial_timeout;
  296. /**
  297. * Should SO_REUSEADDR be used for the listener socket.
  298. * Default value is PJSIP_TLS_TRANSPORT_REUSEADDR.
  299. */
  300. pj_bool_t reuse_addr;
  301. /**
  302. * QoS traffic type to be set on this transport. When application wants
  303. * to apply QoS tagging to the transport, it's preferable to set this
  304. * field rather than \a qos_param fields since this is more portable.
  305. *
  306. * Default value is PJ_QOS_TYPE_BEST_EFFORT.
  307. */
  308. pj_qos_type qos_type;
  309. /**
  310. * Set the low level QoS parameters to the transport. This is a lower
  311. * level operation than setting the \a qos_type field and may not be
  312. * supported on all platforms.
  313. *
  314. * By default all settings in this structure are disabled.
  315. */
  316. pj_qos_params qos_params;
  317. /**
  318. * Specify if the transport should ignore any errors when setting the QoS
  319. * traffic type/parameters.
  320. *
  321. * Default: PJ_TRUE
  322. */
  323. pj_bool_t qos_ignore_error;
  324. /**
  325. * Specify options to be set on the transport.
  326. *
  327. * By default, this is unset, which means that the underlying sockopt
  328. * params as returned by #pj_ssl_sock_param_default() will be used.
  329. *
  330. */
  331. pj_sockopt_params sockopt_params;
  332. /**
  333. * Specify if the transport should ignore any errors when setting the
  334. * sockopt parameters.
  335. *
  336. * Default: PJ_TRUE
  337. *
  338. */
  339. pj_bool_t sockopt_ignore_error;
  340. /**
  341. * Specify if renegotiation is enabled for TLSv1.2 or earlier.
  342. *
  343. * Default: PJ_TRUE
  344. */
  345. pj_bool_t enable_renegotiation;
  346. /**
  347. * Callback to be called when a accept operation of the TLS listener fails.
  348. *
  349. * @param param The parameter to the callback.
  350. */
  351. void(*on_accept_fail_cb)(const pjsip_tls_on_accept_fail_param *param);
  352. /**
  353. * Callback to be called to verify a new connection. Currently it's only
  354. * implemented for OpenSSL backend.
  355. *
  356. * If this is set, the callback will always be invoked, even when peer
  357. * verification is disabled (pjsip_tls_setting.verify_server/verify_client
  358. * set to PJ_FALSE).
  359. *
  360. * @param param The parameter to the callback.
  361. *
  362. * @return Return PJ_TRUE if succesfully verified.
  363. * If verification failed, connection will be dropped
  364. * immediately.
  365. *
  366. */
  367. pj_bool_t(*on_verify_cb)(const pjsip_tls_on_verify_param *param);
  368. } pjsip_tls_setting;
  369. /**
  370. * This structure defines TLS transport extended info in <tt>ext_info</tt>
  371. * field of #pjsip_transport_state_info for the transport state notification
  372. * callback #pjsip_tp_state_callback.
  373. */
  374. typedef struct pjsip_tls_state_info
  375. {
  376. /**
  377. * SSL socket info.
  378. */
  379. pj_ssl_sock_info *ssl_sock_info;
  380. } pjsip_tls_state_info;
  381. /**
  382. * Initialize TLS setting with default values.
  383. *
  384. * @param tls_opt The TLS setting to be initialized.
  385. */
  386. PJ_INLINE(void) pjsip_tls_setting_default(pjsip_tls_setting *tls_opt)
  387. {
  388. pj_memset(tls_opt, 0, sizeof(*tls_opt));
  389. tls_opt->reuse_addr = PJSIP_TLS_TRANSPORT_REUSEADDR;
  390. tls_opt->qos_type = PJ_QOS_TYPE_BEST_EFFORT;
  391. tls_opt->qos_ignore_error = PJ_TRUE;
  392. tls_opt->sockopt_ignore_error = PJ_TRUE;
  393. tls_opt->proto = PJSIP_SSL_DEFAULT_PROTO;
  394. tls_opt->enable_renegotiation = PJ_TRUE;
  395. tls_opt->initial_timeout = PJSIP_TRANSPORT_SERVER_IDLE_TIME_FIRST;
  396. }
  397. /**
  398. * Copy TLS setting.
  399. *
  400. * @param pool The pool to duplicate strings etc.
  401. * @param dst Destination structure.
  402. * @param src Source structure.
  403. */
  404. PJ_INLINE(void) pjsip_tls_setting_copy(pj_pool_t *pool,
  405. pjsip_tls_setting *dst,
  406. const pjsip_tls_setting *src)
  407. {
  408. pj_memcpy(dst, src, sizeof(*dst));
  409. pj_strdup_with_null(pool, &dst->ca_list_file, &src->ca_list_file);
  410. pj_strdup_with_null(pool, &dst->ca_list_path, &src->ca_list_path);
  411. pj_strdup_with_null(pool, &dst->cert_file, &src->cert_file);
  412. pj_strdup_with_null(pool, &dst->privkey_file, &src->privkey_file);
  413. pj_strdup_with_null(pool, &dst->password, &src->password);
  414. pj_strdup_with_null(pool, &dst->sigalgs, &src->sigalgs);
  415. pj_strdup_with_null(pool, &dst->entropy_path, &src->entropy_path);
  416. pj_strdup(pool, &dst->ca_buf, &src->ca_buf);
  417. pj_strdup(pool, &dst->cert_buf, &src->cert_buf);
  418. pj_strdup(pool, &dst->privkey_buf, &src->privkey_buf);
  419. pj_strdup_with_null(pool, &dst->cert_lookup.keyword,
  420. &src->cert_lookup.keyword);
  421. if (src->ciphers_num) {
  422. unsigned i;
  423. dst->ciphers = (pj_ssl_cipher*) pj_pool_calloc(pool, src->ciphers_num,
  424. sizeof(pj_ssl_cipher));
  425. for (i=0; i<src->ciphers_num; ++i)
  426. dst->ciphers[i] = src->ciphers[i];
  427. }
  428. if (src->curves_num) {
  429. unsigned i;
  430. dst->curves = (pj_ssl_curve*) pj_pool_calloc(pool, src->curves_num,
  431. sizeof(pj_ssl_curve));
  432. for (i=0; i<src->curves_num; ++i)
  433. dst->curves[i] = src->curves[i];
  434. }
  435. }
  436. /**
  437. * Wipe out certificates and keys in the TLS setting buffer.
  438. *
  439. * @param opt TLS setting.
  440. */
  441. PJ_DECL(void) pjsip_tls_setting_wipe_keys(pjsip_tls_setting *opt);
  442. /**
  443. * Register support for SIP TLS transport by creating TLS listener on
  444. * the specified address and port. This function will create an
  445. * instance of SIP TLS transport factory and register it to the
  446. * transport manager.
  447. *
  448. * See also #pjsip_tls_transport_start2() which supports IPv6.
  449. *
  450. * @param endpt The SIP endpoint.
  451. * @param opt Optional TLS settings.
  452. * @param local Optional local address to bind, or specify the
  453. * address to bind the server socket to. Both IP
  454. * interface address and port fields are optional.
  455. * If IP interface address is not specified, socket
  456. * will be bound to PJ_INADDR_ANY. If port is not
  457. * specified, socket will be bound to any port
  458. * selected by the operating system.
  459. * @param a_name Optional published address, which is the address to be
  460. * advertised as the address of this SIP transport.
  461. * It can be set using IP address or hostname.
  462. * If this argument is NULL, then the bound address
  463. * will be used as the published address.
  464. * @param async_cnt Number of simultaneous asynchronous accept()
  465. * operations to be supported. It is recommended that
  466. * the number here corresponds to the number of
  467. * processors in the system (or the number of SIP
  468. * worker threads).
  469. * @param p_factory Optional pointer to receive the instance of the
  470. * SIP TLS transport factory just created.
  471. *
  472. * @return PJ_SUCCESS when the transport has been successfully
  473. * started and registered to transport manager, or
  474. * the appropriate error code.
  475. */
  476. PJ_DECL(pj_status_t) pjsip_tls_transport_start(pjsip_endpoint *endpt,
  477. const pjsip_tls_setting *opt,
  478. const pj_sockaddr_in *local,
  479. const pjsip_host_port *a_name,
  480. unsigned async_cnt,
  481. pjsip_tpfactory **p_factory);
  482. /**
  483. * Variant of #pjsip_tls_transport_start() that supports IPv6. To instantiate
  484. * IPv6 listener, set the address family of the "local" argument to IPv6
  485. * (the host and port part may be left unspecified if not desired, i.e. by
  486. * filling them with zeroes).
  487. *
  488. * @param endpt The SIP endpoint.
  489. * @param opt Optional TLS settings.
  490. * @param local Optional local address to bind, or specify the
  491. * address to bind the server socket to. Both IP
  492. * interface address and port fields are optional.
  493. * If IP interface address is not specified, socket
  494. * will be bound to any address. If port is not
  495. * specified, socket will be bound to any port
  496. * selected by the operating system.
  497. * @param a_name Optional published address, which is the address to be
  498. * advertised as the address of this SIP transport.
  499. * It can be set using IP address or hostname.
  500. * If this argument is NULL, then the bound address
  501. * will be used as the published address.
  502. * @param async_cnt Number of simultaneous asynchronous accept()
  503. * operations to be supported. It is recommended that
  504. * the number here corresponds to the number of
  505. * processors in the system (or the number of SIP
  506. * worker threads).
  507. * @param p_factory Optional pointer to receive the instance of the
  508. * SIP TLS transport factory just created.
  509. *
  510. * @return PJ_SUCCESS when the transport has been successfully
  511. * started and registered to transport manager, or
  512. * the appropriate error code.
  513. */
  514. PJ_DECL(pj_status_t) pjsip_tls_transport_start2(pjsip_endpoint *endpt,
  515. const pjsip_tls_setting *opt,
  516. const pj_sockaddr *local,
  517. const pjsip_host_port *a_name,
  518. unsigned async_cnt,
  519. pjsip_tpfactory **p_factory);
  520. /**
  521. * Start the TLS listener, if the listener is not started yet. This is useful
  522. * to start the listener manually, if listener was not started when
  523. * PJSIP_TLS_TRANSPORT_DONT_CREATE_LISTENER is set to 0.
  524. *
  525. * @param factory The SIP TLS transport factory.
  526. *
  527. * @param local The address where the listener should be bound to.
  528. * Both IP interface address and port fields are optional.
  529. * If IP interface address is not specified, socket
  530. * will be bound to PJ_INADDR_ANY. If port is not
  531. * specified, socket will be bound to any port
  532. * selected by the operating system.
  533. *
  534. * @param a_name The published address for the listener.
  535. * It can be set using IP address or hostname.
  536. * If this argument is NULL, then the bound address will
  537. * be used as the published address.
  538. *
  539. * @return PJ_SUCCESS when the listener has been successfully
  540. * started.
  541. */
  542. PJ_DECL(pj_status_t) pjsip_tls_transport_lis_start(pjsip_tpfactory *factory,
  543. const pj_sockaddr *local,
  544. const pjsip_host_port *a_name);
  545. /**
  546. * Restart the TLS listener. This will close the listener socket and recreate
  547. * the socket based on the config used when starting the transport.
  548. *
  549. * @param factory The SIP TLS transport factory.
  550. *
  551. * @param local The address where the listener should be bound to.
  552. * Both IP interface address and port fields are optional.
  553. * If IP interface address is not specified, socket
  554. * will be bound to PJ_INADDR_ANY. If port is not
  555. * specified, socket will be bound to any port
  556. * selected by the operating system.
  557. *
  558. * @param a_name The published address for the listener.
  559. * It can be set using IP address or hostname.
  560. * If this argument is NULL, then the bound address will
  561. * be used as the published address.
  562. *
  563. * @return PJ_SUCCESS when the listener has been successfully
  564. * restarted.
  565. *
  566. */
  567. PJ_DECL(pj_status_t) pjsip_tls_transport_restart(pjsip_tpfactory *factory,
  568. const pj_sockaddr *local,
  569. const pjsip_host_port *a_name);
  570. PJ_END_DECL
  571. /**
  572. * @}
  573. */
  574. #endif /* __PJSIP_TRANSPORT_TLS_H__ */