diff options
Diffstat (limited to 'pjlib/include')
-rw-r--r-- | pjlib/include/pj/ioqueue.h | 24 | ||||
-rw-r--r-- | pjlib/include/pj/sock.h | 27 |
2 files changed, 31 insertions, 20 deletions
diff --git a/pjlib/include/pj/ioqueue.h b/pjlib/include/pj/ioqueue.h index 6a7b827e..2e084fd3 100644 --- a/pjlib/include/pj/ioqueue.h +++ b/pjlib/include/pj/ioqueue.h @@ -82,11 +82,10 @@ PJ_BEGIN_DECL *
* The items below describe rules that must be obeyed when using the I/O
* queue, with regard to concurrency:
- * - in general, the I/O queue is thread safe (assuming the lock strategy
- * is not changed to disable mutex protection). All operations, except
- * unregistration which is described below, can be safely invoked
- * simultaneously by multiple threads.
- * - however, <b>care must be taken when unregistering a key</b> from the
+ * - simultaneous operations (by different threads) to different key is safe.
+ * - simultaneous operations to the same key is also safe, except
+ * <b>unregistration</b>, which is described below.
+ * - <b>care must be taken when unregistering a key</b> from the
* ioqueue. Application must take care that when one thread is issuing
* an unregistration, other thread is not simultaneously invoking an
* operation <b>to the same key</b>.
@@ -205,11 +204,16 @@ typedef enum pj_ioqueue_operation_e } pj_ioqueue_operation_e; -/** - * Indicates that the I/O Queue should be created to handle reasonable - * number of threads. - */ -#define PJ_IOQUEUE_DEFAULT_THREADS 0 +/**
+ * This macro specifies the maximum number of events that can be
+ * processed by the ioqueue on a single poll cycle, on implementation
+ * that supports it. The value is only meaningfull when specified
+ * during PJLIB build.
+ */
+#ifndef PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL
+# define PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL (16)
+#endif
+ /** * Create a new I/O Queue framework. diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h index 79f161f2..6dfbaf29 100644 --- a/pjlib/include/pj/sock.h +++ b/pjlib/include/pj/sock.h @@ -69,7 +69,7 @@ extern const pj_uint16_t PJ_SOCK_RDM; /**< Reliably-delivered messages. */ /** - * Socket level specified in #pj_sock_setsockopt(). + * Socket level specified in #pj_sock_setsockopt() or #pj_sock_getsockopt(). * APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOL_*, BECAUSE * THE LIBRARY WILL TRANSLATE THE VALUE TO THE NATIVE VALUE. */ @@ -78,6 +78,15 @@ extern const pj_uint16_t PJ_SOL_IP; /**< IP level. */ extern const pj_uint16_t PJ_SOL_TCP; /**< TCP level. */ extern const pj_uint16_t PJ_SOL_UDP; /**< UDP level. */ extern const pj_uint16_t PJ_SOL_IPV6; /**< IP version 6 */ +
+/**
+ * Values to be specified as \c optname when calling #pj_sock_setsockopt()
+ * or #pj_sock_getsockopt().
+ */
+extern const pj_uint16_t PJ_SO_TYPE; /**< Socket type. */
+extern const pj_uint16_t PJ_SO_RCVBUF; /**< Buffer size for receive. */
+extern const pj_uint16_t PJ_SO_SNDBUF; /**< Buffer size for send. */
+
/** * Flags to be specified in #pj_sock_recv, #pj_sock_send, etc. @@ -419,7 +428,7 @@ PJ_DECL(pj_status_t) pj_sock_socket(int family, * @return Zero on success. */ PJ_DECL(pj_status_t) pj_sock_close(pj_sock_t sockfd); - +
/** * This function gives the socket sockfd the local address my_addr. my_addr is @@ -539,8 +548,7 @@ PJ_DECL(pj_status_t) pj_sock_getsockname( pj_sock_t sockfd, * * @param sockfd The socket descriptor. * @param level The level which to get the option from. - * @param optname The option name, which will be passed uninterpreted - * by the library. + * @param optname The option name. * @param optval Identifies the buffer which the value will be * returned. * @param optlen Initially contains the length of the buffer, upon @@ -549,8 +557,8 @@ PJ_DECL(pj_status_t) pj_sock_getsockname( pj_sock_t sockfd, * @return Zero on success. */ PJ_DECL(pj_status_t) pj_sock_getsockopt( pj_sock_t sockfd, - int level, - int optname, + pj_uint16_t level, + pj_uint16_t optname, void *optval, int *optlen); /** @@ -560,16 +568,15 @@ PJ_DECL(pj_status_t) pj_sock_getsockopt( pj_sock_t sockfd, * * @param sockfd The socket descriptor. * @param level The level which to get the option from. - * @param optname The option name, which will be passed uninterpreted - * by the library. + * @param optname The option name. * @param optval Identifies the buffer which contain the value. * @param optlen The length of the value. * * @return PJ_SUCCESS or the status code. */ PJ_DECL(pj_status_t) pj_sock_setsockopt( pj_sock_t sockfd, - int level, - int optname, + pj_uint16_t level, + pj_uint16_t optname, const void *optval, int optlen); |