Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
netui.h
Go to the documentation of this file.
1 #ifndef VS_NETUI_H
2 #define VS_NETUI_H
3 
4 /*
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 /*
21  * netUI - Network Interface - written by Stephane Vaxelaire <svax@free.fr>
22  */
23 
24 #include "networking/const.h"
25 #include "vsnet_socket.h"
26 
27 struct ServerSocket;
28 class SocketSet;
29 
30 //these return an int handle.
31 class NetUIBase
32 {
33 public:
34  static AddressIP lookupHost( const char *host, unsigned short port );
35  static int createClientSocket( const AddressIP &host, bool isTCP, bool isHTTP );
36  static int createServerSocket( const AddressIP &host, bool isTCP );
37 };
38 
39 //These create the appropriate SOCKETALT from the NetUIBase's handle.
40 class NetUITCP
41 {
42 public:
43  static SOCKETALT createSocket( const char *host, unsigned short port, SocketSet &set );
44  static ServerSocket * createServerSocket( unsigned short port, SocketSet &set );
45 };
46 /*
47  * class NetUIHTTP
48  * {
49  * public:
50  * static SOCKETALT createSocket( const char* uri, SocketSet& set );
51  * // Why would we ever need an HTTP server socket? Would more likely be a CGI.
52  * //static SOCKETALT createServerSocket( unsigned short port, SocketSet& set );
53  * };
54  */
55 class NetUIUDP
56 {
57 public:
58  static SOCKETALT createSocket( const char *host, unsigned short srv_port, unsigned short clt_port, SocketSet &set );
59  static SOCKETALT createServerSocket( unsigned short port, SocketSet &set );
60  static void disconnectSaveUDP( SOCKETALT udp );
61 };
62 
63 #endif /* VS_NETUI_H */
64