00001 /** @file 00002 00003 A brief file description 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 00025 #include "ink_config.h" 00026 #include <stdio.h> 00027 #include <string.h> 00028 00029 #include "P_EventSystem.h" 00030 // #include "I_Disk.h" unused 00031 #include "I_Cache.h" 00032 #include "I_Net.h" 00033 //#include "P_Cluster.h" 00034 #include "I_HostDB.h" 00035 #include "BaseManager.h" 00036 #include "P_MultiCache.h" 00037 00038 /*------------------------------------------------------------------------- 00039 event_int_to_string 00040 00041 This routine will translate an integer event number to a string 00042 identifier based on a brute-force search of a switch tag. If the event 00043 cannot be located in the switch table, the routine will construct and 00044 return a string of the integer identifier. 00045 -------------------------------------------------------------------------*/ 00046 00047 const char * 00048 event_int_to_string(int event, int blen, char *buffer) 00049 { 00050 switch (event) { 00051 case -1: return "<no event>"; 00052 case VC_EVENT_READ_READY: return "VC_EVENT_READ_READY"; 00053 case VC_EVENT_WRITE_READY: return "VC_EVENT_WRITE_READY"; 00054 case VC_EVENT_READ_COMPLETE: return "VC_EVENT_READ_COMPLETE"; 00055 case VC_EVENT_WRITE_COMPLETE: return "VC_EVENT_WRITE_COMPLETE"; 00056 case VC_EVENT_EOS: return "VC_EVENT_EOS"; 00057 case VC_EVENT_INACTIVITY_TIMEOUT: return "VC_EVENT_INACTIVITY_TIMEOUT"; 00058 case VC_EVENT_ACTIVE_TIMEOUT: return "VC_EVENT_ACTIVE_TIMEOUT"; 00059 00060 case NET_EVENT_OPEN: return "NET_EVENT_OPEN"; 00061 case NET_EVENT_OPEN_FAILED: return "NET_EVENT_OPEN_FAILED"; 00062 case NET_EVENT_ACCEPT: return "NET_EVENT_ACCEPT"; 00063 case NET_EVENT_ACCEPT_SUCCEED: return "NET_EVENT_ACCEPT_SUCCEED"; 00064 case NET_EVENT_ACCEPT_FAILED: return "NET_EVENT_ACCEPT_FAILED"; 00065 00066 00067 #ifdef CLUSTER_CACHE 00068 case CLUSTER_EVENT_CHANGE: return "CLUSTER_EVENT_CHANGE"; 00069 case CLUSTER_EVENT_CONFIGURATION: return "CLUSTER_EVENT_CONFIGURATION"; 00070 case CLUSTER_EVENT_OPEN: return "CLUSTER_EVENT_OPEN"; 00071 case CLUSTER_EVENT_OPEN_FAILED: return "CLUSTER_EVENT_OPEN_FAILED"; 00072 case CLUSTER_EVENT_STEAL_THREAD: return "CLUSTER_EVENT_STEAL_THREAD"; 00073 #endif 00074 case EVENT_HOST_DB_LOOKUP: return "EVENT_HOST_DB_LOOKUP"; 00075 case EVENT_HOST_DB_GET_RESPONSE: return "EVENT_HOST_DB_GET_RESPONSE"; 00076 00077 case DNS_EVENT_EVENTS_START: return "DNS_EVENT_EVENTS_START"; 00078 00079 00080 case MULTI_CACHE_EVENT_SYNC: return "MULTI_CACHE_EVENT_SYNC"; 00081 00082 case CACHE_EVENT_LOOKUP: return "CACHE_EVENT_LOOKUP"; 00083 case CACHE_EVENT_LOOKUP_FAILED: return "CACHE_EVENT_LOOKUP_FAILED"; 00084 case CACHE_EVENT_OPEN_READ: return "CACHE_EVENT_OPEN_READ"; 00085 case CACHE_EVENT_OPEN_READ_FAILED: return "CACHE_EVENT_OPEN_READ_FAILED"; 00086 case CACHE_EVENT_OPEN_WRITE: return "CACHE_EVENT_OPEN_WRITE"; 00087 case CACHE_EVENT_OPEN_WRITE_FAILED: return "CACHE_EVENT_OPEN_WRITE_FAILED"; 00088 case CACHE_EVENT_REMOVE: return "CACHE_EVENT_REMOVE"; 00089 case CACHE_EVENT_REMOVE_FAILED: return "CACHE_EVENT_REMOVE_FAILED"; 00090 case CACHE_EVENT_UPDATE: return "CACHE_EVENT_UPDATE"; 00091 case CACHE_EVENT_UPDATE_FAILED: return "CACHE_EVENT_UPDATE_FAILED"; 00092 case CACHE_EVENT_LINK: return "CACHE_EVENT_LINK"; 00093 case CACHE_EVENT_LINK_FAILED: return "CACHE_EVENT_LINK_FAILED"; 00094 case CACHE_EVENT_DEREF: return "CACHE_EVENT_DEREF"; 00095 case CACHE_EVENT_DEREF_FAILED: return "CACHE_EVENT_DEREF_FAILED"; 00096 case CACHE_EVENT_RESPONSE: return "CACHE_EVENT_RESPONSE"; 00097 case CACHE_EVENT_RESPONSE_MSG: return "CACHE_EVENT_RESPONSE_MSG"; 00098 00099 00100 case MGMT_EVENT_SHUTDOWN: return "MGMT_EVENT_SHUTDOWN"; 00101 case MGMT_EVENT_RESTART: return "MGMT_EVENT_RESTART"; 00102 case MGMT_EVENT_BOUNCE: return "MGMT_EVENT_BOUNCE"; 00103 case MGMT_EVENT_CONFIG_FILE_UPDATE: return "MGMT_EVENT_CONFIG_FILE_UPDATE"; 00104 case MGMT_EVENT_CONFIG_FILE_UPDATE_NO_INC_VERSION: return "MGMT_EVENT_CONFIG_FILE_UPDATE_NO_INC_VERSION"; 00105 case MGMT_EVENT_CLEAR_STATS: return "MGMT_EVENT_CLEAR_STATS"; 00106 00107 default: 00108 if (buffer != NULL) { 00109 snprintf(buffer, blen, "%d", event); 00110 return buffer; 00111 } else { 00112 return "UNKNOWN_EVENT"; 00113 } 00114 } 00115 }