HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CMD_ConnectedSocketCommandListener.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: CMD_ConnectedSocketCommandListener.h ( CMD Library, C++ )
7
*
8
* COMMENTS:
9
* This event generator listens for commands that are sent to a
10
* connected socket and runs them. If the socket is closed, this event
11
* generator removes and deletes itself. You must create this event
12
* generator with new and you must not keep a pointer to it.
13
*
14
* You probably don't want to use this class directly. Instead, you
15
* probably want to use CMD_ServerSocketCommandListener.
16
*/
17
18
#ifndef __CMD_ConnectedSocketCommandListener_h__
19
#define __CMD_ConnectedSocketCommandListener_h__
20
21
#include "
CMD_API.h
"
22
#include <
FS/FS_ConnectedSocketListener.h
>
23
class
CMD_Manager
;
24
class
UT_WorkBuffer
;
25
class
UT_XMLNode
;
26
27
class
CMD_API
CMD_ConnectedSocketCommandListener
28
:
public
FS_ConnectedSocketListener
29
{
30
public
:
31
// The socket is used to write the command result back to the other end of
32
// the socket. The ip mask restricts who is allowed to connect to this
33
// socket. If the ip mask is null it defaults to +.+.+.+.
34
CMD_ConnectedSocketCommandListener
(
UT_NetSocket
&server_socket,
35
CMD_Manager
&command_manager,
36
bool
separate_errors =
false
,
37
bool
restrict_to_safe_commands =
false
,
38
const
char
*ip_mask = 0,
39
bool
browser_mode =
false
);
40
41
virtual
const
char
*
className
()
const
42
{
return
"CMD_ConnectedSocketCommandListener"
; }
43
44
private
:
45
// This static callback is called when data is available on the socket.
46
// It will call processSocketData().
47
static
void
processSocketDataCallback(
48
void
*opaque_object,
49
const
char
*
data
,
50
int
length
,
51
UT_NetSocket
&socket);
52
53
// Process data received a socket (optionally reading in more data) and
54
// return the result on the socket.
55
void
processSocketData(
56
const
UT_WorkBuffer
&command,
UT_NetSocket
&socket);
57
58
void
runHscriptCommand(
59
const
char
*command,
UT_WorkBuffer
&
result
);
60
void
runPythonExpression(
61
const
char
*expression,
UT_WorkBuffer
&
result
);
62
void
runPythonStatements(
63
const
char
*statements,
UT_WorkBuffer
&
result
);
64
65
void
processXML(
const
char
*xml,
UT_WorkBuffer
&
result
);
66
void
processXMLNode(
UT_XMLNode
&node,
UT_WorkBuffer
&
result
);
67
68
void
processData(
const
char
*
data
,
UT_WorkBuffer
&
result
);
69
70
void
processHTTPRequest(
71
const
UT_WorkBuffer
&request,
72
UT_NetSocket
&socket,
73
UT_WorkBuffer
&
result
);
74
75
// Data:
76
77
CMD_Manager
&myCommandManager;
78
bool
mySeparateErrors;
79
bool
myRestrictToSafeCmds;
80
bool
myBrowserMode;
81
};
82
83
#endif
CMD_ConnectedSocketCommandListener::className
virtual const char * className() const
Definition:
CMD_ConnectedSocketCommandListener.h:41
UT_NetSocket
Definition:
UT_NetSocket.h:38
FS_ConnectedSocketListener
Definition:
FS_ConnectedSocketListener.h:30
UT_WorkBuffer
Definition:
UT_WorkBuffer.h:73
length
GLuint GLsizei GLsizei * length
Definition:
glcorearb.h:795
result
**But if you need a result
Definition:
thread.h:613
CMD_ConnectedSocketCommandListener
Definition:
CMD_ConnectedSocketCommandListener.h:27
CMD_Manager
Definition:
CMD_Manager.h:63
FS_ConnectedSocketListener.h
CMD_API.h
CMD_API
#define CMD_API
Definition:
CMD_API.h:10
UT_XMLNode
Definition:
UT_XMLNode.h:38
data
Definition:
format.h:895
CMD
CMD_ConnectedSocketCommandListener.h
Generated on Tue Apr 23 2024 03:14:22 for HDK by
1.8.6