clmessage.h

Go to the documentation of this file.
00001 /* -*- Mode:C++ -*- /*
00002 /*
00003  * Copyright (c) 2006 Regents of the SIGNET lab, University of Padova.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  * 3. Neither the name of the University of Padova (SIGNET lab) nor the 
00015  *    names of its contributors may be used to endorse or promote products 
00016  *    derived from this software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00019  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
00020  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00021  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
00022  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00023  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
00024  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00025  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00026  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
00027  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
00028  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00042 #ifndef _COMMONCLMSG_
00043 #define _COMMONCLMSG_
00044 
00045 #include <string.h>
00046 #include <scheduler.h>
00047 
00053 #define MAX_MODULE_TAG 6
00054 //NOT USED ... #define MAX_CR_LAY_TAG 8                 // size in character of the exchanged string in cross-layer command
00060 #define INVALID_DESTINATION -1
00061 //NOT USED.. #define ALL_LEVEL 0                                        // broadcasr address for cross-layer messages directed to all layers
00067 #define NO_MODULE -1
00068 
00069 
00074 #define CLBROADCASTADDR -1
00075 
00076 
00077 
00082 #define CLPLUGINLAYERNUM 0
00083 
00089 enum DestinationType{
00090         UNICAST,
00091         BROADCAST
00092 };
00098 enum ClDirection{
00099         TONODECORE,
00100         TOMODULE,
00101         UP,
00102         DOWN
00103 };
00109 typedef unsigned int ClMessage_t;
00110 
00111 /*
00112  * the father class of all cross layer messages
00113 */
00128 class ClMessage : public Event{
00129 public:
00143         ClMessage(int verbosity, ClMessage_t type);
00144 
00155         ClMessage(ClMessage *m);
00156 
00157 
00181         ClMessage(int verbosity, ClMessage_t type, DestinationType dtype, int value);
00182 
00187         virtual ~ClMessage();
00188 
00194         DestinationType getDestType();
00195 
00203         int getDest();
00204 
00210         int getSource();
00211 
00217         void setSource(int src);
00218 
00224         void setDest(int dst);
00225 
00226 
00235         virtual ClMessage *copy();
00236 
00242         int verbosity();
00243 
00250         ClMessage_t type();
00251 
00261         ClDirection direction();
00262 
00269         void direction(ClDirection dir);
00270 
00277         unsigned int uid();
00278 
00285         static ClMessage_t addClMessage();
00286 
00287 protected:
00290         static ClMessage_t nType_;
00291 
00294         ClMessage_t type_;
00295 
00298         DestinationType destType_;
00299 
00301         int source_;
00302 
00304         int dest_;
00305 
00307         int verbosity_;
00308 
00310         ClDirection direction_;
00311 
00313         unsigned int uid_;
00314 
00315 
00316 
00317 
00318 
00319 
00320 
00321 
00322 
00323   /******************************
00324    * Deprecated Methods
00325    * 
00326    */
00327 
00328 public:
00341         ClMessage(int verbosity, ClMessage_t type, DestinationType dtype, int source, int value);
00342 
00343 };
00344 
00345 #endif
00346 

Generated on Wed Nov 26 15:47:28 2008 for NS-MIRACLE library by  doxygen 1.5.2