OSDN Git Service

Update INSTALL.ja.utf-8 for new release.
[ultramonkey-l7/ultramonkey-l7-v2.git] / src / protomod.c
1 /*
2  * @file  protomod.c
3  * @brief the framework module of protocol module 
4  * @brief it proceeds common function of protocol module
5  *
6  * L7VSD: Linux Virtual Server for Layer7 Load Balancing
7  * Copyright (C) 2005  NTT COMWARE Corporation.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  *
24  **********************************************************************/
25
26 #include <string.h>
27 #include <sys/types.h>
28 #include <unistd.h>
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <glib.h>
32 #include <map>
33
34 #include "l7vs_module.h"
35 #include "l7vs_dest.h"
36 #include "l7vs_service.h"
37 #include "l7vs_sched.h"
38 #include "l7vs_conn.h"
39 #include "l7vs_replication.h"
40 #include "logger_wrapper.h"
41
42 #if defined(LOGGER_PROCESS_VSD)
43 const LOG_CATEGORY_TAG log_cat_protocol = LOG_CAT_L7VSD_PROTOCOL;
44 #else
45 const LOG_CATEGORY_TAG log_cat_protocol = LOG_CAT_L7VSADM_PROTOCOL;
46 #endif
47
48 static struct l7vs_protomod *l7vs_protomod_load(char *modname);
49 static void l7vs_protomod_unload(struct l7vs_protomod *pmod);
50 static gint l7vs_protomod_cmp(struct l7vs_protomod *pmod, char *name);
51
52 static int protomod_initialize(struct l7vs_service *srv, struct l7vs_conn *conn ,char *buf ,size_t len , struct l7vs_dest **dest);
53 static int protomod_finalize(struct l7vs_service *srv, struct l7vs_conn *conn ,char *buf , size_t len , struct l7vs_dest **dest, int resched);
54  
55 static GList *l7vs_protomod_list = NULL;
56
57 typedef std::map<LOG_CATEGORY_TAG,LOG_CATEGORY_TAG> log_category_map;
58
59 log_category_map                module_logcategory_map;
60 static enum LOG_LEVEL_TAG protomod_getloglevel( const enum LOG_CATEGORY_TAG );
61 static void protomod_log_debug( const enum LOG_CATEGORY_TAG,
62                                 const unsigned int,
63                                 char*,
64                                 int,
65                                 const char* );
66 static void protomod_log_info(  const enum LOG_CATEGORY_TAG,
67                                 const unsigned int,
68                                 char*,
69                                 int,
70                                 const char* );
71 static void protomod_log_warn(  const enum LOG_CATEGORY_TAG,
72                                 const unsigned int,
73                                 char*,
74                                 int,
75                                 const char* );
76 static void protomod_log_error( const enum LOG_CATEGORY_TAG,
77                                 const unsigned int,
78                                 char*,
79                                 int,
80                                 const char* );
81 static void protomod_log_fatal( const enum LOG_CATEGORY_TAG,
82                                 const unsigned int,
83                                 char*,
84                                 int,
85                                 const char* );
86
87 /*!
88  * Protocol module get function.
89  * @param name [in] Protocol module name.
90  * @return Got protocol module.
91  */
92 struct l7vs_protomod *
93 l7vs_protomod_get(char *name)
94 {
95         struct l7vs_protomod *pmod = NULL;
96
97         /*-------- DEBUG LOG --------*/
98         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
99                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,1,
100                     "in_function: struct l7vs_protomod* l7vs_protomod_get(char* name): name=\"%s\"", name);
101         }
102         /*------ DEBUG LOG END ------*/
103
104         /* check null */
105         if (name == NULL) {
106                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,2,
107                     "Arg(name) is NULL pointer.");
108                 goto get_out;
109         }
110
111         /* lookup from loaded module list */
112         pmod = l7vs_protomod_lookup(name);
113         if (pmod == NULL) {
114                 /* load */
115                 pmod = l7vs_protomod_load(name);
116                 if (pmod == NULL) {
117                         LOGGER_PUT_LOG_ERROR(log_cat_protocol,3,
118                             "Protocol module not found (maybe module problem)");
119                         goto get_out;
120                 }
121                 pmod->refcnt = 0;
122         }
123
124         pmod->refcnt++;
125
126 get_out:
127         /*-------- DEBUG LOG --------*/
128         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
129                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,2,
130                     "out_function: struct l7vs_protomod* l7vs_protomod_get(char* name): return_value=%p", pmod);
131         }
132         /*------ DEBUG LOG END ------*/
133
134         return pmod;
135 }
136
137 /*!
138  * Protocol module put function.
139  * @param pmod [in] Protocol module.
140  */
141 void
142 l7vs_protomod_put(struct l7vs_protomod *pmod)
143 {
144         /*-------- DEBUG LOG --------*/
145         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
146                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,3,
147                     "in_function: void l7vs_protomod_put(struct l7vs_protomod* pmod): pmod=%p", pmod);
148         }
149         /*------ DEBUG LOG END ------*/
150
151         /* check null */
152         if (pmod == NULL) {
153                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,4,
154                     "Arg(pmod) is NULL pointer.");
155                 goto put_out;
156         }
157
158         if (--pmod->refcnt <= 0) {
159                 l7vs_module_remove(&l7vs_protomod_list, pmod);
160                 l7vs_protomod_unload(pmod);
161         }
162
163 put_out:
164         /*-------- DEBUG LOG --------*/
165         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
166                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,4,
167                     "out_function: void l7vs_protomod_put(struct l7vs_protomod* pmod)");
168         }
169         /*------ DEBUG LOG END ------*/
170
171 }
172
173 /*!
174  * Protocol module load function.
175  * @param modname [in] Protocol module name.
176  * @retern Loaded protocol module struct.
177  */
178 static struct l7vs_protomod *
179 l7vs_protomod_load(char *modname)
180 {
181         struct l7vs_protomod *pmod = NULL;
182
183 #if defined(LOGGER_PROCESS_ADM)
184         if( module_logcategory_map.empty() ){//make category convert table
185                 module_logcategory_map[LOG_CAT_L7VSD_PROTOCOL] = LOG_CAT_L7VSADM_PROTOCOL;
186                 module_logcategory_map[LOG_CAT_L7VSD_SYSTEM_MEMORY] = LOG_CAT_L7VSADM_COMMON;
187         }
188 #else
189         if( module_logcategory_map.empty() ){
190                 module_logcategory_map[LOG_CAT_L7VSD_PROTOCOL] =LOG_CAT_L7VSD_PROTOCOL;
191                 module_logcategory_map[LOG_CAT_L7VSD_SYSTEM_MEMORY] =LOG_CAT_L7VSD_SYSTEM_MEMORY;
192         }
193 #endif
194         /*-------- DEBUG LOG --------*/
195         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
196                 LOGGER_PUT_LOG_DEBUG( log_cat_protocol,5,
197                     "in_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): modname=\"%s\"", modname);
198         }
199         /*------ DEBUG LOG END ------*/
200
201         /* check null */
202         if (modname == NULL) {
203                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,5,
204                     "Arg(modname) is NULL pointer.");
205                 goto load_out;
206         }
207
208         pmod = (struct l7vs_protomod *)l7vs_module_load(modname, "protomod");
209
210         if (pmod == NULL) {
211                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,6,
212                     "Module load error.");
213                 goto load_out;
214         }
215         pmod->initialize = protomod_initialize;
216         pmod->finalize = protomod_finalize;
217
218 #if 0
219         pmod->get_log_level = logger_get_log_level;
220         pmod->put_log_debug = logger_put_log_debug;
221         pmod->put_log_info = logger_put_log_info;
222         pmod->put_log_warn = logger_put_log_warn;
223         pmod->put_log_error = logger_put_log_error;
224         pmod->put_log_debug = logger_put_log_debug;
225 #endif
226         pmod->get_log_level     = protomod_getloglevel;
227         pmod->put_log_debug     = protomod_log_debug;
228         pmod->put_log_info      = protomod_log_info;
229         pmod->put_log_warn      = protomod_log_warn;
230         pmod->put_log_error     = protomod_log_error;
231         pmod->put_log_fatal     = protomod_log_fatal;
232
233 #ifndef LOGGER_PROCESS_ADM
234         pmod->replication_pay_memory = l7vs_replication_pay_memory;
235 #endif
236
237         l7vs_module_register(&l7vs_protomod_list, pmod);
238
239 load_out:
240         /*-------- DEBUG LOG --------*/
241         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
242                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,6,
243                     "out_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): return_value=%p", pmod);
244         }
245         /*------ DEBUG LOG END ------*/
246
247         return pmod;
248 }
249
250 /*!
251  * Protocol module unload function.
252  * @param pmod [in] Protocol module.
253  */
254 static void 
255 l7vs_protomod_unload(struct l7vs_protomod *pmod)
256 {
257         void *h;
258
259         /*-------- DEBUG LOG --------*/
260         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
261                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,7,
262                     "in_function: void l7vs_protomod_unload(struct l7vs_protomod* pmod): pmod=%p", pmod);
263         }
264         /*------ DEBUG LOG END ------*/
265
266         /* check null */
267         if (pmod == NULL) {
268                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,7,
269                     "Arg(pmod) is NULL pointer.");
270                 goto unload_out;
271         }
272
273         h = pmod->handle;
274         if (pmod->fini != NULL) {
275                 pmod->fini();
276         }
277         l7vs_module_unload(h);
278
279 unload_out:
280         /*-------- DEBUG LOG --------*/
281         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
282                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,8,
283                     "out_function: void l7vs_protomod_unload(struct l7vs_protomod* pmod)");
284         }
285         /*------ DEBUG LOG END ------*/
286 }
287
288 /*!
289  * Protocol module lookup function.
290  * @param modname [in] Protocol module name.
291  * @retern Found protocol module struct.
292  */
293 struct l7vs_protomod *
294 l7vs_protomod_lookup(char *modname)
295 {
296         struct l7vs_protomod* pmod = NULL;
297
298         /*-------- DEBUG LOG --------*/
299         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
300                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,9,
301                     "in_function: struct l7vs_protomod* l7vs_protomod_lookup(char* modname): "
302                     "modname=\"%s\"", modname);
303         }
304         /*------ DEBUG LOG END ------*/
305
306         /* check null */
307         if (modname == NULL) {
308                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,8,
309                     "Arg(modname) is NULL pointer.");
310                 goto lookup_out;
311         }
312
313         pmod = (struct l7vs_protomod *) l7vs_module_lookup(l7vs_protomod_list, modname,
314             (GCompareFunc) l7vs_protomod_cmp);
315
316 lookup_out:
317         /*-------- DEBUG LOG --------*/
318         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
319                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,10,
320                     "out_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): "
321                     "return_value=%p", pmod);
322         }
323         /*------ DEBUG LOG END ------*/
324
325         return pmod;
326 }
327
328 /*!
329  * Protocol module name compare function.
330  * @param pmod [in] Protocol module.
331  * @param name [in] Protocol module name.
332  * @retval 0 Match.
333  * @retval <0, >0 Not match.
334  */
335 static gint
336 l7vs_protomod_cmp(struct l7vs_protomod *pmod, char *name)
337 {
338         gint return_value;
339
340         /*-------- DEBUG LOG --------*/
341         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
342                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,11,
343                     "in_function: gint l7vs_protomod_cmp(struct l7vs_protomod* pmod, char* name): "
344                     "pmod=%p, name=\"%s\"", pmod, name);
345         }
346         /*------ DEBUG LOG END ------*/
347
348         /* check null */
349         if (pmod == NULL) {
350                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,9,
351                     "Arg(pmod) is NULL pointer.");
352                 return_value = -1;
353                 goto cmp_out;
354         }
355         if (name == NULL) {
356                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,10,
357                     "Arg(name) is NULL pointer.");
358                 return_value = -1;
359                 goto cmp_out;
360         }
361
362         return_value = strcmp(pmod->modname, name);
363
364 cmp_out:
365         /*-------- DEBUG LOG --------*/
366         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
367                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,12,
368                     "out_function: gint l7vs_protomod_cmp(struct l7vs_protomod* pmod, char* name): "
369                     "return_value=%d", return_value);
370         }
371         /*------ DEBUG LOG END ------*/
372
373         return return_value;
374 }
375
376 /*!
377  * Protocol module initialize function.
378  * @param srv  [in]  Virtual service struct.
379  * @param conn [in]  Client connection struct.
380  * @param buf  [in]  Client request payload.
381  * @param len  [in]  Length of client request payload.
382  * @param dest [out] Destination struct list.
383  * @retval 0  Success.
384  * @retval -1 Error.
385  */
386 static int
387 protomod_initialize(struct l7vs_service *srv, struct l7vs_conn *conn, char *buf, size_t len, struct l7vs_dest **dest)
388 {
389         int return_value = 0;
390
391         /*-------- DEBUG LOG --------*/
392         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
393                 char srv_str[DEBUG_STR_LEN] = {0};
394                 char conn_str[DEBUG_STR_LEN] = {0};
395                 char dest_str[DEBUG_STR_LEN] = {0};
396                 l7vs_service_c_str(srv_str, srv);
397                 l7vs_conn_c_str(conn_str, conn);
398                 if (dest == NULL) {
399                         strncpy(dest_str, "NULL", DEBUG_STR_LEN);
400                 }
401                 else {
402                         l7vs_dest_c_str(dest_str, *dest);
403                 }
404                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,13,
405                     "in_function: int protomod_initialize(struct l7vs_service* srv, struct l7vs_conn* conn, "
406                     "char* buf, size_t len, struct l7vs_dest** dest): srv=&(%s), conn=&(%s), buf=\"%s\", "
407                     "len=%ld, dest=&(&(%s))", srv_str, conn_str, buf, (long int)len, dest_str);
408         }
409         /*------ DEBUG LOG END ------*/
410
411         /* check null */
412         if (dest == NULL) {
413                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,11,
414                     "Arg(dest) is NULL pointer.");
415                 return_value = -1;
416                 goto initialize_out;
417         }
418
419         /* clean up destination list */
420         *dest = NULL;
421
422 initialize_out:
423         /*-------- DEBUG LOG --------*/
424         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
425                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,14,
426                     "out_function: int protomod_initialize(struct l7vs_service* srv, struct l7vs_conn* conn, "
427                     "char* buf, size_t len, struct l7vs_dest** dest): return_value=%d", return_value);
428         }
429         /*------ DEBUG LOG END ------*/
430
431         return return_value;
432 }
433
434 /*!
435  * Protocol module finalize function.
436  * @param srv  [in]  Virtual service struct.
437  * @param conn [in]  Client connection struct.
438  * @param buf  [in]  Client request payload.
439  * @param len  [in]  Length of client request payload.
440  * @param dest [out] Destination struct list.
441  * @retval 0  Success.
442  * @retval -1 Error.
443  */
444 static int
445 protomod_finalize(struct l7vs_service *srv, struct l7vs_conn *conn, char *buf, size_t len, struct l7vs_dest **dest, int resched)
446 {
447         GList *l;
448         struct l7vs_dest *d;
449         GList *active_dest = NULL;
450         int return_value = 0;
451
452         /*-------- DEBUG LOG --------*/
453         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
454                 char srv_str[DEBUG_STR_LEN] = {0};
455                 char conn_str[DEBUG_STR_LEN] = {0};
456                 char dest_str[DEBUG_STR_LEN] = {0};
457                 l7vs_service_c_str(srv_str, srv);
458                 l7vs_conn_c_str(conn_str, conn);
459                 if (dest == NULL) {
460                         strncpy(dest_str, "NULL", DEBUG_STR_LEN);
461                 }
462                 else {
463                         l7vs_dest_c_str(dest_str, *dest);
464                 }
465                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,15,
466                     "in_function: int protomod_finalize(struct l7vs_service* srv, struct l7vs_conn* conn, "
467                     "char* buf, size_t len, struct l7vs_dest** dest, int resched): srv=&(%s), conn=&(%s), buf=\"%s\", "
468                     "len=%ld, dest=&(&(%s)), resched=%d", srv_str, conn_str, buf, (long int)len, dest_str, resched);
469         }
470         /*------ DEBUG LOG END ------*/
471
472         /* check null */
473         if (srv == NULL) {
474                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,12,
475                     "Arg(srv) is NULL pointer.");
476                 return_value = -1;
477                 goto finalize_out;
478         }
479         if (dest == NULL) {
480                 LOGGER_PUT_LOG_ERROR(log_cat_protocol,13,
481                     "Arg(dest) is NULL pointer.");
482                 return_value = -1;
483                 goto finalize_out;
484         }
485
486         // pick up active real server (weight > 0)
487         for (l = g_list_first(srv->dest_list); l != NULL; l = g_list_next(l)) {
488                 d = (struct l7vs_dest*) l->data;
489                 if (d->weight > 0) {
490                         active_dest = g_list_append(active_dest, l->data);
491                 }
492         }
493
494         if((*dest) != NULL ){
495                 // check dest whether it exists in active real server list
496                 for( l = g_list_first(active_dest); l != NULL; l = g_list_next(l) ){
497                         d = (struct l7vs_dest*) l->data;
498                         if((d->addr.sin_addr.s_addr == (*dest)->addr.sin_addr.s_addr ) &&
499                            (d->addr.sin_port == (*dest)->addr.sin_port) ){
500                                 *dest = d;
501                                 goto finalize_out;
502                         }
503                 }
504
505                 // no reschedule
506                 if( resched == 0 ){
507                         LOGGER_PUT_LOG_INFO(log_cat_protocol,1, "RealServer nonexistence.");
508                         return_value = -1;
509                         goto finalize_out;
510                 }
511
512                 // reschedule
513                 *dest = srv->scheduler->schedule(srv, conn);
514
515                 if( *dest == NULL ){
516                         LOGGER_PUT_LOG_INFO(log_cat_protocol,2, "RealServer nonexistence.");
517                         return_value = -1;
518                         goto finalize_out;
519                 }
520         }
521         else{
522                 // schedule
523                 *dest = srv->scheduler->schedule(srv, conn);
524
525                 if( *dest == NULL ){
526                         LOGGER_PUT_LOG_INFO(log_cat_protocol,3, "RealServer nonexistence.");
527                         return_value = -1;
528                         goto finalize_out;
529                 }
530         }
531
532 finalize_out:
533         g_list_free(active_dest);
534
535         /*-------- DEBUG LOG --------*/
536         if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
537                 LOGGER_PUT_LOG_DEBUG(log_cat_protocol,16,
538                     "out_function: int protomod_finalize(struct l7vs_service* srv, struct l7vs_conn* conn, "
539                     "char* buf, size_t len, struct l7vs_dest** dest, int resched): return_value=%d", return_value);
540         }
541         /*------ DEBUG LOG END ------*/
542
543         return return_value;
544 }
545
546
547 /**
548  * log getter local function
549  *
550  **/
551 static enum LOG_LEVEL_TAG protomod_getloglevel( const enum LOG_CATEGORY_TAG cat ){
552         log_category_map::iterator itr = module_logcategory_map.find( cat );
553         if( itr != module_logcategory_map.end() ){
554                 return logger_get_log_level( itr->second );
555         }
556         else{
557                 itr = module_logcategory_map.begin();
558                 return logger_get_log_level( itr->second );
559         }
560 }
561
562 static void protomod_log_debug( const enum LOG_CATEGORY_TAG cat,
563                                 const unsigned int message_id,
564                                 char* file,
565                                 int line,
566                                 const char* message ){
567         log_category_map::iterator itr = module_logcategory_map.find( cat );
568         if( itr == module_logcategory_map.end() )
569                 itr = module_logcategory_map.begin();
570         logger_put_log_debug( itr->second, message_id, file, line, message );
571 }
572
573 static void protomod_log_info(  const enum LOG_CATEGORY_TAG cat,
574                                 const unsigned int message_id,
575                                 char* file,
576                                 int   line,
577                                 const char* message ){
578         log_category_map::iterator itr = module_logcategory_map.find( cat );
579         if( itr == module_logcategory_map.end() )
580                 itr = module_logcategory_map.begin();
581         logger_put_log_info( itr->second, message_id, file, line, message );
582 }
583
584 static void protomod_log_warn(  const enum LOG_CATEGORY_TAG cat,
585                                 const unsigned int message_id,
586                                 char* file,
587                                 int   line,
588                                 const char* message ){
589         log_category_map::iterator itr = module_logcategory_map.find( cat );
590         if( itr == module_logcategory_map.end() )
591                 itr = module_logcategory_map.begin();
592         logger_put_log_warn( itr->second, message_id, file, line, message );
593 }
594
595 static void protomod_log_error( const enum LOG_CATEGORY_TAG cat,
596                                  const unsigned int message_id,
597                                  char* file,
598                                  int   line,
599                                  const char* message ){
600         log_category_map::iterator itr = module_logcategory_map.find( cat );
601         if( itr == module_logcategory_map.end() )
602                 itr = module_logcategory_map.begin();
603         logger_put_log_error( itr->second, message_id, file, line, message );
604 }
605
606 static void protomod_log_fatal( const enum LOG_CATEGORY_TAG cat,
607                                 const unsigned int message_id,
608                                 char* file,
609                                 int   line,
610                                 const char* message ){
611         log_category_map::iterator itr = module_logcategory_map.find( cat );
612         if( itr == module_logcategory_map.end() )
613                 itr = module_logcategory_map.begin();
614         logger_put_log_fatal( itr->second, message_id, file, line, message );
615 }