diff --git a/.gitignore b/.gitignore index 8d246ebf7..e55bbd9b2 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,7 @@ test/server.xml # patch files **/*.patch + +# doxygen +doxygen-out + diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 000000000..b301f429e --- /dev/null +++ b/Doxyfile @@ -0,0 +1,20 @@ +PROJECT_NAME = mod_proxy_cluster +PROJECT_NUMBER = 2.0 +PROJECT_BRIEF = An inteligent load-balancer for Apache httpd +PROJECT_LOGO = +OUTPUT_DIRECTORY = doxygen-out +JAVADOC_AUTOBRIEF = YES +OPTIMIZE_OUTPUT_FOR_C = YES +EXTRACT_ALL = YES +INPUT = native README.md +FILE_PATTERNS = *.c \ + *.cc \ + *.cpp \ + *.h \ + *.hpp +RECURSIVE = YES +EXCLUDE = test native/build +EXCLUDE_PATTERNS = *CMake* +USE_MDFILE_AS_MAINPAGE = README.md +GENERATE_LATEX = NO +HTML_COLORSTYLE = LIGHT diff --git a/README.md b/README.md index bffa5807c..9d7f585d3 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,12 @@ Tests The project contains some tests too. You can find them with a separate README in the `test` subdirectory. +Doxygen documentation +--------------------- + +The project source files contain doxygen-style comments. To build doxygen doumentation, execute `doxygen` command. +The output can be found in newly created `doxygen-out/` directory. + License ------- diff --git a/native/balancers/mod_lbmethod_cluster.c b/native/balancers/mod_lbmethod_cluster.c index 1550fdd5c..8c75fedf4 100644 --- a/native/balancers/mod_lbmethod_cluster.c +++ b/native/balancers/mod_lbmethod_cluster.c @@ -174,7 +174,7 @@ static const proxy_balancer_method cluster = {"cluster", &find_best, NULL, &rese /* * See if we could map the request. - * first check is we have a balancer corresponding to the route. + * First check is we have a balancer corresponding to the route, * then search the balancer correspond to the context and host. */ static int lbmethod_cluster_trans(request_rec *r) diff --git a/native/common/common.c b/native/common/common.c index 9dd7a9b97..73e7015cf 100644 --- a/native/common/common.c +++ b/native/common/common.c @@ -1,7 +1,3 @@ -/* - * Common routines - */ - #include "common.h" #include "httpd.h" @@ -21,7 +17,7 @@ #include "mod_proxy_cluster.h" -/* Read the virtual host table from shared memory */ + proxy_vhost_table *read_vhost_table(apr_pool_t *pool, struct host_storage_method *host_storage, int for_cache) { int i; @@ -51,7 +47,6 @@ proxy_vhost_table *read_vhost_table(apr_pool_t *pool, struct host_storage_method return vhost_table; } -/* Update the virtual host table from shared memory to populate a cached table */ proxy_vhost_table *update_vhost_table_cached(proxy_vhost_table *vhost_table, const struct host_storage_method *host_storage) { @@ -75,7 +70,6 @@ proxy_vhost_table *update_vhost_table_cached(proxy_vhost_table *vhost_table, return vhost_table; } -/* Read the context table from shared memory */ proxy_context_table *read_context_table(apr_pool_t *pool, const struct context_storage_method *context_storage, int for_cache) { @@ -105,7 +99,6 @@ proxy_context_table *read_context_table(apr_pool_t *pool, const struct context_s return context_table; } -/* Update the context table from shared memory to populate a cached table */ proxy_context_table *update_context_table_cached(proxy_context_table *context_table, const struct context_storage_method *context_storage) { @@ -128,7 +121,6 @@ proxy_context_table *update_context_table_cached(proxy_context_table *context_ta return context_table; } -/* Read the balancer table from shared memory */ proxy_balancer_table *read_balancer_table(apr_pool_t *pool, const struct balancer_storage_method *balancer_storage, int for_cache) { @@ -158,7 +150,6 @@ proxy_balancer_table *read_balancer_table(apr_pool_t *pool, const struct balance return balancer_table; } -/* Update the balancer table from shared memory to populate a cached table */ proxy_balancer_table *update_balancer_table_cached(proxy_balancer_table *balancer_table, const struct balancer_storage_method *balancer_storage) { @@ -181,7 +172,6 @@ proxy_balancer_table *update_balancer_table_cached(proxy_balancer_table *balance return balancer_table; } -/* Read the node table from shared memory */ proxy_node_table *read_node_table(apr_pool_t *pool, const struct node_storage_method *node_storage, int for_cache) { int i; @@ -219,7 +209,6 @@ proxy_node_table *read_node_table(apr_pool_t *pool, const struct node_storage_me return node_table; } -/* Update the node table from shared memory to populate a cached table*/ proxy_node_table *update_node_table_cached(proxy_node_table *node_table, const struct node_storage_method *node_storage) { int i; @@ -248,13 +237,6 @@ proxy_node_table *update_node_table_cached(proxy_node_table *node_table, const s return node_table; } -/* - * Read the cookie corresponding to name - * @param r request. - * @param name name of the cookie - * @param in tells if cookie should read from the request or the response - * @return the value of the cookie - */ char *get_cookie_param(request_rec *r, const char *name, int in) { const char *cookies; @@ -302,12 +284,6 @@ char *get_cookie_param(request_rec *r, const char *name, int in) return NULL; } -/** - * Retrieve the parameter with the given name - * Something like 'JSESSIONID=12345...N' - * - * TODO: Should use the mod_proxy_balancer one - */ char *get_path_param(apr_pool_t *pool, char *url, const char *name) { char *path = NULL; @@ -334,13 +310,6 @@ char *get_path_param(apr_pool_t *pool, char *url, const char *name) return NULL; } -/** - * Check that the request has a sessionid with a route - * @param r the request_rec. - * @param stickyval the cookie or/and parameter name. - * @param uri part of the URL to for the session parameter. - * @param sticky_used the string that was used to find the route - */ char *cluster_get_sessionid(request_rec *r, const char *stickyval, char *uri, char **sticky_used) { char *sticky, *sticky_path; @@ -362,13 +331,6 @@ char *cluster_get_sessionid(request_rec *r, const char *stickyval, char *uri, ch return route; } -/** - * Check that the request has a sessionid (even invalid) - * @param r the request_rec. - * @param nodeid the node id. - * @param route (if received) - * @return 1 is it finds a sessionid 0 otherwise. - */ int hassession_byname(request_rec *r, int nodeid, const char *route, const proxy_node_table *node_table) { proxy_balancer *balancer = NULL; @@ -433,14 +395,6 @@ int hassession_byname(request_rec *r, int nodeid, const char *route, const proxy return 0; } -/** - * Find the best nodes for a request (check host and context (and balancer)) - * @param r the request_rec - * @param balancer the balancer (balancer to use in that case we check it). - * @param route from the sessionid if we have one. - * @param use_alias compare alias with server_name - * @return a pointer to a list of nodes. - */ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balancer, const char *route, int use_alias, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, const proxy_node_table *node_table) @@ -604,7 +558,9 @@ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balan return best; } -/* Given the route find the corresponding domain (if there is a domain) */ +/** + * Given the route find the corresponding domain (if there is a domain) + */ static apr_status_t find_nodedomain(request_rec *r, const char **domain, char *route, const char *balancer, const proxy_node_table *node_table) { @@ -640,9 +596,6 @@ static apr_status_t find_nodedomain(request_rec *r, const char **domain, char *r return APR_NOTFOUND; } -/** - * Find the balancer corresponding to the node information - */ const char *get_route_balancer(request_rec *r, const proxy_server_conf *conf, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, const proxy_balancer_table *balancer_table, const proxy_node_table *node_table, int use_alias) @@ -720,7 +673,6 @@ const char *get_route_balancer(request_rec *r, const proxy_server_conf *conf, co return NULL; } -/* Read a node from the table using its it */ const nodeinfo_t *table_get_node(const proxy_node_table *node_table, int id) { int i; @@ -732,7 +684,6 @@ const nodeinfo_t *table_get_node(const proxy_node_table *node_table, int id) return NULL; } -/* Get a node from the table using the route */ nodeinfo_t *table_get_node_route(proxy_node_table *node_table, char *route, int *id) { int i; @@ -745,13 +696,6 @@ nodeinfo_t *table_get_node_route(proxy_node_table *node_table, char *route, int return NULL; } -/** - * Search the balancer that corresponds to the pair context/host - * @param r the request_rec. - * @vhost_table table of host virtual hosts. - * @context_table table of contexts. - * @return the balancer name or NULL if not found. - */ const char *get_context_host_balancer(request_rec *r, proxy_vhost_table *vhost_table, proxy_context_table *context_table, proxy_node_table *node_table, int use_alias) { @@ -794,13 +738,6 @@ apr_status_t loc_get_id(void *mem, void *data, apr_pool_t *pool) return APR_SUCCESS; } -/* - * Return the node cotenxt Check that the worker will handle the host/context. - * de - * The id of the worker is used to find the (slot) node in the shared - * memory. - * (See get_context_host_balancer too). - */ const node_context *context_host_ok(request_rec *r, const proxy_balancer *balancer, int node, int use_alias, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, const proxy_node_table *node_table) diff --git a/native/include/balancer.h b/native/include/balancer.h index 6af74dc06..8b339a26b 100644 --- a/native/include/balancer.h +++ b/native/include/balancer.h @@ -46,7 +46,9 @@ typedef struct mem mem_t; #include "mod_clustersize.h" -/* status of the balancer as read/store in httpd. */ +/** + * Status of the balancer as read/store in httpd + */ struct balancerinfo { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -65,91 +67,95 @@ struct balancerinfo typedef struct balancerinfo balancerinfo_t; /** - * use apache httpd structure + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** * Insert(alloc) and update a balancer record in the shared table - * @param pointer to the shared table. - * @param balancer balancer to store in the shared table. + * @param s pointer to the shared table + * @param balancer balancer to store in the shared table * @return APR_SUCCESS if all went well * */ apr_status_t insert_update_balancer(mem_t *s, balancerinfo_t *balancer); /** - * read a balancer record from the shared table - * @param pointer to the shared table. - * @param balancer balancer to read from the shared table. - * @return address of the read balancer or NULL if error. + * Read a balancer record from the shared table + * @param s pointer to the shared table + * @param balancer balancer to read from the shared table + * @return address of the read balancer or NULL if error */ balancerinfo_t *read_balancer(mem_t *s, balancerinfo_t *balancer); /** - * get a balancer record from the shared table - * @param pointer to the shared table. - * @param balancer address of the balancer read from the shared table. + * Get a balancer record from the shared table + * @param s pointer to the shared table + * @param balancer address of the balancer read from the shared table + * @param ids id of the balancer to return * @return APR_SUCCESS if all went well */ apr_status_t get_balancer(mem_t *s, balancerinfo_t **balancer, int ids); /** - * remove(free) a balancer record from the shared table - * @param pointer to the shared table. - * @param balancer balancer to remove from the shared table. + * Remove(free) a balancer record from the shared table + * @param s pointer to the shared table + * @param balancer balancer to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_balancer(mem_t *s, balancerinfo_t *balancer); -/* - * get the ids for the used (not free) balancers in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of balancer existing or -1 if error. +/** + * Get the ids for the used (not free) balancers in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of balancer existing or -1 if error */ int get_ids_used_balancer(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_balancer(mem_t *s); /** - * attach to the shared balancer table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared balancer table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *get_mem_balancer(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared balancer table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared balancer table + * @param string name to use to create the table + * @param num size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *create_mem_balancer(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct balancer_storage_method { /** - * the balancer corresponding to the ident - * @param ids ident of the balancer to read. - * @param balancer address of pointer to return the balancer. + * The balancer corresponding to the ident + * @param ids ident of the balancer to read + * @param balancer address of pointer to return the balancer * @return APR_SUCCESS if all went well */ apr_status_t (*read_balancer)(int ids, balancerinfo_t **balancer); /** - * read the list of ident of used balancers. - * @param ids address to store the idents. + * Read the list of ident of used balancers + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_balancer)(int *ids); diff --git a/native/include/common.h b/native/include/common.h index a7605a7e4..202b4589a 100644 --- a/native/include/common.h +++ b/native/include/common.h @@ -20,40 +20,82 @@ struct counter int *values; }; -apr_status_t loc_get_id(void *mem, void *data, apr_pool_t *pool); - -/* Read the virtual host table from shared memory */ +/** + * Read the virtual host table from shared memory + * @param pool pool to use for memory allocation + * @param host_storage host_storage used for reading virtual hosts + * @param for_cache flag whether to use cache (true) or not (false) + * @return pointer to the read virtual host table + */ proxy_vhost_table *read_vhost_table(apr_pool_t *pool, struct host_storage_method *host_storage, int for_cache); -/* Update the virtual host table from shared memory to populate a cached table */ +/** + * Update the virtual host table from shared memory to populate a cached table + * @param vhost_table pointer to virtual host table that should be updated + * @param host_storage host_storage used fo reading virtual hosts + * @return pointer to the updated virtual host table + */ proxy_vhost_table *update_vhost_table_cached(proxy_vhost_table *vhost_table, const struct host_storage_method *host_storage); -/* Read the context table from shared memory */ +/** + * Read the context table from shared memory + * @param pool pool used for memory allocation + * @param context_storage context_storage for context retrieval + * @param for_cache flag whether to use cache (true) or not (false) + * @return pointer to the read table + */ proxy_context_table *read_context_table(apr_pool_t *pool, const struct context_storage_method *context_storage, int for_cache); -/* Update the context table from shared memory to populate a cached table */ +/** + * Update the context table from shared memory to populate a cached table + * @param context_table context table to update + * @param context_storage context storage for context retrieval + * @return pointer to the updated table + */ proxy_context_table *update_context_table_cached(proxy_context_table *context_table, const struct context_storage_method *context_storage); -/* Read the balancer table from shared memory */ +/** + * Read the balancer table from shared memory + * @param pool pool used for for memory allocation + * @param balancer_storage balancer_storage to for balancers retrieval + * @param for_cache flag whether to use cache (true) or not (false) + * @return pointer to the read table + */ proxy_balancer_table *read_balancer_table(apr_pool_t *pool, const struct balancer_storage_method *balancer_storage, int for_cache); -/* Update the balancer table from shared memory to populate a cached table */ +/** + * Update the balancer table from shared memory to populate a cached table + * @param balancer_table pointer to the balancer table that should be updated + * @param balancer_storage balancer_storage to for balancers retrieval + * @return pointer to the updated table + */ proxy_balancer_table *update_balancer_table_cached(proxy_balancer_table *balancer_table, const struct balancer_storage_method *balancer_storage); -/* Read the node table from shared memory */ +/** + * Read the node table from shared memory + * @param pool pool used for memory allocation + * @param node_storage node_storage used for node retrieval + * @param for_cache flag whether to use cache (true) or not (false) + * @return pointer to the read table + */ proxy_node_table *read_node_table(apr_pool_t *pool, const struct node_storage_method *node_storage, int for_cache); -/* Update the node table from shared memory to populate a cached table*/ +/** + * Update the node table from shared memory to populate a cached table + * @param node_table pointer to the node table that should be updated + * @param node_storage node_storage to for node retrieval + * @return pointer to the updated table + */ proxy_node_table *update_node_table_cached(proxy_node_table *node_table, const struct node_storage_method *node_storage); -/* +/** * Read the cookie corresponding to name * @param r request. * @param name name of the cookie @@ -66,16 +108,22 @@ char *get_cookie_param(request_rec *r, const char *name, int in); * Retrieve the parameter with the given name * Something like 'JSESSIONID=12345...N' * + * @param pool pool to use for allocation of the returned string + * @param url url to process + * @param name parameter name which value is retrieved + * @return string containing the parameter of a given name or NULL if the name is not present + * * TODO: Should use the mod_proxy_balancer one */ char *get_path_param(apr_pool_t *pool, char *url, const char *name); /** * Check that the request has a sessionid with a route - * @param r the request_rec. - * @param stickyval the cookie or/and parameter name. - * @param uri part of the URL to for the session parameter. + * @param r the request_rec + * @param stickyval the cookie or/and parameter name + * @param uri part of the URL to for the session parameter * @param sticky_used the string that was used to find the route + * @return route */ char *cluster_get_sessionid(request_rec *r, const char *stickyval, char *uri, char **sticky_used); @@ -84,17 +132,21 @@ char *cluster_get_sessionid(request_rec *r, const char *stickyval, char *uri, ch * @param r the request_rec. * @param nodeid the node id. * @param route (if received) + * @param node_table node table * @return 1 is it finds a sessionid 0 otherwise. */ int hassession_byname(request_rec *r, int nodeid, const char *route, const proxy_node_table *node_table); /** - * Find the best nodes for a request (check host and context (and balancer)) + * Find the best nodes for a request (check host, context, and balancer) * @param r the request_rec - * @param balancer the balancer (balancer to use in that case we check it). - * @param route from the sessionid if we have one. + * @param balancer the balancer (balancer to use in that case we check it) + * @param route from the sessionid if we have one * @param use_alias compare alias with server_name - * @return a pointer to a list of nodes. + * @param vhost_table virtual host table + * @param context_table context table + * @param node_table node table + * @return a pointer to a list of nodes */ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balancer, const char *route, int use_alias, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, @@ -102,35 +154,71 @@ node_context *find_node_context_host(request_rec *r, const proxy_balancer *balan /** * Find the balancer corresponding to the node information + * @param r the request + * @param conf server configuration + * @param vhost_table virtual host table + * @param context_table context table + * @param balancer_table balancer table + * @param node_table node table + * @param use_alias whether to compare hostname with virtual hosts (true) or not (false) + * @return balancer name corresponding to the given node or NULL if it does not exist */ const char *get_route_balancer(request_rec *r, const proxy_server_conf *conf, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, const proxy_balancer_table *balancer_table, const proxy_node_table *node_table, int use_alias); -/* Read a node from the table using its it */ +/** + * Read a node from the table using its it + * @param node_table node table to retreive a searched node from + * @param id an id of the searched node + * @return node_info struct corresponding to the given @id or NULL if it doesn't exist + */ const nodeinfo_t *table_get_node(const proxy_node_table *node_table, int id); -/* Get a node from the table using the route */ +/** + * Get a node from the table using the route + * @param node_table node table to retreive a searched node from + * @param route route corresponding to the searched node + * @param id id that is set to the searched node's id if found + * @return node_info struct corresponding to the given @route or NULL if it doesn't exist + */ nodeinfo_t *table_get_node_route(proxy_node_table *node_table, char *route, int *id); /** * Search the balancer that corresponds to the pair context/host - * @param r the request_rec. - * @vhost_table table of host virtual hosts. - * @context_table table of contexts. - * @return the balancer name or NULL if not found. + * @param r the request_rec + * @param vhost_table table of host virtual hosts + * @param context_table table of contexts + * @return the balancer name or NULL if not found */ const char *get_context_host_balancer(request_rec *r, proxy_vhost_table *vhost_table, proxy_context_table *context_table, proxy_node_table *node_table, int use_alias); + +/** + * Extracts an id from the given memory (expects structs scuh as nodemess and others) + * + * @param mem one of the structs such as nodemess and others (first member must be int id!) + * @param data struct counter that gets updated (count++ and values pointer++) + * @param pool unused argument + * @return APR_SUCCESS + */ apr_status_t loc_get_id(void *mem, void *data, apr_pool_t *pool); -/* - * Return the node cotenxt Check that the worker will handle the host/context. - * de - * The id of the worker is used to find the (slot) node in the shared - * memory. - * (See get_context_host_balancer too). +/** + * Check that the worker will handle the host/context. + * + * @param r the request_rec + * @param balancer the balancer (balancer to use in that case we check it) + * @param node node id + * @param use_alias compare alias with server_name + * @param vhost_table virtual host table + * @param context_table context table + * @param node_table node table + * @return node_context in case a node with the given id handles the host/context + * + * The id of the worker is used to find the (slot) node in the shared memory + * (See get_context_host_balancer too) */ const node_context *context_host_ok(request_rec *r, const proxy_balancer *balancer, int node, int use_alias, const proxy_vhost_table *vhost_table, const proxy_context_table *context_table, diff --git a/native/include/context.h b/native/include/context.h index f2b7786ce..46ff59248 100644 --- a/native/include/context.h +++ b/native/include/context.h @@ -44,7 +44,9 @@ typedef struct mem mem_t; #define MEM_T #endif -/* Status of the application */ +/** + * Status of the application + */ #define ENABLED 1 #define DISABLED 2 #define STOPPED 3 @@ -52,7 +54,9 @@ typedef struct mem mem_t; #include "mod_clustersize.h" -/* status of the context as read/store in httpd. */ +/** + * Status of the context as read/store in httpd + */ struct contextinfo { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -68,104 +72,107 @@ struct contextinfo typedef struct contextinfo contextinfo_t; /** - * use apache httpd structure + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** * Insert(alloc) and update a context record in the shared table - * @param pointer to the shared table. - * @param context context to store in the shared table. + * @param s pointer to the shared table + * @param context context to store in the shared table * @return APR_SUCCESS if all went well - * */ apr_status_t insert_update_context(mem_t *s, contextinfo_t *context); /** - * read a context record from the shared table - * @param pointer to the shared table. - * @param context context to read from the shared table. - * @return address of the read context or NULL if error. + * Read a context record from the shared table + * @param s pointer to the shared table + * @param context context to read from the shared table + * @return address of the read context or NULL if error */ contextinfo_t *read_context(mem_t *s, contextinfo_t *context); /** - * get a context record from the shared table - * @param pointer to the shared table. - * @param context address of the context read from the shared table. + * Get a context record from the shared table + * @param s pointer to the shared table + * @param context address of the context read from the shared table + * @param ids id of the context to return * @return APR_SUCCESS if all went well */ apr_status_t get_context(mem_t *s, contextinfo_t **context, int ids); /** - * remove(free) a context record from the shared table - * @param pointer to the shared table. - * @param int the id of context to remove from the shared table. + * Remove(free) a context record from the shared table + * @param s pointer to the shared table + * @param int the id of context to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_context(mem_t *s, int id); -/* - * get the ids for the used (not free) contexts in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of context existing or -1 if error. +/** + * Get the ids for the used (not free) contexts in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of the context existing or -1 if error */ int get_ids_used_context(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_context(mem_t *s); /** - * attach to the shared context table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared context table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of the struct used to access the table */ mem_t *get_mem_context(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared context table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared context table + * @param string name to use to create the table + * @param num size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *create_mem_context(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct context_storage_method { /** - * the context corresponding to the ident - * @param ids ident of the context to read. - * @param context address of pointer to return the context. + * The context corresponding to the ident + * @param ids ident of the context to read + * @param context address of pointer to return the context * @return APR_SUCCESS if all went well */ apr_status_t (*read_context)(int ids, contextinfo_t **context); /** - * read the list of ident of used contexts. - * @param ids address to store the idents. + * Read the list of ident of used contexts + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_context)(int *ids); /** - * read the max number of contexts in the shared table + * Read the max number of contexts in the shared table */ int (*get_max_size_context)(void); - /* - * lock the context table + /** + * Lock the context table */ apr_status_t (*lock_contexts)(void); - /* - * unlock the context table + /** + * Unlock the context table */ apr_status_t (*unlock_contexts)(void); }; diff --git a/native/include/domain.h b/native/include/domain.h index 7250c604e..5b85a0a73 100644 --- a/native/include/domain.h +++ b/native/include/domain.h @@ -46,7 +46,9 @@ typedef struct mem mem_t; #include "mod_clustersize.h" -/* status of the domain as read/store in httpd. */ +/** + * Status of the domain as read/store in httpd + */ struct domaininfo { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -60,117 +62,125 @@ struct domaininfo typedef struct domaininfo domaininfo_t; /** - * use apache httpd structure + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** * Insert(alloc) and update a domain record in the shared table - * @param pointer to the shared table. - * @param domain domain to store in the shared table. + * @param s pointer to the shared table + * @param domain domain to store in the shared table * @return APR_SUCCESS if all went well - * */ apr_status_t insert_update_domain(mem_t *s, domaininfo_t *domain); /** - * read a domain record from the shared table - * @param pointer to the shared table. - * @param domain domain to read from the shared table. - * @return address of the read domain or NULL if error. + * Read a domain record from the shared table + * @param s pointer to the shared table + * @param domain domain to read from the shared table + * @return address of the read domain or NULL if error */ domaininfo_t *read_domain(mem_t *s, domaininfo_t *domain); /** - * get a domain record from the shared table - * @param pointer to the shared table. - * @param domain address of the domain read from the shared table. + * Get a domain record from the shared table + * @param s pointer to the shared table + * @param domain address of the domain read from the shared table + * @param ids id of the domain to return * @return APR_SUCCESS if all went well */ apr_status_t get_domain(mem_t *s, domaininfo_t **domain, int ids); /** - * remove(free) a domain record from the shared table - * @param pointer to the shared table. - * @param domain domain to remove from the shared table. + * Remove(free) a domain record from the shared table + * @param s pointer to the shared table + * @param domain domain to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_domain(mem_t *s, domaininfo_t *domain); /** - * find a domain record from the shared table using JVMRoute and balancer - * @param pointer to the shared table. - * @param domain address where the node is located in the shared table. + * Find a domain record from the shared table using JVMRoute and balancer + * @param s pointer to the shared table + * @param domain address where the node is located in the shared table * @param route JVMRoute to search + * @param balancer balancer to search * @return APR_SUCCESS if all went well */ apr_status_t find_domain(mem_t *s, domaininfo_t **domain, const char *route, const char *balancer); -/* - * get the ids for the used (not free) domains in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of domain existing or -1 if error. +/** + * Get the ids for the used (not free) domains in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of domain existing or -1 if error */ int get_ids_used_domain(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_domain(mem_t *s); /** - * attach to the shared domain table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared domain table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *get_mem_domain(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared domain table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared domain table + * @param string name to use to create the table + * @param num size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *create_mem_domain(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct domain_storage_method { /** - * the domain corresponding to the ident - * @param ids ident of the domain to read. - * @param domain address of pointer to return the domain. + * The domain corresponding to the ident + * @param ids ident of the domain to read + * @param domain address of pointer to return the domain * @return APR_SUCCESS if all went well */ apr_status_t (*read_domain)(int ids, domaininfo_t **domain); /** - * read the list of ident of used domains. - * @param ids address to store the idents. + * Read the list of ident of used domains + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_domain)(int *ids); /** - * read the max number of domains in the shared table + * Read the max number of domains in the shared table + * @return the max number of domains */ int (*get_max_size_domain)(void); - /* + /** * Remove the domain from shared memory (free the slotmem) + * @return APR_SUCCESS if all went well */ apr_status_t (*remove_domain)(domaininfo_t *domain); - /* - * Insert a new domain or update existing one. + /** + * Insert a new domain or update existing one + * @return APR_SUCCESS if all went well */ apr_status_t (*insert_update_domain)(domaininfo_t *domain); - /* + /** * Find the domain using the JVMRoute and balancer information + * @return APR_SUCCESS if all went well */ apr_status_t (*find_domain)(domaininfo_t **node, const char *route, const char *balancer); }; diff --git a/native/include/host.h b/native/include/host.h index b47832b56..f5fdb1231 100644 --- a/native/include/host.h +++ b/native/include/host.h @@ -46,7 +46,9 @@ typedef struct mem mem_t; #include "mod_clustersize.h" -/* status of the host as read/store in httpd. */ +/** + * Status of the host as read/store in httpd + */ struct hostinfo { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -60,96 +62,100 @@ struct hostinfo typedef struct hostinfo hostinfo_t; /** - * use apache httpd structure + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** * Insert(alloc) and update a host record in the shared table - * @param pointer to the shared table. - * @param host host to store in the shared table. + * @param s pointer to the shared table + * @param host host to store in the shared table * @return APR_SUCCESS if all went well - * */ apr_status_t insert_update_host(mem_t *s, hostinfo_t *host); /** - * read a host record from the shared table - * @param pointer to the shared table. - * @param host host to read from the shared table. - * @return address of the read host or NULL if error. + * Read a host record from the shared table + * @param s pointer to the shared table + * @param host host to read from the shared table + * @return address of the read host or NULL if error */ hostinfo_t *read_host(mem_t *s, hostinfo_t *host); /** - * get a host record from the shared table - * @param pointer to the shared table. - * @param host address of the host read from the shared table. + * Get a host record from the shared table + * @param s pointer to the shared table + * @param host address of the host read from the shared table + * @param ids id of the host to return * @return APR_SUCCESS if all went well */ apr_status_t get_host(mem_t *s, hostinfo_t **host, int ids); /** - * remove(free) a host record from the shared table - * @param pointer to the shared table. - * @param int id id of host to remove from the shared table. + * Remove(free) a host record from the shared table + * @param s pointer to the shared table + * @param id id id of host to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_host(mem_t *s, int id); -/* - * get the ids for the used (not free) hosts in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of host existing or -1 if error. +/** + * Get the ids for the used (not free) hosts in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of host existing or -1 if error */ int get_ids_used_host(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_host(mem_t *s); /** - * attach to the shared host table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared host table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *get_mem_host(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared host table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared host table + * @param string name to use to create the table + * @param num size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *create_mem_host(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct host_storage_method { /** - * the host corresponding to the ident - * @param ids ident of the host to read. - * @param host address of pointer to return the host. + * The host corresponding to the ident + * @param ids ident of the host to read + * @param host address of pointer to return the host * @return APR_SUCCESS if all went well */ apr_status_t (*read_host)(int ids, hostinfo_t **host); /** - * read the list of ident of used hosts. - * @param ids address to store the idents. + * Read the list of ident of used hosts + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_host)(int *ids); /** - * read the max number of hosts in the shared table + * Read the max number of hosts in the shared table + * @return the maximum size of the table */ int (*get_max_size_host)(void); }; diff --git a/native/include/mod_proxy_cluster.h b/native/include/mod_proxy_cluster.h index 93ced8fce..e96136140 100644 --- a/native/include/mod_proxy_cluster.h +++ b/native/include/mod_proxy_cluster.h @@ -28,6 +28,15 @@ #ifndef MOD_PROXY_CLUSTER_H #define MOD_PROXY_CLUSTER_H +/** + * @file mod_proxy_cluster.h + * @brief mod_proxy_cluster module for Apache + * + * @defgroup MOD_PROXY_CLUSTER mod_proxy_cluster + * @ingroup APACHE_MODS + * @{ + */ + #include "balancer.h" #define MOD_CLUSTER_EXPOSED_VERSION "mod_cluster/2.0.0.Alpha1-SNAPSHOT" @@ -41,39 +50,39 @@ struct balancer_method { /** * Check that the node is responding - * @param r request_rec structure. - * @param id ident of the worker. - * @param load load factor to set if test is ok. + * @param r request_rec structure + * @param id ident of the worker + * @param load load factor to set if test is ok * @return 0: All OK 500 : Error */ int (*proxy_node_isup)(request_rec *r, int id, int load); /** * Check that the node is responding - * @param r request_rec structure. - * @param scheme something like ajp, http or https. - * @param host the hostname. + * @param r request_rec structure + * @param scheme something like ajp, http or https + * @param host the hostname * @param port the port on which the node connector is running * @return 0: All OK 500 : Error */ int (*proxy_host_isup)(request_rec *r, const char *scheme, const char *host, const char *port); /** * Check if a worker already exists and return the corresponding id - * @param r request_rec structure. - * @param balancername, the balancer name. - * @param scheme something like ajp, http or https. - * @param host the hostname. + * @param r request_rec structure + * @param balancername, the balancer name + * @param scheme something like ajp, http or https + * @param host the hostname * @param port the port on which the node connector is running - * @param id the address to store the index that was previously used. - * @param the_conf adress to store the proxy_server_conf the worker is using. - * @return the worker or NULL if not existing. + * @param id the address to store the index that was previously used + * @param the_conf adress to store the proxy_server_conf the worker is using + * @return the worker or NULL if not existing */ proxy_worker *(*proxy_node_getid)(request_rec *r, const char *balancername, const char *scheme, const char *host, const char *port, int *id, const proxy_server_conf **the_conf); /** - * Re enable the proxy_worker - * @param r request_rec structure. - * @param node pointer to node structure we have created. + * Re-enable the proxy_worker + * @param r request_rec structure + * @param node pointer to node structure we have created * @param worker the proxy_worker to re enable * @param nodeinfo pointer to node structure we are creating * @param the_conf the proxy_server_conf from proxy_node_getid() @@ -82,14 +91,19 @@ struct balancer_method const proxy_server_conf *the_conf); /** - * return the first free id to insert in node table + * Get a free id in the node table + * @param r request_rec whose pool is used for memory allocations + * @param node_table_size the size of the table + * @return the first free id in the table or -1 if none exists */ int (*proxy_node_get_free_id)(request_rec *r, int node_table_size); }; typedef struct balancer_method balancer_method; -/* Context table copy for local use */ +/** + * Context table copy for local use + */ struct proxy_context_table { int sizecontext; @@ -99,7 +113,9 @@ struct proxy_context_table typedef struct proxy_context_table proxy_context_table; -/* VHost table copy for local use */ +/** + * VHost table copy for local use + */ struct proxy_vhost_table { int sizevhost; @@ -108,7 +124,9 @@ struct proxy_vhost_table }; typedef struct proxy_vhost_table proxy_vhost_table; -/* Balancer table copy for local use */ +/** + * Balancer table copy for local use + */ struct proxy_balancer_table { int sizebalancer; @@ -117,7 +135,9 @@ struct proxy_balancer_table }; typedef struct proxy_balancer_table proxy_balancer_table; -/* Node table copy for local use, the ptr_node is the shared memory address (slotmem address) */ +/** + * Node table copy for local use, the ptr_node is the shared memory address (slotmem address) + */ struct proxy_node_table { int sizenode; @@ -127,7 +147,9 @@ struct proxy_node_table }; typedef struct proxy_node_table proxy_node_table; -/* table of node and context selected by find_node_context_host() */ +/** + * Table of node and context selected by find_node_context_host() + */ struct node_context { int node; diff --git a/native/include/node.h b/native/include/node.h index 7a1cb514d..fee2b9e37 100644 --- a/native/include/node.h +++ b/native/include/node.h @@ -48,7 +48,9 @@ typedef struct mem mem_t; #include "ap_mmn.h" -/* configuration of the node received from jboss cluster. */ +/** + * Configuration of the node received from jboss cluster + */ struct nodemess { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -87,7 +89,9 @@ typedef struct nodemess nodemess_t; #define SIZEOFSCORE 1700 /* at least size of the proxy_worker_stat structure */ -/* status of the node as read/store in httpd. */ +/** + * Status of the node as read/store in httpd + */ struct nodeinfo { /* config from jboss/tomcat */ @@ -100,12 +104,12 @@ struct nodeinfo typedef struct nodeinfo nodeinfo_t; /** - * use apache httpd structure + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** - * return the last stored in the mem structure + * Return the last stored in the mem structure * @param pointer to the shared table * @return APR_SUCCESS if all went well * @@ -114,159 +118,164 @@ apr_status_t get_last_mem_error(mem_t *mem); /** * Insert(alloc) and update a node record in the shared table - * @param pointer to the shared table. - * @param node node to store in the shared table. - * @param int pointer to store the id where the node is inserted - * @param int tells to clean or not the worker_shared part. + * @param s pointer to the shared table + * @param node node to store in the shared table + * @param id pointer to store the id where the node is inserted + * @param clean tells to clean or not the worker_shared part * @return APR_SUCCESS if all went well * */ apr_status_t insert_update_node(mem_t *s, nodeinfo_t *node, int *id, int clean); /** - * read a node record from the shared table - * @param pointer to the shared table. - * @param node node to read from the shared table. - * @return address of the read node or NULL if error. + * Read a node record from the shared table + * @param s pointer to the shared table + * @param node node to read from the shared table + * @return address of the read node or NULL if error */ nodeinfo_t *read_node(mem_t *s, nodeinfo_t *node); /** - * get a node record from the shared table - * @param pointer to the shared table. - * @param node address of the node read from the shared table. + * Get a node record from the shared table + * @param s pointer to the shared table + * @param node address of the node read from the shared table + * @param ids id of the node to return * @return APR_SUCCESS if all went well */ apr_status_t get_node(mem_t *s, nodeinfo_t **node, int ids); /** - * remove(free) a node record from the shared table - * @param pointer to the shared table. - * @param ids id of node to remove from the shared table. + * Remove(free) a node record from the shared table + * @param pointer to the shared table + * @param ids id of node to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_node(mem_t *s, int ids); /** - * find a node record from the shared table using JVMRoute - * @param pointer to the shared table. - * @param node address where the node is located in the shared table. + * Find a node record from the shared table using JVMRoute + * @param s pointer to the shared table + * @param node address where the node is located in the shared table * @param route JVMRoute to search * @return APR_SUCCESS if all went well */ apr_status_t find_node(mem_t *s, nodeinfo_t **node, const char *route); /** - * find a node record from the shared table using Host/Port - * @param pointer to the shared table. - * @param node address where the node is located in the shared table. - * @param host Host to search - * @param port Port to search + * Find a node record from the shared table using Host/Port + * @param s pointer to the shared table + * @param node address where the node is located in the shared table + * @param host host to search + * @param port port to search * @return APR_SUCCESS if all went well */ apr_status_t find_node_byhostport(mem_t *s, nodeinfo_t **node, const char *host, const char *port); -/* - * * lock the nodes table +/** + * Lock the nodes table */ apr_status_t lock_nodes(void); -/* - * * unlock the nodes table +/** + * Unlock the nodes table */ apr_status_t unlock_nodes(void); -/* - * get the ids for the used (not free) nodes in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of node existing or -1 if error. +/** + * Get the ids for the used (not free) nodes in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of node existing or -1 if error */ int get_ids_used_node(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_node(mem_t *s); -/* - * get the version of the table (each update of the table changes version) - * @param pointer to the shared table. - * @return version the actual version in the table. +/** + * Get the version of the table (each update of the table changes version) + * @param s pointer to the shared table + * @return version the actual version in the table */ unsigned get_version_node(mem_t *s); /** - * attach to the shared node table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared node table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *get_mem_node(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared node table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared node table + * @param name to use to create the table + * @param size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *create_mem_node(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct node_storage_method { /** - * the node corresponding to the ident - * @param ids ident of the node to read. - * @param node address of pointer to return the node. + * The node corresponding to the ident + * @param ids ident of the node to read + * @param node address of pointer to return the node * @return APR_SUCCESS if all went well */ apr_status_t (*read_node)(int ids, nodeinfo_t **node); /** - * read the list of ident of used nodes. - * @param ids address to store the idents. + * Read the list of ident of used nodes + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_node)(int *ids); /** - * read the max number of nodes in the shared table + * Read the max number of nodes in the shared table + * @return max number of nodes in the shared table */ int (*get_max_size_node)(void); /** - * check the nodes for modifications. - * XXX: void *data is server_rec *s in fact. + * Check the nodes for modifications. + * XXX: void *data is server_rec *s in fact */ unsigned (*worker_nodes_need_update)(void *data, apr_pool_t *pool); - /* - * mark that the worker node are now up to date. + /** + * Mark that the worker node are now up to date */ int (*worker_nodes_are_updated)(void *data, unsigned version); - /* + /** * Remove the node from shared memory (free the slotmem) */ int (*remove_node)(int node); - /* + /** * Find the node using the JVMRoute information */ apr_status_t (*find_node)(nodeinfo_t **node, const char *route); - /* - * Remove the virtual hosts and contexts corresponding the node. + /** + * Remove the virtual hosts and contexts corresponding the node */ void (*remove_host_context)(int node, apr_pool_t *pool); - /* - * lock the nodes table + /** + * Lock the nodes table */ apr_status_t (*lock_nodes)(void); - /* - * unlock the nodes table + /** + * Unlock the nodes table */ apr_status_t (*unlock_nodes)(void); }; diff --git a/native/include/sessionid.h b/native/include/sessionid.h index ab5095f32..c7d7ee5ce 100644 --- a/native/include/sessionid.h +++ b/native/include/sessionid.h @@ -46,7 +46,9 @@ typedef struct mem mem_t; #include "mod_clustersize.h" -/* status of the sessionid as read/store in httpd. */ +/** + * Status of the sessionid as read/store in httpd + */ struct sessionidinfo { /* NOTE: Due to `loc_get_id`, struct MUST begin with id */ @@ -58,105 +60,108 @@ struct sessionidinfo }; typedef struct sessionidinfo sessionidinfo_t; -/* - * use apache httpd structure +/** + * Use apache httpd structure */ typedef struct ap_slotmem_provider_t slotmem_storage_method; /** * Insert(alloc) and update a sessionid record in the shared table - * @param pointer to the shared table. - * @param sessionid sessionid to store in the shared table. + * @param s pointer to the shared table + * @param sessionid sessionid to store in the shared table * @return APR_SUCCESS if all went well - * */ apr_status_t insert_update_sessionid(mem_t *s, sessionidinfo_t *sessionid); /** - * read a sessionid record from the shared table - * @param pointer to the shared table. - * @param sessionid sessionid to read from the shared table. - * @return address of the read sessionid or NULL if error. + * Read a sessionid record from the shared table + * @param s pointer to the shared table + * @param sessionid sessionid to read from the shared table + * @return address of the read sessionid or NULL if error */ sessionidinfo_t *read_sessionid(mem_t *s, sessionidinfo_t *sessionid); /** - * get a sessionid record from the shared table - * @param pointer to the shared table. - * @param sessionid address of the sessionid read from the shared table. + * Get a sessionid record from the shared table + * @param s pointer to the shared table + * @param sessionid address of the sessionid read from the shared table + * @param ids id of the sessionid to return * @return APR_SUCCESS if all went well */ apr_status_t get_sessionid(mem_t *s, sessionidinfo_t **sessionid, int ids); /** - * remove(free) a sessionid record from the shared table - * @param pointer to the shared table. - * @param sessionid sessionid to remove from the shared table. + * Remove(free) a sessionid record from the shared table + * @param s pointer to the shared table + * @param sessionid sessionid to remove from the shared table * @return APR_SUCCESS if all went well */ apr_status_t remove_sessionid(mem_t *s, sessionidinfo_t *sessionid); -/* - * get the ids for the used (not free) sessionids in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of sessionid existing or -1 if error. +/** + * Get the ids for the used (not free) sessionids in the table + * @param s pointer to the shared table + * @param ids array of int to store the used id (must be big enough) + * @return number of sessionid existing or -1 if error */ int get_ids_used_sessionid(mem_t *s, int *ids); -/* - * get the size of the table (max size). - * @param pointer to the shared table. - * @return size of the existing table or -1 if error. +/** + * Get the size of the table (max size) + * @param s pointer to the shared table + * @return size of the existing table or -1 if error */ int get_max_size_sessionid(mem_t *s); /** - * attach to the shared sessionid table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Attach to the shared sessionid table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *get_mem_sessionid(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage); + /** - * create a shared sessionid table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. + * Create a shared sessionid table + * @param string name to use to create the table + * @param num size of the shared table + * @param persist tell if the slotmem element are persistent + * @param p pool to use for allocations + * @param storage storage provider + * @return address of struct used to access the table */ mem_t *create_mem_sessionid(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage); /** - * provider for the mod_proxy_cluster or mod_jk modules. + * Provider for the mod_proxy_cluster or mod_jk modules */ struct sessionid_storage_method { /** - * the sessionid corresponding to the ident - * @param ids ident of the sessionid to read. - * @param sessionid address of pointer to return the sessionid. + * The sessionid corresponding to the ident + * @param ids ident of the sessionid to read + * @param sessionid address of pointer to return the sessionid * @return APR_SUCCESS if all went well */ apr_status_t (*read_sessionid)(int ids, sessionidinfo_t **sessionid); /** - * read the list of ident of used sessionids. - * @param ids address to store the idents. + * Read the list of ident of used sessionids + * @param ids address to store the idents * @return APR_SUCCESS if all went well */ int (*get_ids_used_sessionid)(int *ids); /** - * read the max number of sessionids in the shared table + * Read the max number of sessionids in the shared table */ int (*get_max_size_sessionid)(void); - /* + /** * Remove the sessionid from shared memory (free the slotmem) */ apr_status_t (*remove_sessionid)(sessionidinfo_t *sessionid); - /* - * Insert a new sessionid or update existing one. + /** + * Insert a new sessionid or update existing one */ apr_status_t (*insert_update_sessionid)(sessionidinfo_t *sessionid); }; diff --git a/native/mod_manager/balancer.c b/native/mod_manager/balancer.c index 41a9305bd..cbe90db5b 100644 --- a/native/mod_manager/balancer.c +++ b/native/mod_manager/balancer.c @@ -78,7 +78,6 @@ static mem_t *create_attach_mem_balancer(char *string, unsigned *num, int type, * @param pointer to the shared table. * @param balancer balancer to store in the shared table. * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { @@ -123,7 +122,7 @@ apr_status_t insert_update_balancer(mem_t *s, balancerinfo_t *balancer) } /** - * read a balancer record from the shared table + * Read a balancer record from the shared table * @param pointer to the shared table. * @param balancer balancer to read from the shared table. * @return address of the read balancer or NULL if error. @@ -159,24 +158,11 @@ balancerinfo_t *read_balancer(mem_t *s, balancerinfo_t *balancer) return NULL; } -/** - * get a balancer record from the shared table - * @param pointer to the shared table. - * @param balancer address where the balancer is locate in the shared table. - * @param id in the balancer table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_balancer(mem_t *s, balancerinfo_t **balancer, int id) { return s->storage->dptr(s->slotmem, id, (void **)balancer); } -/** - * remove(free) a balancer record from the shared table - * @param pointer to the shared table. - * @param balancer balancer to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_balancer(mem_t *s, balancerinfo_t *balancer) { apr_status_t rv; @@ -193,12 +179,6 @@ apr_status_t remove_balancer(mem_t *s, balancerinfo_t *balancer) return rv; } -/* - * get the ids for the used (not free) balancers in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of balancer existing or 0. - */ int get_ids_used_balancer(mem_t *s, int *ids) { struct counter count; @@ -210,38 +190,16 @@ int get_ids_used_balancer(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number of balancers that the slotmem can contain. - */ int get_max_size_balancer(mem_t *s) { return s->storage->num_slots(s->slotmem); } -/** - * attach to the shared balancer table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. - */ mem_t *get_mem_balancer(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_balancer(string, num, 0, 0, p, storage); } -/** - * create a shared balancer table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. - */ mem_t *create_mem_balancer(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_balancer(string, num, persist, 1, p, storage); diff --git a/native/mod_manager/context.c b/native/mod_manager/context.c index e0d50537e..d2d4d1298 100644 --- a/native/mod_manager/context.c +++ b/native/mod_manager/context.c @@ -76,10 +76,10 @@ static mem_t *create_attach_mem_context(char *string, unsigned *num, int type, i /** * Update a context record in the shared table - * @param pointer to the shared table. + * @param mem pointer to the shared table. * @param context context to store in the shared table. + * @param pool unused argument * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { @@ -125,9 +125,10 @@ apr_status_t insert_update_context(mem_t *s, contextinfo_t *context) } /** - * read a context record from the shared table + * Read a context record from the shared table * @param pointer to the shared table. * @param context context to read from the shared table. + * @param pool unused argument * @return address of the read context or NULL if error. */ static apr_status_t loc_read_context(void *mem, void *data, apr_pool_t *pool) @@ -161,36 +162,17 @@ contextinfo_t *read_context(mem_t *s, contextinfo_t *context) return NULL; } -/** - * get a context record from the shared table - * @param pointer to the shared table. - * @param context address where the context is locate in the shared table. - * @param id in the context table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_context(mem_t *s, contextinfo_t **context, int id) { return s->storage->dptr(s->slotmem, id, (void **)context); } -/** - * remove(free) a context record from the shared table - * @param pointer to the shared table. - * @param id id of the context to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_context(mem_t *s, int id) { return s->storage->release(s->slotmem, id); } -/* - * get the ids for the used (not free) contexts in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of context existing or 0. - */ int get_ids_used_context(mem_t *s, int *ids) { struct counter count; @@ -202,38 +184,16 @@ int get_ids_used_context(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number of contexts that the slotmem can contain. - */ int get_max_size_context(mem_t *s) { return s->storage->num_slots(s->slotmem); } -/** - * attach to the shared context table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. - */ mem_t *get_mem_context(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_context(string, num, 0, 0, p, storage); } -/** - * create a shared context table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. - */ mem_t *create_mem_context(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_context(string, num, persist, 1, p, storage); diff --git a/native/mod_manager/domain.c b/native/mod_manager/domain.c index f8719f980..c6bb72a22 100644 --- a/native/mod_manager/domain.c +++ b/native/mod_manager/domain.c @@ -75,10 +75,10 @@ static mem_t *create_attach_mem_domain(char *string, unsigned *num, int type, in /** * Update a domain record in the shared table - * @param pointer to the shared table. - * @param domain domain to store in the shared table. + * @param mem pointer to the shared table + * @param domain domain to store in the shared table + * @param pool unused argument * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { @@ -123,10 +123,11 @@ apr_status_t insert_update_domain(mem_t *s, domaininfo_t *domain) } /** - * read a domain record from the shared table - * @param pointer to the shared table. - * @param domain domain to read from the shared table. - * @return address of the read domain or NULL if error. + * Read a domain record from the shared table + * @param mem pointer to the shared table + * @param domain domain to read from the shared table + * @param pool unused argument + * @return address of the read domain or NULL if error */ static apr_status_t loc_read_domain(void *mem, void *data, apr_pool_t *pool) { @@ -159,24 +160,11 @@ domaininfo_t *read_domain(mem_t *s, domaininfo_t *domain) return NULL; } -/** - * get a domain record from the shared table - * @param pointer to the shared table. - * @param domain address where the domain is locate in the shared table. - * @param ids in the domain table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_domain(mem_t *s, domaininfo_t **domain, int ids) { return s->storage->dptr(s->slotmem, ids, (void **)domain); } -/** - * remove(free) a domain record from the shared table - * @param pointer to the shared table. - * @param domain domain to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_domain(mem_t *s, domaininfo_t *domain) { apr_status_t rv; @@ -193,13 +181,6 @@ apr_status_t remove_domain(mem_t *s, domaininfo_t *domain) return rv; } -/** - * find a domain record from the shared table using JVMRoute and balancer - * @param pointer to the shared table. - * @param domain address where the node is located in the shared table. - * @param route JVMRoute to search - * @return APR_SUCCESS if all went well - */ apr_status_t find_domain(mem_t *s, domaininfo_t **domain, const char *route, const char *balancer) { domaininfo_t ou; @@ -221,12 +202,6 @@ apr_status_t find_domain(mem_t *s, domaininfo_t **domain, const char *route, con return rv; } -/* - * get the ids for the used (not free) domains in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of domain existing or 0. - */ int get_ids_used_domain(mem_t *s, int *ids) { struct counter count; @@ -238,36 +213,16 @@ int get_ids_used_domain(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number of domains that the slotmem can contain. - */ int get_max_size_domain(mem_t *s) { return s->storage->num_slots(s->slotmem); } -/** - * attach to the shared domain table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *get_mem_domain(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_domain(string, num, 0, 0, p, storage); } -/** - * create a shared domain table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *create_mem_domain(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_domain(string, num, persist, 1, p, storage); diff --git a/native/mod_manager/host.c b/native/mod_manager/host.c index 67cb0ba72..50842d3b1 100644 --- a/native/mod_manager/host.c +++ b/native/mod_manager/host.c @@ -72,13 +72,6 @@ static mem_t *create_attach_mem_host(char *string, unsigned *num, int type, int return ptr; } -/** - * Insert(alloc) and update a host record in the shared table - * @param pointer to the shared table. - * @param host host to store in the shared table. - * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * - */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { hostinfo_t *in = (hostinfo_t *)data; @@ -121,12 +114,6 @@ apr_status_t insert_update_host(mem_t *s, hostinfo_t *host) return APR_SUCCESS; } -/** - * read a host record from the shared table - * @param pointer to the shared table. - * @param host host to read from the shared table. - * @return address of the read host or NULL if error. - */ static apr_status_t loc_read_host(void *mem, void *data, apr_pool_t *pool) { hostinfo_t *in = (hostinfo_t *)data; @@ -159,35 +146,16 @@ hostinfo_t *read_host(mem_t *s, hostinfo_t *host) return NULL; } -/** - * get a host record from the shared table - * @param pointer to the shared table. - * @param host address where the host is locate in the shared table. - * @param id in the host table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_host(mem_t *s, hostinfo_t **host, int id) { return s->storage->dptr(s->slotmem, id, (void **)host); } -/** - * remove(free) a host record from the shared table - * @param pointer to the shared table. - * @param id id of the host to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_host(mem_t *s, int id) { return s->storage->release(s->slotmem, id); } -/* - * get the ids for the used (not free) hosts in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of host existing or 0. - */ int get_ids_used_host(mem_t *s, int *ids) { struct counter count; @@ -199,36 +167,16 @@ int get_ids_used_host(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number of host that the slotmem can contain. - */ int get_max_size_host(mem_t *s) { return s->storage->num_slots(s->slotmem); } -/** - * attach to the shared host table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *get_mem_host(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_host(string, num, 0, 0, p, storage); } -/** - * create a shared host table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *create_mem_host(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_host(string, num, persist, 1, p, storage); diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index 170859f33..1b9ee65ec 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -222,7 +222,7 @@ static apr_status_t loc_find_node(nodeinfo_t **node, const char *route) return find_node(nodestatsmem, node, route); } -/* +/** * Increase the version of the nodes table */ static void inc_version_node(void) @@ -232,11 +232,13 @@ static void inc_version_node(void) base->counter++; } -/* Check is the nodes (in shared memory) were modified since last +/** + * Check is the nodes (in shared memory) were modified since last * call to worker_nodes_are_updated(). - * return codes: - * 0 : No update of the nodes since last time. - * x: The version has changed the local table need to be updated. + * + * @param data server_rec + * @param pool unused argument + * @return 0 (no update) or X (the version has changed, the local table needs to be updated) */ static unsigned loc_worker_nodes_need_update(void *data, apr_pool_t *pool) { @@ -261,7 +263,9 @@ static unsigned loc_worker_nodes_need_update(void *data, apr_pool_t *pool) return 0; } -/* Store the last version update in the proccess config */ +/** + * Store the last version update in the proccess config + */ static int loc_worker_nodes_are_updated(void *data, unsigned last) { server_rec *s = (server_rec *)data; @@ -290,7 +294,9 @@ static int loc_get_max_size_host(void) return hoststatsmem ? get_max_size_host(hoststatsmem) : 0; } -/* Remove the virtual hosts and contexts corresponding the node */ +/** + * Remove the virtual hosts and contexts corresponding the node + */ static void loc_remove_host_context(int node, apr_pool_t *pool) { /* for read the hosts */ @@ -563,7 +569,6 @@ static APR_INLINE int is_child_process(void) * mutex type before the config is processed so that users can * adjust the mutex settings using the Mutex directive. */ - static int manager_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { (void)plog; @@ -574,8 +579,8 @@ static int manager_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *p } /* - * call after parser the configuration. - * create the shared memory. + * Call after parser the configuration. + * Creates the shared memory. */ static int manager_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { @@ -767,7 +772,7 @@ static char **process_buff(request_rec *r, char *buff) return ptr; } -/* +/** * Insert the hosts from Alias information */ static apr_status_t insert_update_hosts(mem_t *mem, char *str, int node, int vhost) @@ -800,8 +805,8 @@ static apr_status_t insert_update_hosts(mem_t *mem, char *str, int node, int vho return insert_update_host(mem, &info); } -/* - * remove the context using the contextinfo_t information +/** + * Remove the context using the contextinfo_t information * we read it first then remove it */ static void read_remove_context(mem_t *mem, contextinfo_t *context) @@ -813,11 +818,11 @@ static void read_remove_context(mem_t *mem, contextinfo_t *context) } } -/* +/** * Insert the context from Context information * Note: - * 1 - if status is REMOVE remove_context will be called. - * 2 - return codes of REMOVE are ignored (always success). + * 1 - if status is REMOVE remove_context will be called + * 2 - return codes of REMOVE are ignored (always success) */ static apr_status_t insert_update_contexts(mem_t *mem, char *str, int node, int vhost, int status) { @@ -862,8 +867,8 @@ static apr_status_t insert_update_contexts(mem_t *mem, char *str, int node, int return ret; } -/* - * Check that the node could be handle as is there were the same. +/** + * Check that the node could be handle as is there were the same */ static int is_same_node(const nodeinfo_t *nodeinfo, const nodeinfo_t *node) { @@ -895,8 +900,8 @@ static int is_same_node(const nodeinfo_t *nodeinfo, const nodeinfo_t *node) return -1; } -/* - * Check if another node has the same worker. +/** + * Check if another node has the same worker */ static int is_same_worker_existing(const request_rec *r, const nodeinfo_t *node) { @@ -933,7 +938,7 @@ static int is_same_worker_existing(const request_rec *r, const nodeinfo_t *node) return 0; } -/* +/** * Builds the parameter for mod_balancer */ static apr_status_t mod_manager_manage_worker(request_rec *r, const nodeinfo_t *node, const balancerinfo_t *bal) @@ -973,9 +978,8 @@ static apr_status_t mod_manager_manage_worker(request_rec *r, const nodeinfo_t * return balancer_manage(r, params); } -/* - * Check if the proxy balancer module already has a worker - * and return the id +/** + * Check if the proxy balancer module already has a worker and return the id */ static proxy_worker *proxy_node_getid(request_rec *r, const nodeinfo_t *nodeinfo, int *id, const proxy_server_conf **the_conf) @@ -1540,7 +1544,7 @@ static char *context_status_to_string(int status) } } -/* +/** * Process a DUMP command. */ static char *process_dump(request_rec *r, int *errtype) @@ -1915,7 +1919,9 @@ static char *process_info(request_rec *r, int *errtype) return NULL; } -/* Process a *-APP command that applies to the node NOTE: the node is locked */ +/** + * Process a *-APP command that applies to the node NOTE: the node is locked + */ static char *process_node_cmd(request_rec *r, int status, int *errtype, nodeinfo_t *node) { /* for read the hosts */ @@ -1975,7 +1981,9 @@ static char *process_node_cmd(request_rec *r, int status, int *errtype, nodeinfo return NULL; } -/* Process an enable/disable/stop/remove application message */ +/** + * Process an enable/disable/stop/remove application message + */ static char *process_appl_cmd(request_rec *r, char **ptr, int status, int *errtype, int global, int fromnode) { nodeinfo_t nodeinfo; @@ -2481,7 +2489,9 @@ static int mod_manager_hex2c(const char *x) #endif /*APR_CHARSET_EBCDIC */ } -/* Processing of decoded characters */ +/* + * Processing of decoded characters + */ static apr_status_t decodeenc(char **ptr) { int val, i, j; @@ -2517,7 +2527,9 @@ static apr_status_t decodeenc(char **ptr) return APR_SUCCESS; } -/* Check that the method is one of ours */ +/* + * Check that the method is one of ours + */ static int check_method(const request_rec *r) { int ours = 0; @@ -2594,7 +2606,9 @@ static int manager_trans(request_rec *r) return DECLINED; } -/* fixup logic to prevent subrequest to our methods */ +/* + * fixup logic to prevent subrequest to our methods + */ static int manager_map_to_storage(request_rec *r) { int ours = 0; @@ -2616,7 +2630,9 @@ static int manager_map_to_storage(request_rec *r) return DECLINED; } -/* Create the commands that are possible on the context */ +/* + * Create the commands that are possible on the context + */ static char *context_string(request_rec *r, contextinfo_t *ou, const char *Alias, const char *JVMRoute) { char context[CONTEXTSZ + 1]; @@ -2657,7 +2673,9 @@ static void context_command_string(request_rec *r, contextinfo_t *ou, const char } } -/* Create the commands that are possible on the node */ +/* + * Create the commands that are possible on the node + */ static char *node_string(request_rec *r, const char *JVMRoute) { return apr_pstrcat(r->pool, "JVMRoute=", JVMRoute, NULL); @@ -2684,7 +2702,7 @@ static void domain_command_string(request_rec *r, const char *Domain) } /* - * Process the parameters and display corresponding informations. + * Process the parameters and display corresponding informations */ static void manager_info_contexts(request_rec *r, int reduce_display, int allow_cmd, int node, int host, const char *Alias, const char *JVMRoute) @@ -2976,7 +2994,9 @@ static void printproxy_stat(request_rec *r, int reduce_display, const proxy_work } } -/* Display module information */ +/* + * Display module information + */ static void modules_info(request_rec *r) { if (ap_find_linked_module("mod_proxy_cluster.c") != NULL) { @@ -3010,7 +3030,9 @@ static void modules_info(request_rec *r) } } -/* Process INFO message and mod_cluster_manager pages generation */ +/* + * Process INFO message and mod_cluster_manager pages generation + */ static int manager_info(request_rec *r) { int size, i, sizesessionid; @@ -3393,7 +3415,7 @@ static int manager_handler(request_rec *r) } /* - * Attach to the shared memory when the child is created. + * Attach to the shared memory when the child is created */ static void manager_child_init(apr_pool_t *p, server_rec *s) { @@ -3478,7 +3500,7 @@ static void manager_child_init(apr_pool_t *p, server_rec *s) } /* - * Supported directives. + * Supported directives */ static const char *cmd_manager_maxcontext(cmd_parms *cmd, void *mconfig, const char *word) { diff --git a/native/mod_manager/mod_manager.h b/native/mod_manager/mod_manager.h index 432726fef..3a4116e06 100644 --- a/native/mod_manager/mod_manager.h +++ b/native/mod_manager/mod_manager.h @@ -25,6 +25,15 @@ * @version $Revision$ */ +/** + * @file mod_manager.h + * @brief Manager module for Apache + * + * @defgroup MOD_MANAGER mod_manager + * @ingroup APACHE_MODS + * @{ + */ + struct mem { ap_slotmem_instance_t *slotmem; diff --git a/native/mod_manager/node.c b/native/mod_manager/node.c index 7de0f29dc..f10ff997d 100644 --- a/native/mod_manager/node.c +++ b/native/mod_manager/node.c @@ -79,12 +79,6 @@ static mem_t *create_attach_mem_node(char *string, unsigned *num, int type, int return ptr; } -/** - * return the last stored in the mem structure - * @param pointer to the shared table - * @return APR_SUCCESS if all went well - * - */ apr_status_t get_last_mem_error(mem_t *mem) { return mem->laststatus; @@ -93,10 +87,10 @@ apr_status_t get_last_mem_error(mem_t *mem) /** * Update a node record in the shared table - * @param pointer to the shared table. - * @param node node to store in the shared table. + * @param mem pointer to the shared table + * @param data node to store in the shared table + * @param p unused argument * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { @@ -175,10 +169,10 @@ apr_status_t insert_update_node(mem_t *s, nodeinfo_t *node, int *id, int clean) } /** - * read a node record from the shared table - * @param pointer to the shared table. - * @param node node to read from the shared table. - * @return address of the read node or NULL if error. + * Read a node record from the shared table + * @param mem pointer to the shared table + * @param data node node to read from the shared table + * @return address of the read node or NULL if error */ static apr_status_t loc_read_node(void *mem, void *data, apr_pool_t *pool) { @@ -212,36 +206,16 @@ nodeinfo_t *read_node(mem_t *s, nodeinfo_t *node) return NULL; } -/** - * get a node record from the shared table (using ids). - * @param pointer to the shared table. - * @param node address where the node is located in the shared table. - * @param ids in the node table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_node(mem_t *s, nodeinfo_t **node, int ids) { return s->storage->dptr(s->slotmem, ids, (void **)node); } -/** - * remove(free) a node record from the shared table - * @param pointer to the shared table. - * @param id id of the node to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_node(mem_t *s, int id) { return s->storage->release(s->slotmem, id); } -/** - * find a node record from the shared table using JVMRoute - * @param pointer to the shared table. - * @param node address where the node is located in the shared table. - * @param route JVMRoute to search - * @return APR_SUCCESS if all went well - */ apr_status_t find_node(mem_t *s, nodeinfo_t **node, const char *route) { nodeinfo_t ou; @@ -259,12 +233,6 @@ apr_status_t find_node(mem_t *s, nodeinfo_t **node, const char *route) return rv; } -/* - * get the ids for the used (not free) nodes in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of node existing or 0. - */ int get_ids_used_node(mem_t *s, int *ids) { struct counter count; @@ -276,52 +244,29 @@ int get_ids_used_node(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number nodes that the slotmem can contain or 0 if no storage available. - */ int get_max_size_node(mem_t *s) { return s->storage == NULL ? 0 : s->storage->num_slots(s->slotmem); } /** - * attach to the shared node table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. + * Attach to the shared node table + * @param string name of an existing shared table + * @param num address to store the size of the shared table + * @param p pool to use for allocations + * @param storage slotmem logic provider + * @return address of struct used to access the table */ mem_t *get_mem_node(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_node(string, num, 0, 0, p, storage); } -/** - * create a shared node table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @param storage slotmem logic provider. - * @return address of struct used to access the table. - */ mem_t *create_mem_node(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_node(string, num, (unsigned)persist, 1, p, storage); } - -/** - * find the first node that corresponds to host/port. - * @param pointer to the shared table. - * @param node node to read from the shared table. - * @param host string containing the host. - * @param port string containing the port . - * @return APR_SUCCESS if all went well - */ static apr_status_t loc_read_node_byhostport(void *mem, void *data, apr_pool_t *pool) { nodeinfo_t *in = (nodeinfo_t *)data; @@ -335,6 +280,14 @@ static apr_status_t loc_read_node_byhostport(void *mem, void *data, apr_pool_t * return APR_SUCCESS; } +/** + * Find the first node that corresponds to host/port + * @param s pointer to the shared table + * @param node node to read from the shared table + * @param host string containing the host + * @param port string containing the port + * @return APR_SUCCESS if all went well + */ apr_status_t find_node_byhostport(mem_t *s, nodeinfo_t **node, const char *host, const char *port) { nodeinfo_t ou; diff --git a/native/mod_manager/sessionid.c b/native/mod_manager/sessionid.c index 9c84627f6..a54ab557d 100644 --- a/native/mod_manager/sessionid.c +++ b/native/mod_manager/sessionid.c @@ -75,10 +75,10 @@ static mem_t *create_attach_mem_sessionid(char *string, unsigned *num, int type, /** * Update a sessionid record in the shared table - * @param pointer to the shared table. - * @param sessionid sessionid to store in the shared table. + * @param mem pointer to the shared table + * @param data sessionid to store in the shared table + * @param pool unused argument * @return APR_EEXIST if the record was updated, APR_SUCCESS otherwise - * */ static apr_status_t update(void *mem, void *data, apr_pool_t *pool) { @@ -159,24 +159,11 @@ sessionidinfo_t *read_sessionid(mem_t *s, sessionidinfo_t *sessionid) return NULL; } -/** - * get a sessionid record from the shared table - * @param pointer to the shared table. - * @param sessionid address where the sessionid is locate in the shared table. - * @param id in the sessionid table. - * @return APR_SUCCESS if all went well - */ apr_status_t get_sessionid(mem_t *s, sessionidinfo_t **sessionid, int id) { return s->storage->dptr(s->slotmem, id, (void **)sessionid); } -/** - * remove(free) a sessionid record from the shared table - * @param pointer to the shared table. - * @param sessionid sessionid to remove from the shared table. - * @return APR_SUCCESS if all went well - */ apr_status_t remove_sessionid(mem_t *s, sessionidinfo_t *sessionid) { apr_status_t rv; @@ -193,12 +180,6 @@ apr_status_t remove_sessionid(mem_t *s, sessionidinfo_t *sessionid) return rv; } -/* - * get the ids for the used (not free) sessionids in the table - * @param pointer to the shared table. - * @param ids array of int to store the used id (must be big enough). - * @return number of sessionid existing or 0. - */ int get_ids_used_sessionid(mem_t *s, int *ids) { struct counter count; @@ -210,36 +191,16 @@ int get_ids_used_sessionid(mem_t *s, int *ids) return count.count; } -/* - * read the size of the table. - * @param pointer to the shared table. - * @return the max number of sessionid that the slotmem can contain. - */ int get_max_size_sessionid(mem_t *s) { return s->storage->num_slots(s->slotmem); } -/** - * attach to the shared sessionid table - * @param name of an existing shared table. - * @param address to store the size of the shared table. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *get_mem_sessionid(char *string, unsigned *num, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_sessionid(string, num, 0, 0, p, storage); } -/** - * create a shared sessionid table - * @param name to use to create the table. - * @param size of the shared table. - * @param persist tell if the slotmem element are persistent. - * @param p pool to use for allocations. - * @return address of struct used to access the table. - */ mem_t *create_mem_sessionid(char *string, unsigned *num, int persist, apr_pool_t *p, slotmem_storage_method *storage) { return create_attach_mem_sessionid(string, num, persist, 1, p, storage);