NotifierConsts.cc

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2005 Andras Varga
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #include <stdio.h>
00019 #include "NotifierConsts.h"
00020 
00021 
00022 const char *notificationCategoryName(int category)
00023 {
00024     const char *s;
00025     static char buf[8];
00026     switch (category)
00027     {
00028         case NF_SUBSCRIBERLIST_CHANGED: return "SUBSCRIBERS";
00029 
00030         case NF_HOSTPOSITION_UPDATED: return "POS";
00031         case NF_NODE_FAILURE: return "FAILURE";
00032         case NF_NODE_RECOVERY: return "RECOVERY";
00033 
00034         case NF_RADIOSTATE_CHANGED: return "RADIO-STATE";
00035         case NF_RADIO_CHANNEL_CHANGED: return "RADIO-CHANNEL";
00036         case NF_PP_TX_BEGIN: return "TX-BEG";
00037         case NF_PP_TX_END: return "TX-END";
00038         case NF_PP_RX_END: return "RX-END";
00039         case NF_L2_Q_DROP: return "DROP";
00040         case NF_MAC_BECAME_IDLE: return "MAC-IDLE";
00041         case NF_L2_BEACON_LOST: return "BEACON-LOST";
00042         case NF_L2_ASSOCIATED: return "ASSOCIATED";
00043 
00044         case NF_INTERFACE_CREATED: return "IF-CREATED";
00045         case NF_INTERFACE_DELETED: return "IF-DELETED";
00046         case NF_INTERFACE_STATE_CHANGED: return "IF-STATE";
00047         case NF_INTERFACE_CONFIG_CHANGED: return "IF-CFG";
00048         case NF_INTERFACE_IPv4CONFIG_CHANGED: return "IPv4-CFG";
00049         case NF_INTERFACE_IPv6CONFIG_CHANGED: return "IPv6-CFG";
00050 
00051         case NF_IPv4_ROUTE_ADDED: return "IPv4-ROUTE-ADD";
00052         case NF_IPv4_ROUTE_DELETED: return "IPv4-ROUTE-DEL";
00053         case NF_IPv6_ROUTE_ADDED: return "IPv6-ROUTE-ADD";
00054         case NF_IPv6_ROUTE_DELETED: return "IPv6-ROUTE-DEL";
00055 
00056         case NF_IPv6_HANDOVER_OCCURRED: return "IPv6-HANDOVER";
00057 
00058         case NF_OVERLAY_TRANSPORTADDRESS_CHANGED: return "OVERLAY-TRANSPORTADDESS";
00059         case NF_OVERLAY_NODE_LEAVE: return "OVERLAY-NODE-LEAVE";
00060         case NF_OVERLAY_NODE_GRACEFUL_LEAVE: return "NODE-GRACEFUL-LEAVE";
00061 
00062         default: sprintf(buf, "%d", category); s = buf;
00063     }
00064     return s;
00065 }
00066 
00067 void printNotificationBanner(int category, const cPolymorphic *details)
00068 {
00069     EV << "** Notification at T=" << simTime()
00070        << " to " << simulation.getContextModule()->getFullPath() << ": "
00071        << notificationCategoryName(category) << " "
00072        << (details ? details->info() : "") << "\n";
00073 }
00074 
00075 
00076 
00077 
00078