Expose functions need by backend writers
authorSimo Sorce <idra@samba.org>
Fri, 19 Jun 2009 00:06:00 +0000 (20:06 -0400)
committerKarolin Seeger <kseeger@samba.org>
Wed, 9 Sep 2009 10:27:15 +0000 (12:27 +0200)
move publicly needed structures and functions in the public header.
Stop installing internal headers.
Update the signature and exports files with the new exposed
function.
(cherry picked from commit 30b2014a01b31d66dd76e0562c5d769dfacf167b)

tevent/tevent.exports
tevent/tevent.h
tevent/tevent.mk
tevent/tevent.signatures
tevent/tevent_internal.h

index 7d55c17e5d7759570bf9bee03eb9438145f679ce..b1554dff4ee26fbad060577c2aa481a5e57cc1ef 100644 (file)
@@ -21,6 +21,7 @@
            tevent_queue_length;
            tevent_queue_start;
            tevent_queue_stop;
+           tevent_register_backend;
            _tevent_req_callback_data;
            _tevent_req_create;
            _tevent_req_data;
index 2cbd175e73f5add07af71dc6ba13466864d7fd19..56ae0ee0820e4f2fc86bf0777fa11f04c0aa5e52 100644 (file)
@@ -358,6 +358,70 @@ int _tevent_loop_until(struct tevent_context *ev,
        _tevent_loop_until(ev, finished, private_data, __location__)
 #endif
 
+
+/**
+ * The following structure and registration functions are exclusively
+ * needed for people writing and pluggin a different event engine.
+ * There is nothing useful for normal tevent user in here.
+ */
+
+struct tevent_ops {
+       /* context init */
+       int (*context_init)(struct tevent_context *ev);
+
+       /* fd_event functions */
+       struct tevent_fd *(*add_fd)(struct tevent_context *ev,
+                                   TALLOC_CTX *mem_ctx,
+                                   int fd, uint16_t flags,
+                                   tevent_fd_handler_t handler,
+                                   void *private_data,
+                                   const char *handler_name,
+                                   const char *location);
+       void (*set_fd_close_fn)(struct tevent_fd *fde,
+                               tevent_fd_close_fn_t close_fn);
+       uint16_t (*get_fd_flags)(struct tevent_fd *fde);
+       void (*set_fd_flags)(struct tevent_fd *fde, uint16_t flags);
+
+       /* timed_event functions */
+       struct tevent_timer *(*add_timer)(struct tevent_context *ev,
+                                         TALLOC_CTX *mem_ctx,
+                                         struct timeval next_event,
+                                         tevent_timer_handler_t handler,
+                                         void *private_data,
+                                         const char *handler_name,
+                                         const char *location);
+
+       /* immediate event functions */
+       void (*schedule_immediate)(struct tevent_immediate *im,
+                                  struct tevent_context *ev,
+                                  tevent_immediate_handler_t handler,
+                                  void *private_data,
+                                  const char *handler_name,
+                                  const char *location);
+
+       /* signal functions */
+       struct tevent_signal *(*add_signal)(struct tevent_context *ev,
+                                           TALLOC_CTX *mem_ctx,
+                                           int signum, int sa_flags,
+                                           tevent_signal_handler_t handler,
+                                           void *private_data,
+                                           const char *handler_name,
+                                           const char *location);
+
+       /* loop functions */
+       int (*loop_once)(struct tevent_context *ev, const char *location);
+       int (*loop_wait)(struct tevent_context *ev, const char *location);
+};
+
+bool tevent_register_backend(const char *name, const struct tevent_ops *ops);
+
+
+/**
+ * The following definitions are usueful only for compatibility with the
+ * implementation originally developed within the samba4 code and will be
+ * soon removed. Please NEVER use in new code.
+ */
+
 #ifdef TEVENT_COMPAT_DEFINES
 
 #define event_context  tevent_context
index 82cc4a0860bf80df71bfc98f5c56bddb58c3595a..480366e9387d9a99e6745ea6669dd129b9d64eca 100644 (file)
@@ -22,7 +22,6 @@ installdirs::
 
 installheaders:: installdirs
        cp $(srcdir)/tevent.h $(DESTDIR)$(includedir)
-       cp $(srcdir)/tevent_internal.h $(DESTDIR)$(includedir)
 
 installlibs:: installdirs
        cp tevent.pc $(DESTDIR)$(libdir)/pkgconfig
index fab5f6455986220e35a23e94a60e2d7c75f2db70..190522f8ecafef0b53c0bdcdd247c6e119482ac9 100644 (file)
@@ -7,7 +7,7 @@ uint16_t tevent_fd_get_flags (struct tevent_fd *);
 void tevent_fd_set_flags (struct tevent_fd *, uint16_t);
 _Bool tevent_signal_support (struct tevent_context *);
 void tevent_set_abort_fn (void (*) (const char *));
-int tevent_set_debug (struct tevent_context *, void (*) (void *, enum tevent_debug_level, const char *, __va_list_tag *), void *);
+int tevent_set_debug (struct tevent_context *, void (*) (void *, enum tevent_debug_level, const char *, va_list), void *);
 int tevent_set_debug_stderr (struct tevent_context *);
 void tevent_req_set_callback (struct tevent_req *, tevent_req_fn, void *);
 void *_tevent_req_callback_data (struct tevent_req *);
@@ -44,6 +44,7 @@ size_t tevent_queue_length (struct tevent_queue *);
 void tevent_loop_allow_nesting (struct tevent_context *);
 void tevent_loop_set_nesting_hook (struct tevent_context *, tevent_nesting_hook, void *);
 int _tevent_loop_until (struct tevent_context *, _Bool (*) (void *), void *, const char *);
+_Bool tevent_register_backend (const char *, const struct tevent_ops *);
 struct tevent_context *tevent_context_init (TALLOC_CTX *);
 struct tevent_context *tevent_context_init_byname (TALLOC_CTX *, const char *);
 const char **tevent_backend_list (TALLOC_CTX *);
index 54368e2aca0b110c217b0beeb8021b54bd345574..1ac648b48c275b213d5c6127522433e8a2ad532b 100644 (file)
@@ -130,54 +130,6 @@ struct tevent_req {
        } internal;
 };
 
