Permalink
Browse files

added marco ngx_tcp_cycle_get_module_main_conf

If developer writes a tcp module and defines ngx_module_t:init_module field,
this macro will be useful to get main conf of his tcp module from cycle.

    nginx_module_t {
      ngx_int_t (*init_module)(ngx_cycle_t *cycle);
    }

Note that http module has a similar macro (ngx_http_cycle_get_module_main_conf).
  • Loading branch information...
1 parent dcdfe9e commit fdaaa08b3b256bc4b4ea7fdca630862faa62acbc @chobits chobits committed Jan 24, 2014
Showing with 6 additions and 0 deletions.
  1. +6 −0 ngx_tcp.h
View
@@ -271,8 +271,14 @@ typedef struct {
#define ngx_tcp_conf_get_module_srv_conf(cf, module) \
((ngx_tcp_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
+#define ngx_tcp_cycle_get_module_main_conf(cycle, module) \
+ (cycle->conf_ctx[ngx_tcp_module.index] ? \
+ ((ngx_tcp_conf_ctx_t *) cycle->conf_ctx[ngx_tcp_module.index]) \
+ ->main_conf[module.ctx_index]: \
+ NULL)
extern ngx_uint_t ngx_tcp_max_module;
extern ngx_module_t ngx_tcp_core_module;
+extern ngx_module_t ngx_tcp_module;
#endif /* _NGX_TCP_H_INCLUDED_ */

0 comments on commit fdaaa08

Please sign in to comment.