logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST
Author
ShermB



Joined: 21 Sep 2007
Posts: 2

PostPosted: Fri 21 Sep '07 0:45    Post subject: APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST Reply with quote

No question is too dumb. Right? Would anyone care to explain the following code in found in mod_dav.c. I know the macros expand into a function. But what's the relationship of these hooks with the register_hooks functions. How are they invoked, and where are they invoked, and when are they invoked? What order, for example? Thanks for any guidance.


Code:

APR_HOOK_STRUCT(
    APR_HOOK_LINK(gather_propsets)
    APR_HOOK_LINK(find_liveprop)
    APR_HOOK_LINK(insert_all_liveprops)
    )

APR_IMPLEMENT_EXTERNAL_HOOK_VOID(dav, DAV, gather_propsets,
                                 (apr_array_header_t *uris),
                                 (uris))

APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(dav, DAV, int, find_liveprop,
                                      (const dav_resource *resource,
                                       const char *ns_uri, const char *name,
                                       const dav_hooks_liveprop **hooks),
                                      (resource, ns_uri, name, hooks), 0)

APR_IMPLEMENT_EXTERNAL_HOOK_VOID(dav, DAV, insert_all_liveprops,
                                 (request_rec *r, const dav_resource *resource,
                                  dav_prop_insert what, apr_text_header *phdr),
                                 (r, resource, what, phdr))[code][/code]
[/code]
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Fri 21 Sep '07 2:59    Post subject: Reply with quote

In addition to using existing Apache hooks - mod_dav provides additional hooks for other modules to use.
These three new hooks (gather_propsets, find_liveprop, and insert_all_liveprops) are provided by mod_dav, not used by mod_dav.

Nothing else in Apache uses these three hooks - but an example of a 3rd-party module which does use them is the Subversion module, mod_dav_svn.
mod_dav_svn.c registers callbacks for all three in its register_hooks function .

If you want to understand this stuff, I recommend Nick Kew's book: The Apache Modules Book ISBN: 0-13-240967-4, Prentice Hall.
Chapter 10 explains this in detail - but it's a bit long for a forum post.

-tom-
Back to top
ShermB



Joined: 21 Sep 2007
Posts: 2

PostPosted: Fri 21 Sep '07 15:39    Post subject: Reply with quote

Thanks for the book recommendation!
Back to top


Reply to topic   Topic: APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads