00001 00002 /*************************************************************************** 00003 * fawkes_network.h - Fawkes network aspect for Fawkes 00004 * 00005 * Created: Mon May 07 19:45:32 2007 00006 * Copyright 2006-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <aspect/fawkes_network.h> 00025 00026 #include <netcomm/fawkes/hub.h> 00027 00028 namespace fawkes { 00029 00030 /** @class FawkesNetworkAspect <aspect/fawkes_network.h> 00031 * Thread aspect to participate in the Fawkes Network protocol. 00032 * Give this aspect to your thread to make use of the Fawkes network 00033 * protocol. The protocol is designed to transport short messages over 00034 * the network (information and control data). 00035 * With this aspect you can easily inject messages into the stream and 00036 * and receive messages from connected clients. The component ID has to 00037 * be unique. To ensure this have a look at netcomm/fawkes/component_ids.h. 00038 * 00039 * It is guaranteed that if used properly from within plugins that 00040 * initFawkesNetworkAspect() is called before the thread is started and that 00041 * you can access the Fawkes network hub via the fnethub member. 00042 * 00043 * In most cases you should implement Thread::init() to register 00044 * your FawkesNetworkHandler. 00045 * 00046 * @ingroup Aspects 00047 * @author Tim Niemueller 00048 */ 00049 00050 00051 /** @var FawkesNetworkHub FawkesNetworkAspect::fnethub 00052 * This is the Fawkes network hub member used to access the Fawkes 00053 * network protocol. 00054 * The logger will remain valid for the whole lifetime of the 00055 * thread. 00056 */ 00057 00058 /** Virtual empty Destructor. */ 00059 FawkesNetworkAspect::~FawkesNetworkAspect() 00060 { 00061 } 00062 00063 00064 /** Set the logger. 00065 * It is guaranteed that this is called for a thread having the 00066 * Fawkes netwok aspect before Thread::start() is called (when 00067 * running regularly inside Fawkes). 00068 * @param fnethub Fawkes network hub instance to use for network 00069 * communication. 00070 */ 00071 void 00072 FawkesNetworkAspect::init_FawkesNetworkAspect(FawkesNetworkHub *fnethub) 00073 { 00074 this->fnethub = fnethub; 00075 } 00076 00077 } // end namespace fawkes