/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/sckipc.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/sckipc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 4497 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sckipc.h
3 // Purpose: Interprocess communication implementation (wxSocket version)
4 // Author: Julian Smart
5 // Modified by: Guilhem Lavaux (big rewrite) May 1997, 1998
6 // Guillermo Rodriguez (updated for wxSocket v2) Jan 2000
7 // (callbacks deprecated) Mar 2000
8 // Created: 1993
9 // RCS-ID: $Id: sckipc.h 53135 2008-04-12 02:31:04Z VZ $
10 // Copyright: (c) Julian Smart 1993
11 // (c) Guilhem Lavaux 1997, 1998
12 // (c) 2000 Guillermo Rodriguez <guille@iies.es>
13 // Licence: wxWindows licence
14 /////////////////////////////////////////////////////////////////////////////
15
16 #ifndef _WX_SCKIPC_H
17 #define _WX_SCKIPC_H
18
19 #include "wx/defs.h"
20
21 #if wxUSE_SOCKETS && wxUSE_IPC
22
23 #include "wx/ipcbase.h"
24 #include "wx/socket.h"
25 #include "wx/sckstrm.h"
26 #include "wx/datstrm.h"
27
28 /*
29 * Mini-DDE implementation
30
31 Most transactions involve a topic name and an item name (choose these
32 as befits your application).
33
34 A client can:
35
36 - ask the server to execute commands (data) associated with a topic
37 - request data from server by topic and item
38 - poke data into the server
39 - ask the server to start an advice loop on topic/item
40 - ask the server to stop an advice loop
41
42 A server can:
43
44 - respond to execute, request, poke and advice start/stop
45 - send advise data to client
46
47 Note that this limits the server in the ways it can send data to the
48 client, i.e. it can't send unsolicited information.
49 *
50 */
51
52 class WXDLLIMPEXP_FWD_NET wxTCPServer;
53 class WXDLLIMPEXP_FWD_NET wxTCPClient;
54
55 class WXDLLIMPEXP_NET wxTCPConnection: public wxConnectionBase
56 {
57 DECLARE_DYNAMIC_CLASS(wxTCPConnection)
58
59 public:
60 wxTCPConnection(wxChar *buffer, int size);
61 wxTCPConnection();
62 virtual ~wxTCPConnection();
63
64 // Calls that CLIENT can make
65 virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
66 virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
67 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
68 virtual bool StartAdvise(const wxString& item);
69 virtual bool StopAdvise(const wxString& item);
70
71 // Calls that SERVER can make
72 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
73
74 // Calls that both can make
75 virtual bool Disconnect(void);
76
77 // Callbacks to BOTH - override at will
78 // Default behaviour is to delete connection and return true
79 virtual bool OnDisconnect(void) { delete this; return true; }
80
81 // To enable the compressor (NOTE: not implemented!)
82 void Compress(bool on);
83
84 // unhide the Execute overload from wxConnectionBase
85 virtual bool Execute(const wxString& str)
86 { return Execute(str, -1, wxIPC_TEXT); }
87
88 protected:
89 wxSocketBase *m_sock;
90 wxSocketStream *m_sockstrm;
91 wxDataInputStream *m_codeci;
92 wxDataOutputStream *m_codeco;
93 wxString m_topic;
94
95 friend class wxTCPServer;
96 friend class wxTCPClient;
97 friend class wxTCPEventHandler;
98
99 DECLARE_NO_COPY_CLASS(wxTCPConnection)
100 };
101
102 class WXDLLIMPEXP_NET wxTCPServer: public wxServerBase
103 {
104 public:
105 wxTCPConnection *topLevelConnection;
106
107 wxTCPServer();
108 virtual ~wxTCPServer();
109
110 // Returns false on error (e.g. port number is already in use)
111 virtual bool Create(const wxString& serverName);
112
113 // Callbacks to SERVER - override at will
114 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
115
116 protected:
117 wxSocketServer *m_server;
118
119 #ifdef __UNIX_LIKE__
120 // the name of the file associated to the Unix domain socket, may be empty
121 wxString m_filename;
122 #endif // __UNIX_LIKE__
123
124 DECLARE_NO_COPY_CLASS(wxTCPServer)
125 DECLARE_DYNAMIC_CLASS(wxTCPServer)
126 };
127
128 class WXDLLIMPEXP_NET wxTCPClient: public wxClientBase
129 {
130 public:
131 wxTCPClient();
132 virtual ~wxTCPClient();
133
134 virtual bool ValidHost(const wxString& host);
135
136 // Call this to make a connection. Returns NULL if cannot.
137 virtual wxConnectionBase *MakeConnection(const wxString& host,
138 const wxString& server,
139 const wxString& topic);
140
141 // Callbacks to CLIENT - override at will
142 virtual wxConnectionBase *OnMakeConnection();
143
144 private:
145 DECLARE_DYNAMIC_CLASS(wxTCPClient)
146 };
147
148 #endif // wxUSE_SOCKETS && wxUSE_IPC
149
150 #endif // _WX_SCKIPC_H

  ViewVC Help
Powered by ViewVC 1.1.22