00001 00002 /*************************************************************************** 00003 * client_handler.cpp - handle incoming msgs from FawkesNetworkClientThread 00004 * 00005 * Created: Thu Jun 14 17:18:39 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 <netcomm/fawkes/client_handler.h> 00025 00026 namespace fawkes { 00027 00028 /** @class FawkesNetworkClientHandler <netcomm/fawkes/client_handler.h> 00029 * Message handler for FawkesNetworkClient. 00030 * This interface is used by the FawkesNetworkClient to handle incoming messages. 00031 * @ingroup NetComm 00032 * @author Tim Niemueller 00033 * 00034 * @fn virtual void FawkesNetworkClientHandler::deregistered(unsigned int id) throw() = 0 00035 * This handler has been deregistered. 00036 * This is called when this handler is deregistered from the 00037 * FawkesNetworkClient. Sometimes you may not want to allow this and post 00038 * a big fat warning into the log. 00039 * @param id the id of the calling client 00040 * 00041 * @fn virtual void FawkesNetworkClientHandler::inbound_received(FawkesNetworkMessage *m, unsigned int id) throw() = 0 00042 * Called for incoming messages. 00043 * This is called when an incoming message has been received. If this 00044 * method was called one or more times then the a previously carried out 00045 * wait(cid) call will continue. 00046 * @param m Message to handle 00047 * @param id the id of the calling client 00048 * 00049 * @fn virtual void FawkesNetworkClientHandler::connection_established(unsigned int id) throw() = 0 00050 * Client has established a connection. 00051 * Whenever the client establishes a connection this is signaled to handlers with this 00052 * method. You can register to a client at any time, you may even enqueue messages to 00053 * a client while the connection is dead. If the client at some point gets connected 00054 * again, the messages will then be send out in one go. You should use this in your 00055 * application though to only send data if the connection is alive and you should let 00056 * the user know about the connection status. 00057 * @param id the id of the calling client 00058 * 00059 * @fn virtual void FawkesNetworkClientHandler::connection_died(unsigned int id) throw() = 0 00060 * Client connection died. 00061 * This method is used to inform handlers that the connection has died for any reason. 00062 * No more data can be send and no more messages should be enqueued because it is unclear 00063 * when they would be sent. 00064 * @param id the id of the calling client 00065 * 00066 */ 00067 00068 /** Empty virtual destructor. */ 00069 FawkesNetworkClientHandler::~FawkesNetworkClientHandler() 00070 { 00071 } 00072 00073 } // end namespace fawkes