CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

driver.h

00001 /*
00002     Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
00003     Written by Eric Sunshine <sunshine@sunshineco.com>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_INETWORK_DRIVER_H__
00021 #define __CS_INETWORK_DRIVER_H__
00022 
00023 #include "csutil/scf.h"
00024 #include "csutil/ref.h"
00025 
00029 enum csNetworkDriverError
00030 {
00031   CS_NET_ERR_NO_ERROR,
00032   CS_NET_ERR_CANNOT_RESOLVE_ADDRESS,
00033   CS_NET_ERR_CANNOT_CONNECT,
00034   CS_NET_ERR_CANNOT_SEND,
00035   CS_NET_ERR_INVALID_SOCKET,
00036   CS_NET_ERR_CANNOT_BIND,
00037   CS_NET_ERR_CANNOT_LISTEN,
00038   CS_NET_ERR_CANNOT_CREATE,
00039   CS_NET_ERR_CANNOT_ACCEPT,
00040   CS_NET_ERR_CANNOT_SET_BLOCKING_MODE,
00041   CS_NET_ERR_CANNOT_RECEIVE,
00042   CS_NET_ERR_CANNOT_PARSE_ADDRESS,
00043   CS_NET_ERR_CANNOT_GET_VERSION,
00044   CS_NET_ERR_WRONG_VERSION,
00045   CS_NET_ERR_CANNOT_CLEANUP
00046 };
00047 
00053 struct csNetworkDriverCapabilities
00054 {
00055   bool ConnectionReliable;
00056   bool ConnectionUnreliable;
00057   bool BehaviorBlocking;
00058   bool BehaviorNonBlocking;
00059 };
00060 
00061 
00062 SCF_VERSION (iNetworkEndPoint, 0, 0, 1);
00063 
00069 struct iNetworkEndPoint : public iBase
00070 {
00072   virtual void Terminate() = 0;
00073 
00075   virtual csNetworkDriverError GetLastError() const = 0;
00076 };
00077 
00078 
00079 SCF_VERSION (iNetworkConnection, 0, 0, 1);
00080 
00085 struct iNetworkConnection : public iNetworkEndPoint
00086 {
00088   virtual bool Send(const void* data, size_t nbytes) = 0;
00089 
00099   virtual size_t Receive(void* buff, size_t maxbytes) = 0;
00100 };
00101 
00102 
00103 SCF_VERSION (iNetworkListener, 0, 0, 2);
00104 
00110 struct iNetworkListener : public iNetworkEndPoint
00111 {
00121   virtual csPtr<iNetworkConnection> Accept() = 0;
00122 };
00123 
00124 
00125 SCF_VERSION (iNetworkDriver, 0, 0, 2);
00126 
00131 struct iNetworkDriver : public iBase
00132 {
00144   virtual csPtr<iNetworkConnection> NewConnection(const char* target,
00145     bool reliable = true, bool blocking = false) = 0;
00146 
00156   virtual csPtr<iNetworkListener> NewListener(const char* source,
00157     bool reliable = true, bool blockingListener = false,
00158     bool blockingConnection = false) = 0;
00159 
00166   virtual csNetworkDriverCapabilities GetCapabilities() const = 0;
00167 
00171   virtual csNetworkDriverError GetLastError() const = 0;
00172 };
00173 
00174 #endif // __CS_INETWORK_DRIVER_H__

Generated for Crystal Space by doxygen 1.2.14