Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/tevent/tevent.h

    r740 r988  
    4040struct tevent_immediate;
    4141struct tevent_signal;
     42struct tevent_thread_proxy;
    4243
    4344/**
     
    112113
    113114/**
    114  * @brief Create a event_context structure and name it.
     115 * @brief Create a event_context structure and select a specific backend.
    115116 *
    116117 * This must be the first events call, and all subsequent calls pass this
     
    120121 * @param[in]  mem_ctx  The memory context to use.
    121122 *
    122  * @param[in]  name     The name for the tevent context.
     123 * @param[in]  name     The name of the backend to use.
    123124 *
    124125 * @return              An allocated tevent context, NULL on error.
    125126 */
    126127struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx, const char *name);
     128
     129/**
     130 * @brief Create a custom event context
     131 *
     132 * @param[in]  mem_ctx  The memory context to use.
     133 * @param[in]  ops      The function pointer table of the backend.
     134 * @param[in]  additional_data  The additional/private data to this instance
     135 *
     136 * @return              An allocated tevent context, NULL on error.
     137 *
     138 */
     139struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
     140                                               const struct tevent_ops *ops,
     141                                               void *additional_data);
    127142
    128143/**
     
    137152
    138153/**
    139  * @brief Set the default tevent backent.
     154 * @brief Set the default tevent backend.
    140155 *
    141156 * @param[in]  backend  The name of the backend to set.
     
    163178 * @note To cancel the monitoring of a file descriptor, call talloc_free()
    164179 * on the object returned by this function.
     180 *
     181 * @note The caller should avoid closing the file descriptor before
     182 * calling talloc_free()! Otherwise the behaviour is undefined which
     183 * might result in crashes. See https://bugzilla.samba.org/show_bug.cgi?id=11141
     184 * for an example.
    165185 */
    166186struct tevent_fd *tevent_add_fd(struct tevent_context *ev,
     
    306326 * @note To cancel a signal handler, call talloc_free() on the event returned
    307327 * from this function.
     328 *
     329 * @see tevent_num_signals, tevent_sa_info_queue_count
    308330 */
    309331struct tevent_signal *tevent_add_signal(struct tevent_context *ev,
     
    327349#endif
    328350
     351/**
     352 * @brief the number of supported signals
     353 *
     354 * This returns value of the configure time TEVENT_NUM_SIGNALS constant.
     355 *
     356 * The 'signum' argument of tevent_add_signal() must be less than
     357 * TEVENT_NUM_SIGNALS.
     358 *
     359 * @see tevent_add_signal
     360 */
     361size_t tevent_num_signals(void);
     362
     363/**
     364 * @brief the number of pending realtime signals
     365 *
     366 * This returns value of TEVENT_SA_INFO_QUEUE_COUNT.
     367 *
     368 * The tevent internals remember the last TEVENT_SA_INFO_QUEUE_COUNT
     369 * siginfo_t structures for SA_SIGINFO signals. If the system generates
     370 * more some signals get lost.
     371 *
     372 * @see tevent_add_signal
     373 */
     374size_t tevent_sa_info_queue_count(void);
     375
    329376#ifdef DOXYGEN
    330377/**
     
    502549int tevent_set_debug_stderr(struct tevent_context *ev);
    503550
     551enum tevent_trace_point {
     552        /**
     553         * Corresponds to a trace point just before waiting
     554         */
     555        TEVENT_TRACE_BEFORE_WAIT,
     556        /**
     557         * Corresponds to a trace point just after waiting
     558         */
     559        TEVENT_TRACE_AFTER_WAIT,
     560#define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS 1
     561        /**
     562         * Corresponds to a trace point just before calling
     563         * the loop_once() backend function.
     564         */
     565        TEVENT_TRACE_BEFORE_LOOP_ONCE,
     566        /**
     567         * Corresponds to a trace point right after the
     568         * loop_once() backend function has returned.
     569         */
     570        TEVENT_TRACE_AFTER_LOOP_ONCE,
     571};
     572
     573typedef void (*tevent_trace_callback_t)(enum tevent_trace_point,
     574                                        void *private_data);
     575
     576/**
     577 * Register a callback to be called at certain trace points
     578 *
     579 * @param[in] ev             Event context
     580 * @param[in] cb             Trace callback
     581 * @param[in] private_data   Data to be passed to callback
     582 *
     583 * @note The callback will be called at trace points defined by
     584 * tevent_trace_point.  Call with NULL to reset.
     585 */
     586void tevent_set_trace_callback(struct tevent_context *ev,
     587                               tevent_trace_callback_t cb,
     588                               void *private_data);
     589
     590/**
     591 * Retrieve the current trace callback
     592 *
     593 * @param[in] ev             Event context
     594 * @param[out] cb            Registered trace callback
     595 * @param[out] private_data  Registered data to be passed to callback
     596 *
     597 * @note This can be used to allow one component that wants to
     598 * register a callback to respect the callback that another component
     599 * has already registered.
     600 */
     601void tevent_get_trace_callback(struct tevent_context *ev,
     602                               tevent_trace_callback_t *cb,
     603                               void *private_data);
     604
    504605/**
    505606 * @}
     
    517618 * are considered too low-level to be used in larger computations. To
    518619 * read and write from and to sockets, Samba provides two calls on top
    519  * of tevent_add_fd: read_packet_send/recv and writev_send/recv. These
    520  * requests are much easier to compose than the low-level event
     620 * of tevent_add_fd: tstream_read_packet_send/recv and tstream_writev_send/recv.
     621 * These requests are much easier to compose than the low-level event
    521622 * handlers called from tevent_add_fd.
    522623 *
     
    840941#endif
    841942
     943/**
     944 * @brief A typedef for a cleanup function for a tevent request.
     945 *
     946 * @param[in]  req       The tevent request calling this function.
     947 *
     948 * @param[in]  req_state The current tevent_req_state.
     949 *
     950 */
     951typedef void (*tevent_req_cleanup_fn)(struct tevent_req *req,
     952                                      enum tevent_req_state req_state);
     953
     954/**
     955 * @brief This function sets a cleanup function for the given tevent request.
     956 *
     957 * This function can be used to setup a cleanup function for the given request.
     958 * This will be triggered when the tevent_req_done() or tevent_req_error()
     959 * function was called, before notifying the callers callback function,
     960 * and also before scheduling the deferred trigger.
     961 *
     962 * This might be useful if more than one tevent_req belong together
     963 * and need to finish both requests at the same time.
     964 *
     965 * The cleanup function is able to call tevent_req_done() or tevent_req_error()
     966 * recursively, the cleanup function is only triggered the first time.
     967 *
     968 * The cleanup function is also called by tevent_req_received()
     969 * (possibly triggered from tevent_req_destructor()) before destroying
     970 * the private data of the tevent_req.
     971 *
     972 * @param[in]  req      The request to use.
     973 *
     974 * @param[in]  fn       A pointer to the cancel function.
     975 */
     976void tevent_req_set_cleanup_fn(struct tevent_req *req, tevent_req_cleanup_fn fn);
     977
    842978#ifdef DOXYGEN
    843979/**
     
    852988 * @endcode
    853989 *
    854  * Tevent_req_create() creates the state variable as a talloc child of
    855  * its result. The state variable should be used as the talloc parent
    856  * for all temporary variables that are allocated during the async
     990 * Tevent_req_create() allocates and zeros the state variable as a talloc
     991 * child of its result. The state variable should be used as the talloc
     992 * parent for all temporary variables that are allocated during the async
    857993 * computation. This way, when the user of the async computation frees
    858994 * the request, the state as a talloc child will be free'd along with
     
    9961132#endif
    9971133
     1134#ifdef DOXYGEN
     1135/**
     1136 * @brief Indicate out of memory to a request
     1137 *
     1138 * @param[in]  req      The request being processed.
     1139 */
     1140void tevent_req_oom(struct tevent_req *req);
     1141#else
     1142void _tevent_req_oom(struct tevent_req *req,
     1143                     const char *location);
     1144#define tevent_req_oom(req) \
     1145        _tevent_req_oom(req, __location__)
     1146#endif
     1147
    9981148/**
    9991149 * @brief Finish a request before the caller had the change to set the callback.
     
    10031153 * the engine. To present the illusion of a callback to the user of the API,
    10041154 * the implementation can call this helper function which triggers an
    1005  * immediate timed event. This way the caller can use the same calling
     1155 * immediate event. This way the caller can use the same calling
    10061156 * conventions, independent of whether the request was actually deferred.
    10071157 *
     
    10271177 * @param[in]  req      The finished request.
    10281178 *
    1029  * @param[in]  ev       The tevent_context for the timed event.
     1179 * @param[in]  ev       The tevent_context for the immediate event.
    10301180 *
    10311181 * @return              The given request will be returned.
     
    10331183struct tevent_req *tevent_req_post(struct tevent_req *req,
    10341184                                   struct tevent_context *ev);
     1185
     1186/**
     1187 * @brief Finish multiple requests within one function
     1188 *
     1189 * Normally tevent_req_notify_callback() and all wrappers
     1190 * (e.g. tevent_req_done() and tevent_req_error())
     1191 * need to be the last thing an event handler should call.
     1192 * This is because the callback is likely to destroy the
     1193 * context of the current function.
     1194 *
     1195 * If a function wants to notify more than one caller,
     1196 * it is dangerous if it just triggers multiple callbacks
     1197 * in a row. With tevent_req_defer_callback() it is possible
     1198 * to set an event context that will be used to defer the callback
     1199 * via an immediate event (similar to tevent_req_post()).
     1200 *
     1201 * @code
     1202 * struct complete_state {
     1203 *       struct tevent_context *ev;
     1204 *
     1205 *       struct tevent_req **reqs;
     1206 * };
     1207 *
     1208 * void complete(struct complete_state *state)
     1209 * {
     1210 *       size_t i, c = talloc_array_length(state->reqs);
     1211 *
     1212 *       for (i=0; i < c; i++) {
     1213 *            tevent_req_defer_callback(state->reqs[i], state->ev);
     1214 *            tevent_req_done(state->reqs[i]);
     1215 *       }
     1216 * }
     1217 * @endcode
     1218 *
     1219 * @param[in]  req      The finished request.
     1220 *
     1221 * @param[in]  ev       The tevent_context for the immediate event.
     1222 *
     1223 * @return              The given request will be returned.
     1224 */
     1225void tevent_req_defer_callback(struct tevent_req *req,
     1226                               struct tevent_context *ev);
    10351227
    10361228/**
     
    12191411 * @param[in]  secs     The seconds to set.
    12201412 *
    1221  * @param[in]  usecs    The milliseconds to set.
     1413 * @param[in]  usecs    The microseconds to set.
    12221414 *
    12231415 * @return              A timeval structure with the given values.
     
    12541446 * @param[in]  secs      The seconds to add to the timeval.
    12551447 *
    1256  * @param[in]  usecs     The milliseconds to add to the timeval.
     1448 * @param[in]  usecs     The microseconds to add to the timeval.
    12571449 *
    12581450 * @return               The timeval structure with the new time.
     
    12661458 * @param[in]  secs     The seconds of the offset from now.
    12671459 *
    1268  * @param[in]  usecs    The milliseconds of the offset from now.
     1460 * @param[in]  usecs    The microseconds of the offset from now.
    12691461 *
    12701462 * @return              A timval with the given offset in the future.
     
    12921484
    12931485struct tevent_queue;
     1486struct tevent_queue_entry;
    12941487
    12951488#ifdef DOXYGEN
     
    13031496 * @return              An allocated tevent queue on success, NULL on error.
    13041497 *
    1305  * @see tevent_start()
    1306  * @see tevent_stop()
     1498 * @see tevent_queue_start()
     1499 * @see tevent_queue_stop()
    13071500 */
    13081501struct tevent_queue *tevent_queue_create(TALLOC_CTX *mem_ctx,
     
    13261519 *
    13271520 * @see tevent_queue_add()
     1521 * @see tevent_queue_add_entry()
     1522 * @see tevent_queue_add_optimize_empty()
    13281523 */
    13291524typedef void (*tevent_queue_trigger_fn_t)(struct tevent_req *req,
     
    13401535 *
    13411536 * @param[in]  trigger  The function triggered by the queue when the request
    1342  *                      is called.
     1537 *                      is called. Since tevent 0.9.14 it's possible to
     1538 *                      pass NULL, in order to just add a "blocker" to the
     1539 *                      queue.
    13431540 *
    13441541 * @param[in]  private_data The private data passed to the trigger function.
     
    13541551
    13551552/**
     1553 * @brief Add a tevent request to the queue.
     1554 *
     1555 * The request can be removed from the queue by calling talloc_free()
     1556 * (or a similar function) on the returned queue entry. This
     1557 * is the only difference to tevent_queue_add().
     1558 *
     1559 * @param[in]  queue    The queue to add the request.
     1560 *
     1561 * @param[in]  ev       The event handle to use for the request.
     1562 *
     1563 * @param[in]  req      The tevent request to add to the queue.
     1564 *
     1565 * @param[in]  trigger  The function triggered by the queue when the request
     1566 *                      is called. Since tevent 0.9.14 it's possible to
     1567 *                      pass NULL, in order to just add a "blocker" to the
     1568 *                      queue.
     1569 *
     1570 * @param[in]  private_data The private data passed to the trigger function.
     1571 *
     1572 * @return              a pointer to the tevent_queue_entry if the request
     1573 *                      has been successfully added, NULL otherwise.
     1574 *
     1575 * @see tevent_queue_add()
     1576 * @see tevent_queue_add_optimize_empty()
     1577 */
     1578struct tevent_queue_entry *tevent_queue_add_entry(
     1579                                        struct tevent_queue *queue,
     1580                                        struct tevent_context *ev,
     1581                                        struct tevent_req *req,
     1582                                        tevent_queue_trigger_fn_t trigger,
     1583                                        void *private_data);
     1584
     1585/**
     1586 * @brief Add a tevent request to the queue using a possible optimization.
     1587 *
     1588 * This tries to optimize for the empty queue case and may calls
     1589 * the trigger function directly. This is the only difference compared
     1590 * to tevent_queue_add_entry().
     1591 *
     1592 * The caller needs to be prepared that the trigger function has
     1593 * already called tevent_req_notify_callback(), tevent_req_error(),
     1594 * tevent_req_done() or a similar function.
     1595 *
     1596 * The request can be removed from the queue by calling talloc_free()
     1597 * (or a similar function) on the returned queue entry.
     1598 *
     1599 * @param[in]  queue    The queue to add the request.
     1600 *
     1601 * @param[in]  ev       The event handle to use for the request.
     1602 *
     1603 * @param[in]  req      The tevent request to add to the queue.
     1604 *
     1605 * @param[in]  trigger  The function triggered by the queue when the request
     1606 *                      is called. Since tevent 0.9.14 it's possible to
     1607 *                      pass NULL, in order to just add a "blocker" to the
     1608 *                      queue.
     1609 *
     1610 * @param[in]  private_data The private data passed to the trigger function.
     1611 *
     1612 * @return              a pointer to the tevent_queue_entry if the request
     1613 *                      has been successfully added, NULL otherwise.
     1614 *
     1615 * @see tevent_queue_add()
     1616 * @see tevent_queue_add_entry()
     1617 */
     1618struct tevent_queue_entry *tevent_queue_add_optimize_empty(
     1619                                        struct tevent_queue *queue,
     1620                                        struct tevent_context *ev,
     1621                                        struct tevent_req *req,
     1622                                        tevent_queue_trigger_fn_t trigger,
     1623                                        void *private_data);
     1624
     1625/**
    13561626 * @brief Start a tevent queue.
    13571627 *
     
    13791649 */
    13801650size_t tevent_queue_length(struct tevent_queue *queue);
     1651
     1652/**
     1653 * @brief Is the tevent queue running.
     1654 *
     1655 * The queue is started by default.
     1656 *
     1657 * @param[in]  queue    The queue.
     1658 *
     1659 * @return              Wether the queue is running or not..
     1660 */
     1661bool tevent_queue_running(struct tevent_queue *queue);
     1662
     1663/**
     1664 * @brief Create a tevent subrequest that waits in a tevent_queue
     1665 *
     1666 * The idea is that always the same syntax for tevent requests.
     1667 *
     1668 * @param[in]  mem_ctx  The talloc memory context to use.
     1669 *
     1670 * @param[in]  ev       The event handle to setup the request.
     1671 *
     1672 * @param[in]  queue    The queue to wait in.
     1673 *
     1674 * @return              The new subrequest, NULL on error.
     1675 *
     1676 * @see tevent_queue_wait_recv()
     1677 */
     1678struct tevent_req *tevent_queue_wait_send(TALLOC_CTX *mem_ctx,
     1679                                          struct tevent_context *ev,
     1680                                          struct tevent_queue *queue);
     1681
     1682/**
     1683 * @brief Check if we no longer need to wait in the queue.
     1684 *
     1685 * This function needs to be called in the callback function set after calling
     1686 * tevent_queue_wait_send().
     1687 *
     1688 * @param[in]  req      The tevent request to check.
     1689 *
     1690 * @return              True on success, false otherwise.
     1691 *
     1692 * @see tevent_queue_wait_send()
     1693 */
     1694bool tevent_queue_wait_recv(struct tevent_req *req);
    13811695
    13821696typedef int (*tevent_nesting_hook)(struct tevent_context *ev,
     
    13861700                                   void *stack_ptr,
    13871701                                   const char *location);
     1702
     1703/**
     1704 * @brief Create a tevent_thread_proxy for message passing between threads.
     1705 *
     1706 * The tevent_context must have been allocated on the NULL
     1707 * talloc context, and talloc_disable_null_tracking() must
     1708 * have been called.
     1709 *
     1710 * @param[in]  dest_ev_ctx      The tevent_context to receive events.
     1711 *
     1712 * @return              An allocated tevent_thread_proxy, NULL on error.
     1713 *                      If tevent was compiled without PTHREAD support
     1714 *                      NULL is always returned and errno set to ENOSYS.
     1715 *
     1716 * @see tevent_thread_proxy_schedule()
     1717 */
     1718struct tevent_thread_proxy *tevent_thread_proxy_create(
     1719                struct tevent_context *dest_ev_ctx);
     1720
     1721/**
     1722 * @brief Schedule an immediate event on an event context from another thread.
     1723 *
     1724 * Causes dest_ev_ctx, being run by another thread, to receive an
     1725 * immediate event calling the handler with the *pp_private parameter.
     1726 *
     1727 * *pp_im must be a pointer to an immediate event talloced on a context owned
     1728 * by the calling thread, or the NULL context. Ownership will
     1729 * be transferred to the tevent_thread_proxy and *pp_im will be returned as NULL.
     1730 *
     1731 * *pp_private_data must be a talloced area of memory with no destructors.
     1732 * Ownership of this memory will be transferred to the tevent library and
     1733 * *pp_private_data will be set to NULL on successful completion of
     1734 * the call. Set pp_private to NULL if no parameter transfer
     1735 * needed (a pure callback). This is an asynchronous request, caller
     1736 * does not wait for callback to be completed before returning.
     1737 *
     1738 * @param[in]  tp               The tevent_thread_proxy to use.
     1739 *
     1740 * @param[in]  pp_im            Pointer to immediate event pointer.
     1741 *
     1742 * @param[in]  handler          The function that will be called.
     1743 *
     1744 * @param[in]  pp_private_data  The talloced memory to transfer.
     1745 *
     1746 * @see tevent_thread_proxy_create()
     1747 */
     1748void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp,
     1749                                  struct tevent_immediate **pp_im,
     1750                                  tevent_immediate_handler_t handler,
     1751                                  void *pp_private_data);
     1752
    13881753#ifdef TEVENT_DEPRECATED
    13891754#ifndef _DEPRECATED_
Note: See TracChangeset for help on using the changeset viewer.