-struct tevent_ops {
-       /* conntext init */
-       int (*context_init)(struct tevent_context *ev);
-
-       /* fd_event functions */
-       struct tevent_fd *(*add_fd)(struct tevent_context *ev,
-                                   TALLOC_CTX *mem_ctx,
-                                   int fd, uint16_t flags,
-                                   tevent_fd_handler_t handler,
-                                   void *private_data,
-                                   const char *handler_name,
-                                   const char *location);
-       void (*set_fd_close_fn)(struct tevent_fd *fde,
-                               tevent_fd_close_fn_t close_fn);
-       uint16_t (*get_fd_flags)(struct tevent_fd *fde);
-       void (*set_fd_flags)(struct tevent_fd *fde, uint16_t flags);
-
-       /* timed_event functions */
-       struct tevent_timer *(*add_timer)(struct tevent_context *ev,
-                                         TALLOC_CTX *mem_ctx,
-                                         struct timeval next_event,
-                                         tevent_timer_handler_t handler,
-                                         void *private_data,
-                                         const char *handler_name,
-                                         const char *location);
-
-       /* immediate event functions */
-       void (*schedule_immediate)(struct tevent_immediate *im,
-                                  struct tevent_context *ev,
-                                  tevent_immediate_handler_t handler,
-                                  void *private_data,
-                                  const char *handler_name,
-                                  const char *location);
-
-       /* signal functions */
-       struct tevent_signal *(*add_signal)(struct tevent_context *ev,
-                                           TALLOC_CTX *mem_ctx,
-                                           int signum, int sa_flags,
-                                           tevent_signal_handler_t handler,
-                                           void *private_data,
-                                           const char *handler_name,
-                                           const char *location);
-
-       /* loop functions */
-       int (*loop_once)(struct tevent_context *ev, const char *location);
-       int (*loop_wait)(struct tevent_context *ev, const char *location);
-};
-
 struct tevent_fd {
        struct tevent_fd *prev, *next;
        struct tevent_context *event_ctx;
@@ -283,8 +235,6 @@ struct tevent_context {
 };
 
 
-bool tevent_register_backend(const char *name, const struct tevent_ops *ops);
-
 int tevent_common_context_destructor(struct tevent_context *ev);
 int tevent_common_loop_wait(struct tevent_context *ev,
                            const char *location);