summaryrefslogtreecommitdiff
path: root/pjlib/include/pj
diff options
context:
space:
mode:
authorRiza Sulistyo <riza@teluu.com>2014-06-19 05:07:12 +0000
committerRiza Sulistyo <riza@teluu.com>2014-06-19 05:07:12 +0000
commit727da5e28aa110f7931b696f1b1ba74e805bb9b4 (patch)
treef512a06809c4607bc07cd0c877f549a1ba09e580 /pjlib/include/pj
parent97ebde15f373555da8309c7ebe657a2492b818b6 (diff)
Re #1771: Implement run-time configuration to set specific socket option.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4860 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj')
-rw-r--r--pjlib/include/pj/sock.h37
-rw-r--r--pjlib/include/pj/ssl_sock.h16
2 files changed, 53 insertions, 0 deletions
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index b7d1cb05..44d0fecd 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -616,6 +616,32 @@ typedef struct pj_ip_mreq {
pj_in_addr imr_interface; /**< local IP address of interface. */
} pj_ip_mreq;
+/* Maximum number of socket options. */
+#define PJ_MAX_SOCKOPT_PARAMS 4
+
+/**
+ * Options to be set for the socket.
+ */
+typedef struct pj_sockopt_params
+{
+ /* The number of options to be applied. */
+ unsigned cnt;
+
+ /* Array of options to be applied. */
+ struct {
+ /* The level at which the option is defined. */
+ int level;
+
+ /* Option name. */
+ int optname;
+
+ /* Pointer to the buffer in which the option is specified. */
+ void *optval;
+
+ /* Buffer size of the buffer pointed by optval. */
+ int optlen;
+ } options[PJ_MAX_SOCKOPT_PARAMS];
+} pj_sockopt_params;
/*****************************************************************************
*
@@ -1305,6 +1331,17 @@ PJ_DECL(pj_status_t) pj_sock_setsockopt( pj_sock_t sockfd,
const void *optval,
int optlen);
+/**
+ * Set socket options associated with a socket. This method will apply all the
+ * options specified, and ignore any errors that might be raised.
+ *
+ * @param sockfd The socket descriptor.
+ * @param params The socket options.
+ *
+ * @return PJ_SUCCESS or the last error code.
+ */
+PJ_DECL(pj_status_t) pj_sock_setsockopt_params( pj_sock_t sockfd,
+ const pj_sockopt_params *params);
/**
* Helper function to set socket buffer size using #pj_sock_setsockopt()
diff --git a/pjlib/include/pj/ssl_sock.h b/pjlib/include/pj/ssl_sock.h
index 0d24a494..23843717 100644
--- a/pjlib/include/pj/ssl_sock.h
+++ b/pjlib/include/pj/ssl_sock.h
@@ -749,6 +749,22 @@ typedef struct pj_ssl_sock_param
*/
pj_bool_t qos_ignore_error;
+ /**
+ * Specify options to be set on the transport.
+ *
+ * By default there is no options.
+ *
+ */
+ pj_sockopt_params sockopt_params;
+
+ /**
+ * Specify if the transport should ignore any errors when setting the
+ * sockopt parameters.
+ *
+ * Default: PJ_TRUE
+ *
+ */
+ pj_bool_t sockopt_ignore_error;
} pj_ssl_sock_param;