2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file NG_NetworkDeviceInterface.h
30 * \brief Functions like (de)initialize network, get library version
31 * To be derived by loopback and network libraries
34 #ifndef __NG_NETWORKDEVICEINTERFACE_H__
35 #define __NG_NETWORKDEVICEINTERFACE_H__
37 #include "NG_NetworkMessage.h"
40 class NG_NetworkDeviceInterface
43 // candidates for shared/common implementation class
46 NG_NetworkDeviceInterface() {};
47 virtual ~NG_NetworkDeviceInterface() {};
49 virtual void NextFrame()=0;
52 * Mark network connection online
54 void Online(void) { m_online = true; }
56 * Mark network connection offline
58 void Offline(void) { m_online = false; }
60 * Is the network connection established ?
62 bool IsOnline(void) { return m_online; }
64 virtual bool Connect(char *address, unsigned int port, char *password,
65 unsigned int localport, unsigned int timeout)=0;
66 virtual bool Disconnect(void)=0;
68 virtual void SendNetworkMessage(NG_NetworkMessage* msg)=0;
70 * read NG_NetworkMessage from library buffer, may be
71 * irrelevant for loopbackdevices
74 virtual std::vector<NG_NetworkMessage*> RetrieveNetworkMessages()=0;
77 #ifdef WITH_CXX_GUARDEDALLOC
78 MEM_CXX_CLASS_ALLOC_FUNCS("GE:NG_NetworkDeviceInterface")
82 #endif //__NG_NETWORKDEVICEINTERFACE_H__