00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #include <config.h>
00023 
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 
00027 #include <isc/app.h>
00028 #include <isc/lib.h>
00029 #include <isc/mem.h>
00030 #include <isc/msgs.h>
00031 #include <isc/once.h>
00032 #include <isc/socket.h>
00033 #include <isc/task.h>
00034 #include <isc/timer.h>
00035 #include <isc/util.h>
00036 
00037 
00038 
00039 
00040 
00041 LIBISC_EXTERNAL_DATA isc_msgcat_t *             isc_msgcat = NULL;
00042 
00043 
00044 
00045 
00046 
00047 
00048 static isc_once_t               msgcat_once = ISC_ONCE_INIT;
00049 
00050 
00051 
00052 
00053 
00054 static void
00055 open_msgcat(void) {
00056         isc_msgcat_open("libisc.cat", &isc_msgcat);
00057 }
00058 
00059 void
00060 isc_lib_initmsgcat(void) {
00061         isc_result_t result;
00062 
00063 
00064 
00065 
00066 
00067 
00068         result = isc_once_do(&msgcat_once, open_msgcat);
00069         if (result != ISC_R_SUCCESS) {
00070                 
00071 
00072 
00073 
00074 
00075 
00076                 fprintf(stderr, "%s:%d: %s: isc_once_do() %s.\n",
00077                         __FILE__, __LINE__,
00078                         isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
00079                                        ISC_MSG_FATALERROR, "fatal error"),
00080                         isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
00081                                        ISC_MSG_FAILED, "failed"));
00082                 abort();
00083         }
00084 }
00085 
00086 static isc_once_t               register_once = ISC_ONCE_INIT;
00087 
00088 static void
00089 do_register(void) {
00090         isc_bind9 = ISC_FALSE;
00091 
00092         RUNTIME_CHECK(isc__mem_register() == ISC_R_SUCCESS);
00093         RUNTIME_CHECK(isc__app_register() == ISC_R_SUCCESS);
00094         RUNTIME_CHECK(isc__task_register() == ISC_R_SUCCESS);
00095         RUNTIME_CHECK(isc__socket_register() == ISC_R_SUCCESS);
00096         RUNTIME_CHECK(isc__timer_register() == ISC_R_SUCCESS);
00097 }
00098 
00099 void
00100 isc_lib_register(void) {
00101         RUNTIME_CHECK(isc_once_do(®ister_once, do_register)
00102                       == ISC_R_SUCCESS);
00103 }