Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
4d3fb73f
You need to sign in or sign up before continuing.
Commit
4d3fb73f
authored
Jan 26, 2018
by
dimbor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxcomp: new additional connection channels
parent
8e4682ff
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
766 additions
and
10 deletions
+766
-10
NX.h
nxcomp/include/NX.h
+8
-1
Channel.h
nxcomp/src/Channel.h
+3
-0
ClientProxy.cpp
nxcomp/src/ClientProxy.cpp
+16
-1
ClientProxy.h
nxcomp/src/ClientProxy.h
+4
-1
Control.cpp
nxcomp/src/Control.cpp
+1
-1
GenericChannel.h
nxcomp/src/GenericChannel.h
+127
-0
Loop.cpp
nxcomp/src/Loop.cpp
+299
-1
Misc.cpp
nxcomp/src/Misc.cpp
+22
-0
Misc.h
nxcomp/src/Misc.h
+3
-0
Proxy.cpp
nxcomp/src/Proxy.cpp
+96
-0
Proxy.h
nxcomp/src/Proxy.h
+7
-1
ServerProxy.cpp
nxcomp/src/ServerProxy.cpp
+32
-3
ServerProxy.h
nxcomp/src/ServerProxy.h
+7
-1
Statistics.cpp
nxcomp/src/Statistics.cpp
+90
-0
Statistics.h
nxcomp/src/Statistics.h
+51
-0
No files found.
nxcomp/include/NX.h
View file @
4d3fb73f
...
@@ -70,6 +70,9 @@ extern "C" {
...
@@ -70,6 +70,9 @@ extern "C" {
#define NX_CHANNEL_HTTP 4
#define NX_CHANNEL_HTTP 4
#define NX_CHANNEL_FONT 5
#define NX_CHANNEL_FONT 5
#define NX_CHANNEL_SLAVE 6
#define NX_CHANNEL_SLAVE 6
#define NX_CHANNEL_EXTRA1 7
#define NX_CHANNEL_EXTRA2 8
#define NX_CHANNEL_EXTRA3 9
#define NX_FILE_SESSION 0
#define NX_FILE_SESSION 0
#define NX_FILE_ERRORS 1
#define NX_FILE_ERRORS 1
...
@@ -341,8 +344,12 @@ extern int NXTransFlush(int fd);
...
@@ -341,8 +344,12 @@ extern int NXTransFlush(int fd);
* NX_CHANNEL_FONT: The channel will forward a X font server
* NX_CHANNEL_FONT: The channel will forward a X font server
* connection.
* connection.
*
*
* NX_CHANNEL_EXTRA[1-3]: The channels will transport user defined
* data; NOTE: EXTRA3 has high priority like
* MEDIA channel
*
* Only a proxy running at the NX server/X client side will be able
* Only a proxy running at the NX server/X client side will be able
* to create a X, CUPS, SMB, MEDIA
and HTTP channel
. A proxy running
* to create a X, CUPS, SMB, MEDIA
, HTTP, EXTA channels
. A proxy running
* at the NX client/X server side can create font server connections.
* at the NX client/X server side can create font server connections.
* The channel creation will also fail if the remote end has not been
* The channel creation will also fail if the remote end has not been
* set up to forward the connection.
* set up to forward the connection.
...
...
nxcomp/src/Channel.h
View file @
4d3fb73f
...
@@ -79,6 +79,9 @@ typedef enum
...
@@ -79,6 +79,9 @@ typedef enum
channel_http
,
channel_http
,
channel_font
,
channel_font
,
channel_slave
,
channel_slave
,
channel_extra1
,
channel_extra2
,
channel_extra3
,
channel_last_tag
channel_last_tag
}
T_channel_type
;
}
T_channel_type
;
...
...
nxcomp/src/ClientProxy.cpp
View file @
4d3fb73f
...
@@ -84,7 +84,10 @@ void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
...
@@ -84,7 +84,10 @@ void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
httpServerPort
,
ChannelEndPoint
&
httpServerPort
,
const
char
*
fontServerPort
)
const
char
*
fontServerPort
,
ChannelEndPoint
&
extra1ServerPort
,
ChannelEndPoint
&
extra2ServerPort
,
ChannelEndPoint
&
extra3ServerPort
)
{
{
delete
[]
fontServerPort_
;
delete
[]
fontServerPort_
;
...
@@ -123,6 +126,18 @@ int ClientProxy::handleNewConnection(T_channel_type type, int clientFd)
...
@@ -123,6 +126,18 @@ int ClientProxy::handleNewConnection(T_channel_type type, int clientFd)
{
{
return
handleNewGenericConnection
(
clientFd
,
channel_http
,
"HTTP"
);
return
handleNewGenericConnection
(
clientFd
,
channel_http
,
"HTTP"
);
}
}
case
channel_extra1
:
{
return
handleNewGenericConnection
(
clientFd
,
channel_extra1
,
"EXTRA1"
);
}
case
channel_extra2
:
{
return
handleNewGenericConnection
(
clientFd
,
channel_extra2
,
"EXTRA2"
);
}
case
channel_extra3
:
{
return
handleNewGenericConnection
(
clientFd
,
channel_extra3
,
"EXTRA3"
);
}
case
channel_slave
:
case
channel_slave
:
{
{
return
handleNewSlaveConnection
(
clientFd
);
return
handleNewSlaveConnection
(
clientFd
);
...
...
nxcomp/src/ClientProxy.h
View file @
4d3fb73f
...
@@ -50,7 +50,10 @@ class ClientProxy : public Proxy
...
@@ -50,7 +50,10 @@ class ClientProxy : public Proxy
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
httpServerPort
,
ChannelEndPoint
&
httpServerPort
,
const
char
*
fontServerPort
);
const
char
*
fontServerPort
,
ChannelEndPoint
&
extra1ServerPort
,
ChannelEndPoint
&
extra2ServerPort
,
ChannelEndPoint
&
extra3ServerPort
);
protected
:
protected
:
...
...
nxcomp/src/Control.cpp
View file @
4d3fb73f
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
// at the NX server side (X client side).
// at the NX server side (X client side).
//
//
#define CHANNEL_MASK 0x0
7
#define CHANNEL_MASK 0x0
F
//
//
// Kill session if control parameters cannot be
// Kill session if control parameters cannot be
...
...
nxcomp/src/GenericChannel.h
View file @
4d3fb73f
...
@@ -360,6 +360,133 @@ class HttpChannel : public GenericChannel
...
@@ -360,6 +360,133 @@ class HttpChannel : public GenericChannel
}
}
};
};
class
Extra1Channel
:
public
GenericChannel
{
public
:
Extra1Channel
(
Transport
*
transport
,
StaticCompressor
*
compressor
)
:
GenericChannel
(
transport
,
compressor
)
{
}
virtual
~
Extra1Channel
()
{
}
protected
:
virtual
T_channel_type
getType
()
const
{
return
channel_extra1
;
}
virtual
int
isCompressed
()
{
// Since ProtoStep8 (#issue 108)
return
0
;
}
virtual
int
isPrioritized
()
{
return
0
;
}
virtual
void
addProtocolBits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
statistics
->
addExtra1Bits
(
bitsIn
,
bitsOut
);
}
};
class
Extra2Channel
:
public
GenericChannel
{
public
:
Extra2Channel
(
Transport
*
transport
,
StaticCompressor
*
compressor
)
:
GenericChannel
(
transport
,
compressor
)
{
}
virtual
~
Extra2Channel
()
{
}
protected
:
virtual
T_channel_type
getType
()
const
{
return
channel_extra2
;
}
virtual
int
isCompressed
()
{
// Since ProtoStep8 (#issue 108)
return
0
;
}
virtual
int
isPrioritized
()
{
return
0
;
}
virtual
void
addProtocolBits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
statistics
->
addExtra2Bits
(
bitsIn
,
bitsOut
);
}
};
class
Extra3Channel
:
public
GenericChannel
{
public
:
Extra3Channel
(
Transport
*
transport
,
StaticCompressor
*
compressor
)
:
GenericChannel
(
transport
,
compressor
)
{
}
virtual
~
Extra3Channel
()
{
}
protected
:
virtual
T_channel_type
getType
()
const
{
return
channel_extra3
;
}
//
// Don't try to compress the media data.
//
virtual
int
isCompressed
()
{
return
0
;
}
//
// Reduce the latency of extra3 channels
// by setting them as prioritized, even
// if this will take away bandwidth from
// the X channels.
//
virtual
int
isPrioritized
()
{
return
1
;
}
virtual
void
addProtocolBits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
statistics
->
addExtra3Bits
(
bitsIn
,
bitsOut
);
}
};
class
FontChannel
:
public
GenericChannel
class
FontChannel
:
public
GenericChannel
{
{
public
:
public
:
...
...
nxcomp/src/Loop.cpp
View file @
4d3fb73f
...
@@ -858,6 +858,9 @@ static int auxFD = -1;
...
@@ -858,6 +858,9 @@ static int auxFD = -1;
static
int
smbFD
=
-
1
;
static
int
smbFD
=
-
1
;
static
int
mediaFD
=
-
1
;
static
int
mediaFD
=
-
1
;
static
int
httpFD
=
-
1
;
static
int
httpFD
=
-
1
;
static
int
extra1FD
=
-
1
;
static
int
extra2FD
=
-
1
;
static
int
extra3FD
=
-
1
;
static
int
fontFD
=
-
1
;
static
int
fontFD
=
-
1
;
static
int
slaveFD
=
-
1
;
static
int
slaveFD
=
-
1
;
static
int
proxyFD
=
-
1
;
static
int
proxyFD
=
-
1
;
...
@@ -882,6 +885,9 @@ static int useAuxSocket = 0;
...
@@ -882,6 +885,9 @@ static int useAuxSocket = 0;
static
int
useSmbSocket
=
0
;
static
int
useSmbSocket
=
0
;
static
int
useMediaSocket
=
0
;
static
int
useMediaSocket
=
0
;
static
int
useHttpSocket
=
0
;
static
int
useHttpSocket
=
0
;
static
int
useExtra1Socket
=
0
;
static
int
useExtra2Socket
=
0
;
static
int
useExtra3Socket
=
0
;
static
int
useFontSocket
=
0
;
static
int
useFontSocket
=
0
;
static
int
useSlaveSocket
=
0
;
static
int
useSlaveSocket
=
0
;
static
int
useAgentSocket
=
0
;
static
int
useAgentSocket
=
0
;
...
@@ -985,6 +991,9 @@ static ChannelEndPoint auxPort;
...
@@ -985,6 +991,9 @@ static ChannelEndPoint auxPort;
static
ChannelEndPoint
smbPort
;
static
ChannelEndPoint
smbPort
;
static
ChannelEndPoint
mediaPort
;
static
ChannelEndPoint
mediaPort
;
static
ChannelEndPoint
httpPort
;
static
ChannelEndPoint
httpPort
;
static
ChannelEndPoint
extra1Port
;
static
ChannelEndPoint
extra2Port
;
static
ChannelEndPoint
extra3Port
;
static
ChannelEndPoint
slavePort
;
static
ChannelEndPoint
slavePort
;
//
//
...
@@ -2404,6 +2413,33 @@ int NXTransChannel(int fd, int channelFd, int type)
...
@@ -2404,6 +2413,33 @@ int NXTransChannel(int fd, int channelFd, int type)
break
;
break
;
}
}
case
NX_CHANNEL_EXTRA1
:
{
if
(
useExtra1Socket
==
1
)
{
result
=
proxy
->
handleNewConnection
(
channel_extra1
,
channelFd
);
}
break
;
}
case
NX_CHANNEL_EXTRA2
:
{
if
(
useExtra2Socket
==
1
)
{
result
=
proxy
->
handleNewConnection
(
channel_extra2
,
channelFd
);
}
break
;
}
case
NX_CHANNEL_EXTRA3
:
{
if
(
useExtra3Socket
==
1
)
{
result
=
proxy
->
handleNewConnection
(
channel_extra3
,
channelFd
);
}
break
;
}
case
NX_CHANNEL_FONT
:
case
NX_CHANNEL_FONT
:
{
{
if
(
useFontSocket
==
1
)
if
(
useFontSocket
==
1
)
...
@@ -3485,7 +3521,8 @@ int SetupProxyInstance()
...
@@ -3485,7 +3521,8 @@ int SetupProxyInstance()
xServerAddr
,
xServerAddrLength
);
xServerAddr
,
xServerAddrLength
);
proxy
->
handlePortConfiguration
(
cupsPort
,
smbPort
,
mediaPort
,
proxy
->
handlePortConfiguration
(
cupsPort
,
smbPort
,
mediaPort
,
httpPort
,
fontPort
);
httpPort
,
fontPort
,
extra1Port
,
extra2Port
,
extra3Port
);
//
//
// We handed over the sockaddr structure we
// We handed over the sockaddr structure we
...
@@ -4156,6 +4193,30 @@ void SetupServiceSockets()
...
@@ -4156,6 +4193,30 @@ void SetupServiceSockets()
}
}
}
}
if
(
useExtra1Socket
)
{
if
((
extra1FD
=
ListenConnection
(
extra1Port
,
"extra1"
))
<
0
)
{
useExtra1Socket
=
0
;
}
}
if
(
useExtra2Socket
)
{
if
((
extra2FD
=
ListenConnection
(
extra2Port
,
"extra2"
))
<
0
)
{
useExtra2Socket
=
0
;
}
}
if
(
useExtra3Socket
)
{
if
((
extra3FD
=
ListenConnection
(
extra3Port
,
"extra3"
))
<
0
)
{
useExtra3Socket
=
0
;
}
}
useFontSocket
=
0
;
useFontSocket
=
0
;
}
}
else
else
...
@@ -4180,6 +4241,9 @@ void SetupServiceSockets()
...
@@ -4180,6 +4241,9 @@ void SetupServiceSockets()
useSmbSocket
=
0
;
useSmbSocket
=
0
;
useMediaSocket
=
0
;
useMediaSocket
=
0
;
useHttpSocket
=
0
;
useHttpSocket
=
0
;
useExtra1Socket
=
0
;
useExtra2Socket
=
0
;
useExtra3Socket
=
0
;
}
}
//
//
...
@@ -5042,6 +5106,60 @@ void CleanupListeners()
...
@@ -5042,6 +5106,60 @@ void CleanupListeners()
useHttpSocket
=
0
;
useHttpSocket
=
0
;
}
}
if
(
useExtra1Socket
==
1
)
{
if
(
extra1FD
!=
-
1
)
{
#ifdef TEST
*
logofs
<<
"Loop: Closing extra1 listener in process "
<<
"with pid '"
<<
getpid
()
<<
"'.
\n
"
<<
logofs_flush
;
#endif
close
(
extra1FD
);
extra1FD
=
-
1
;
}
useExtra1Socket
=
0
;
}
if
(
useExtra2Socket
==
1
)
{
if
(
extra2FD
!=
-
1
)
{
#ifdef TEST
*
logofs
<<
"Loop: Closing extra2 listener in process "
<<
"with pid '"
<<
getpid
()
<<
"'.
\n
"
<<
logofs_flush
;
#endif
close
(
extra2FD
);
extra2FD
=
-
1
;
}
useExtra2Socket
=
0
;
}
if
(
useExtra3Socket
==
1
)
{
if
(
extra3FD
!=
-
1
)
{
#ifdef TEST
*
logofs
<<
"Loop: Closing extra3 listener in process "
<<
"with pid '"
<<
getpid
()
<<
"'.
\n
"
<<
logofs_flush
;
#endif
close
(
extra3FD
);
extra3FD
=
-
1
;
}
useExtra3Socket
=
0
;
}
if
(
useFontSocket
==
1
)
if
(
useFontSocket
==
1
)
{
{
if
(
fontFD
!=
-
1
)
if
(
fontFD
!=
-
1
)
...
@@ -5136,6 +5254,9 @@ void CleanupLocal()
...
@@ -5136,6 +5254,9 @@ void CleanupLocal()
smbFD
=
-
1
;
smbFD
=
-
1
;
mediaFD
=
-
1
;
mediaFD
=
-
1
;
httpFD
=
-
1
;
httpFD
=
-
1
;
extra1FD
=
-
1
;
extra2FD
=
-
1
;
extra3FD
=
-
1
;
fontFD
=
-
1
;
fontFD
=
-
1
;
slaveFD
=
-
1
;
slaveFD
=
-
1
;
proxyFD
=
-
1
;
proxyFD
=
-
1
;
...
@@ -5150,6 +5271,9 @@ void CleanupLocal()
...
@@ -5150,6 +5271,9 @@ void CleanupLocal()
useSmbSocket
=
0
;
useSmbSocket
=
0
;
useMediaSocket
=
0
;
useMediaSocket
=
0
;
useHttpSocket
=
0
;
useHttpSocket
=
0
;
useExtra1Socket
=
0
;
useExtra2Socket
=
0
;
useExtra3Socket
=
0
;
useFontSocket
=
0
;
useFontSocket
=
0
;
useSlaveSocket
=
0
;
useSlaveSocket
=
0
;
useAgentSocket
=
0
;
useAgentSocket
=
0
;
...
@@ -5183,6 +5307,9 @@ void CleanupLocal()
...
@@ -5183,6 +5307,9 @@ void CleanupLocal()
smbPort
.
disable
();
smbPort
.
disable
();
mediaPort
.
disable
();
mediaPort
.
disable
();
httpPort
.
disable
();
httpPort
.
disable
();
extra1Port
.
disable
();
extra2Port
.
disable
();
extra3Port
.
disable
();
slavePort
.
disable
();
slavePort
.
disable
();
*
fontPort
=
'\0'
;
*
fontPort
=
'\0'
;
...
@@ -8336,6 +8463,18 @@ int ParseEnvironmentOptions(const char *env, int force)
...
@@ -8336,6 +8463,18 @@ int ParseEnvironmentOptions(const char *env, int force)
{
{
SetAndValidateChannelEndPointArg
(
"local"
,
name
,
value
,
httpPort
);
SetAndValidateChannelEndPointArg
(
"local"
,
name
,
value
,
httpPort
);
}
}
else
if
(
strcasecmp
(
name
,
"extra1"
)
==
0
)
{
SetAndValidateChannelEndPointArg
(
"local"
,
name
,
value
,
extra1Port
);
}
else
if
(
strcasecmp
(
name
,
"extra2"
)
==
0
)
{
SetAndValidateChannelEndPointArg
(
"local"
,
name
,
value
,
extra2Port
);
}
else
if
(
strcasecmp
(
name
,
"extra3"
)
==
0
)
{
SetAndValidateChannelEndPointArg
(
"local"
,
name
,
value
,
extra3Port
);
}
else
if
(
strcasecmp
(
name
,
"font"
)
==
0
)
else
if
(
strcasecmp
(
name
,
"font"
)
==
0
)
{
{
snprintf
(
fontPort
,
DEFAULT_STRING_LENGTH
,
"%s"
,
value
);
snprintf
(
fontPort
,
DEFAULT_STRING_LENGTH
,
"%s"
,
value
);
...
@@ -11080,6 +11219,51 @@ int SetPorts()
...
@@ -11080,6 +11219,51 @@ int SetPorts()
nxinfo
<<
"Loop: Using HTTP port '"
<<
httpPort
nxinfo
<<
"Loop: Using HTTP port '"
<<
httpPort
<<
"'.
\n
"
<<
std
::
flush
;
<<
"'.
\n
"
<<
std
::
flush
;
if
(
extra1Port
.
configured
()
)
{
if
(
control
->
ProxyMode
==
proxy_client
)
{
extra1Port
.
setDefaultTCPPort
(
DEFAULT_NX_EXTRA1_PORT_OFFSET
+
proxyPort
);
useExtra1Socket
=
extra1Port
.
enabled
();
}
else
{
if
(
extra1Port
.
getTCPPort
()
<
0
)
{
nxfatal
<<
"Loop: PANIC! No port specified for EXTRA1 connections.
\n
"
<<
std
::
flush
;
cerr
<<
"Error"
<<
": No port specified for EXTRA1 connections.
\n
"
;
HandleCleanup
();
}
}
nxinfo
<<
"Loop: Using EXTRA1 port '"
<<
extra1Port
<<
"'.
\n
"
<<
std
::
flush
;
}
if
(
extra2Port
.
configured
()
)
{
if
(
control
->
ProxyMode
==
proxy_client
)
{
extra2Port
.
setDefaultTCPPort
(
DEFAULT_NX_EXTRA2_PORT_OFFSET
+
proxyPort
);
useExtra2Socket
=
extra2Port
.
enabled
();
}
else
{
if
(
extra2Port
.
getTCPPort
()
<
0
)
{
nxfatal
<<
"Loop: PANIC! No port specified for EXTRA2 connections.
\n
"
<<
std
::
flush
;
cerr
<<
"Error"
<<
": No port specified for EXTRA2 connections.
\n
"
;
HandleCleanup
();
}
}
nxinfo
<<
"Loop: Using EXTRA2 port '"
<<
extra2Port
<<
"'.
\n
"
<<
std
::
flush
;
}
if
(
extra3Port
.
configured
()
)
{
if
(
control
->
ProxyMode
==
proxy_client
)
{
extra3Port
.
setDefaultTCPPort
(
DEFAULT_NX_EXTRA3_PORT_OFFSET
+
proxyPort
);
useExtra3Socket
=
extra3Port
.
enabled
();
}
else
{
if
(
extra3Port
.
getTCPPort
()
<
0
)
{
nxfatal
<<
"Loop: PANIC! No port specified for EXTRA3 connections.
\n
"
<<
std
::
flush
;
cerr
<<
"Error"
<<
": No port specified for EXTRA3 connections.
\n
"
;
HandleCleanup
();
}
}
nxinfo
<<
"Loop: Using EXTRA3 port '"
<<
extra3Port
<<
"'.
\n
"
<<
std
::
flush
;
}
if
(
ParseFontPath
(
fontPort
)
<=
0
)
if
(
ParseFontPath
(
fontPort
)
<=
0
)
{
{
nxinfo
<<
"Loop: Disabling font server connections.
\n
"
nxinfo
<<
"Loop: Disabling font server connections.
\n
"
...
@@ -13286,6 +13470,42 @@ void PrintConnectionInfo()
...
@@ -13286,6 +13470,42 @@ void PrintConnectionInfo()
<<
"to port '"
<<
httpPort
<<
"'.
\n
"
;
<<
"to port '"
<<
httpPort
<<
"'.
\n
"
;
}
}
if
(
control
->
ProxyMode
==
proxy_client
&&
useExtra1Socket
>
0
&&
extra1Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Listening to EXTRA1 connections "
<<
"on port '"
<<
extra1Port
<<
"'.
\n
"
;
}
else
if
(
control
->
ProxyMode
==
proxy_server
&&
extra1Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Forwarding EXTRA1 connections "
<<
"to port '"
<<
extra1Port
<<
"'.
\n
"
;
}
if
(
control
->
ProxyMode
==
proxy_client
&&
useExtra2Socket
>
0
&&
extra2Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Listening to EXTRA2 connections "
<<
"on port '"
<<
extra2Port
<<
"'.
\n
"
;
}
else
if
(
control
->
ProxyMode
==
proxy_server
&&
extra2Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Forwarding EXTRA2 connections "
<<
"to port '"
<<
extra2Port
<<
"'.
\n
"
;
}
if
(
control
->
ProxyMode
==
proxy_client
&&
useExtra3Socket
>
0
&&
extra3Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Listening to EXTRA3 connections "
<<
"on port '"
<<
extra3Port
<<
"'.
\n
"
;
}
else
if
(
control
->
ProxyMode
==
proxy_server
&&
extra3Port
.
enabled
())
{
cerr
<<
"Info"
<<
": Forwarding EXTRA3 connections "
<<
"to port '"
<<
extra3Port
<<
"'.
\n
"
;
}
if
(
control
->
ProxyMode
==
proxy_server
&&
if
(
control
->
ProxyMode
==
proxy_server
&&
useFontSocket
>
0
&&
*
fontPort
!=
'\0'
)
useFontSocket
>
0
&&
*
fontPort
!=
'\0'
)
{
{
...
@@ -15241,6 +15461,36 @@ static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet)
...
@@ -15241,6 +15461,36 @@ static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet)
resultFDs
--
;
resultFDs
--
;
}
}
if
(
extra1FD
!=
-
1
&&
FD_ISSET
(
extra1FD
,
&
readSet
))
{
type
=
channel_extra1
;
label
=
"EXTRA1"
;
domain
=
AF_INET
;
fd
=
extra1FD
;
resultFDs
--
;
}
if
(
extra2FD
!=
-
1
&&
FD_ISSET
(
extra2FD
,
&
readSet
))
{
type
=
channel_extra2
;
label
=
"EXTRA2"
;
domain
=
AF_INET
;
fd
=
extra2FD
;
resultFDs
--
;
}
if
(
extra3FD
!=
-
1
&&
FD_ISSET
(
extra3FD
,
&
readSet
))
{
type
=
channel_extra3
;
label
=
"EXTRA3"
;
domain
=
AF_INET
;
fd
=
extra3FD
;
resultFDs
--
;
}
if
(
fontFD
!=
-
1
&&
FD_ISSET
(
fontFD
,
&
readSet
))
if
(
fontFD
!=
-
1
&&
FD_ISSET
(
fontFD
,
&
readSet
))
{
{
type
=
channel_font
;
type
=
channel_font
;
...
@@ -15553,6 +15803,54 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
...
@@ -15553,6 +15803,54 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
<<
" with setFDs "
<<
setFDs
<<
".
\n
"
<<
" with setFDs "
<<
setFDs
<<
".
\n
"
<<
std
::
flush
;
<<
std
::
flush
;
}
}
if
(
useExtra1Socket
==
1
)
{
FD_SET
(
extra1FD
,
&
readSet
);
if
(
extra1FD
>=
setFDs
)
{
setFDs
=
extra1FD
+
1
;
}
#ifdef DEBUG
*
logofs
<<
"Loop: Selected listener extra1FD "
<<
extra1FD
<<
" with setFDs "
<<
setFDs
<<
".
\n
"
<<
logofs_flush
;
#endif
}
if
(
useExtra2Socket
==
1
)
{
FD_SET
(
extra2FD
,
&
readSet
);
if
(
extra2FD
>=
setFDs
)
{
setFDs
=
extra2FD
+
1
;
}
#ifdef DEBUG
*
logofs
<<
"Loop: Selected listener extra2FD "
<<
extra2FD
<<
" with setFDs "
<<
setFDs
<<
".
\n
"
<<
logofs_flush
;
#endif
}
if
(
useExtra3Socket
==
1
)
{
FD_SET
(
extra3FD
,
&
readSet
);
if
(
extra3FD
>=
setFDs
)
{
setFDs
=
extra3FD
+
1
;
}
#ifdef DEBUG
*
logofs
<<
"Loop: Selected listener extra3FD "
<<
extra3FD
<<
" with setFDs "
<<
setFDs
<<
".
\n
"
<<
logofs_flush
;
#endif
}
}
}
if
(
useSlaveSocket
==
1
)
if
(
useSlaveSocket
==
1
)
...
...
nxcomp/src/Misc.cpp
View file @
4d3fb73f
...
@@ -112,6 +112,10 @@ const int DEFAULT_NX_FONT_PORT_OFFSET = 10000;
...
@@ -112,6 +112,10 @@ const int DEFAULT_NX_FONT_PORT_OFFSET = 10000;
const
int
DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET
=
11000
;
const
int
DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET
=
11000
;
const
int
DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET
=
12000
;
const
int
DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET
=
12000
;
const
int
DEFAULT_NX_EXTRA1_PORT_OFFSET
=
7250
;
const
int
DEFAULT_NX_EXTRA2_PORT_OFFSET
=
7500
;
const
int
DEFAULT_NX_EXTRA3_PORT_OFFSET
=
7750
;
//
//
// Usage info and copyright.
// Usage info and copyright.
//
//
...
@@ -279,6 +283,12 @@ static const char UsageInfo[] =
...
@@ -279,6 +283,12 @@ static const char UsageInfo[] =
\n
\
\n
\
http=n Enable forwarding of HTTP connections.
\n
\
http=n Enable forwarding of HTTP connections.
\n
\
\n
\
\n
\
extra1=n Enable forwarding of EXTRA1 connections.
\n
\
\n
\
extra2=n Enable forwarding of EXTRA2 connections.
\n
\
\n
\
extra3=n Enable forwarding of EXTRA3 connections.
\n
\
\n
\
font=n Enable forwarding of reversed connections to a font
\n
\
font=n Enable forwarding of reversed connections to a font
\n
\
server running on the NX server.
\n
\
server running on the NX server.
\n
\
\n
\
\n
\
...
@@ -981,6 +991,18 @@ const char *DumpControl(int code)
...
@@ -981,6 +991,18 @@ const char *DumpControl(int code)
{
{
return
"code_new_media_connection"
;
return
"code_new_media_connection"
;
}
}
case
code_new_extra1_connection
:
{
return
"code_new_extra1_connection"
;
}
case
code_new_extra2_connection
:
{
return
"code_new_extra2_connection"
;
}
case
code_new_extra3_connection
:
{
return
"code_new_extra3_connection"
;
}
case
code_switch_connection
:
case
code_switch_connection
:
{
{
return
"code_switch_connection"
;
return
"code_switch_connection"
;
...
...
nxcomp/src/Misc.h
View file @
4d3fb73f
...
@@ -89,6 +89,9 @@ extern const int DEFAULT_NX_MEDIA_PORT_OFFSET;
...
@@ -89,6 +89,9 @@ extern const int DEFAULT_NX_MEDIA_PORT_OFFSET;
extern
const
int
DEFAULT_NX_AUX_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_AUX_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_HTTP_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_HTTP_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_FONT_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_FONT_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_EXTRA1_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_EXTRA2_PORT_OFFSET
;
extern
const
int
DEFAULT_NX_EXTRA3_PORT_OFFSET
;
//
//
// Slave channels can be originated by both sides
// Slave channels can be originated by both sides
...
...
nxcomp/src/Proxy.cpp
View file @
4d3fb73f
...
@@ -761,6 +761,18 @@ const char *Proxy::getTypeName(T_channel_type type)
...
@@ -761,6 +761,18 @@ const char *Proxy::getTypeName(T_channel_type type)
{
{
return
"HTTP"
;
return
"HTTP"
;
}
}
case
channel_extra1
:
{
return
"EXTRA1"
;
}
case
channel_extra2
:
{
return
"EXTRA2"
;
}
case
channel_extra3
:
{
return
"EXTRA3"
;
}
case
channel_font
:
case
channel_font
:
{
{
return
"font"
;
return
"font"
;
...
@@ -1477,6 +1489,24 @@ int Proxy::handleControlFromProxy(const unsigned char *message)
...
@@ -1477,6 +1489,24 @@ int Proxy::handleControlFromProxy(const unsigned char *message)
break
;
break
;
}
}
case
code_new_extra1_connection
:
{
channelType
=
channel_extra1
;
break
;
}
case
code_new_extra2_connection
:
{
channelType
=
channel_extra2
;
break
;
}
case
code_new_extra3_connection
:
{
channelType
=
channel_extra3
;
break
;
}
case
code_new_font_connection
:
case
code_new_font_connection
:
{
{
channelType
=
channel_font
;
channelType
=
channel_font
;
...
@@ -4482,6 +4512,9 @@ int Proxy::handleControl(T_proxy_code code, int data)
...
@@ -4482,6 +4512,9 @@ int Proxy::handleControl(T_proxy_code code, int data)
case
code_new_smb_connection
:
case
code_new_smb_connection
:
case
code_new_media_connection
:
case
code_new_media_connection
:
case
code_new_http_connection
:
case
code_new_http_connection
:
case
code_new_extra1_connection
:
case
code_new_extra2_connection
:
case
code_new_extra3_connection
:
case
code_new_font_connection
:
case
code_new_font_connection
:
case
code_new_slave_connection
:
case
code_new_slave_connection
:
...
@@ -6018,6 +6051,24 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
...
@@ -6018,6 +6051,24 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
break
;
break
;
}
}
case
channel_extra1
:
{
channels_
[
channelId
]
=
new
Extra1Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_extra2
:
{
channels_
[
channelId
]
=
new
Extra2Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_extra3
:
{
channels_
[
channelId
]
=
new
Extra3Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_font
:
case
channel_font
:
{
{
channels_
[
channelId
]
=
new
FontChannel
(
transports_
[
channelId
],
compressor_
);
channels_
[
channelId
]
=
new
FontChannel
(
transports_
[
channelId
],
compressor_
);
...
@@ -6087,6 +6138,33 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
...
@@ -6087,6 +6138,33 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
break
;
break
;
}
}
case
channel_extra1
:
{
if
(
handleControl
(
code_new_extra1_connection
,
channelId
)
<
0
)
{
return
-
1
;
}
break
;
}
case
channel_extra2
:
{
if
(
handleControl
(
code_new_extra2_connection
,
channelId
)
<
0
)
{
return
-
1
;
}
break
;
}
case
channel_extra3
:
{
if
(
handleControl
(
code_new_extra3_connection
,
channelId
)
<
0
)
{
return
-
1
;
}
break
;
}
case
channel_font
:
case
channel_font
:
{
{
if
(
handleControl
(
code_new_font_connection
,
channelId
)
<
0
)
if
(
handleControl
(
code_new_font_connection
,
channelId
)
<
0
)
...
@@ -6502,6 +6580,24 @@ int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd,
...
@@ -6502,6 +6580,24 @@ int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd,
break
;
break
;
}
}
case
channel_extra1
:
{
channels_
[
channelId
]
=
new
Extra1Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_extra2
:
{
channels_
[
channelId
]
=
new
Extra2Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_extra3
:
{
channels_
[
channelId
]
=
new
Extra3Channel
(
transports_
[
channelId
],
compressor_
);
break
;
}
case
channel_font
:
case
channel_font
:
{
{
channels_
[
channelId
]
=
new
FontChannel
(
transports_
[
channelId
],
compressor_
);
channels_
[
channelId
]
=
new
FontChannel
(
transports_
[
channelId
],
compressor_
);
...
...
nxcomp/src/Proxy.h
View file @
4d3fb73f
...
@@ -131,6 +131,9 @@ typedef enum
...
@@ -131,6 +131,9 @@ typedef enum
code_split_token_reply
,
code_split_token_reply
,
code_data_token_request
,
code_data_token_request
,
code_data_token_reply
,
code_data_token_reply
,
code_new_extra1_connection
,
code_new_extra2_connection
,
code_new_extra3_connection
,
code_last_tag
code_last_tag
}
T_proxy_code
;
}
T_proxy_code
;
...
@@ -271,7 +274,10 @@ class Proxy
...
@@ -271,7 +274,10 @@ class Proxy
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
httpServerPort
,
ChannelEndPoint
&
httpServerPort
,
const
char
*
fontServerPort
)
=
0
;
const
char
*
fontServerPort
,
ChannelEndPoint
&
extra1ServerPort
,
ChannelEndPoint
&
extra2ServerPort
,
ChannelEndPoint
&
extra3ServerPort
)
=
0
;
//
//
// Create new tunneled channels.
// Create new tunneled channels.
...
...
nxcomp/src/ServerProxy.cpp
View file @
4d3fb73f
...
@@ -68,6 +68,10 @@ ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd)
...
@@ -68,6 +68,10 @@ ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd)
mediaServerPort_
=
NULL
;
mediaServerPort_
=
NULL
;
httpServerPort_
=
NULL
;
httpServerPort_
=
NULL
;
extra1ServerPort_
=
NULL
;
extra2ServerPort_
=
NULL
;
extra3ServerPort_
=
NULL
;
fontServerPort_
=
NULL
;
fontServerPort_
=
NULL
;
#ifdef DEBUG
#ifdef DEBUG
...
@@ -117,13 +121,20 @@ void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
...
@@ -117,13 +121,20 @@ void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
httpServerPort
,
ChannelEndPoint
&
httpServerPort
,
const
char
*
fontServerPort
)
const
char
*
fontServerPort
,
ChannelEndPoint
&
extra1ServerPort
,
ChannelEndPoint
&
extra2ServerPort
,
ChannelEndPoint
&
extra3ServerPort
)
{
{
cupsServerPort_
=
cupsServerPort
;
cupsServerPort_
=
cupsServerPort
;
smbServerPort_
=
smbServerPort
;
smbServerPort_
=
smbServerPort
;
mediaServerPort_
=
mediaServerPort
;
mediaServerPort_
=
mediaServerPort
;
httpServerPort_
=
httpServerPort
;
httpServerPort_
=
httpServerPort
;
extra1ServerPort_
=
extra1ServerPort
;
extra2ServerPort_
=
extra2ServerPort
;
extra3ServerPort_
=
extra3ServerPort
;
delete
[]
fontServerPort_
;
delete
[]
fontServerPort_
;
fontServerPort_
=
new
char
[
strlen
(
fontServerPort
)
+
1
];
fontServerPort_
=
new
char
[
strlen
(
fontServerPort
)
+
1
];
...
@@ -133,8 +144,11 @@ void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
...
@@ -133,8 +144,11 @@ void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
#ifdef DEBUG
#ifdef DEBUG
*
logofs
<<
"ServerProxy: Set port configuration to CUPS "
*
logofs
<<
"ServerProxy: Set port configuration to CUPS "
<<
cupsServerPort_
<<
", SMB "
<<
smbServerPort_
<<
cupsServerPort_
<<
", SMB "
<<
smbServerPort_
<<
", media "
<<
mediaServerPort_
<<
", HTTP "
<<
", media "
<<
mediaServerPort_
<<
httpServerPort_
<<
".
\n
"
<<
", HTTP "
<<
httpServerPort_
<<
", extra1 "
<<
extra1ServerPort_
<<
", extra2 "
<<
extra2ServerPort_
<<
", extra3 "
<<
extra3ServerPort_
<<
".
\n
"
<<
logofs_flush
;
<<
logofs_flush
;
#endif
#endif
}
}
...
@@ -195,6 +209,21 @@ int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId
...
@@ -195,6 +209,21 @@ int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId
return
handleNewGenericConnectionFromProxy
(
channelId
,
channel_http
,
return
handleNewGenericConnectionFromProxy
(
channelId
,
channel_http
,
httpServerPort_
,
"HTTP"
);
httpServerPort_
,
"HTTP"
);
}
}
case
channel_extra1
:
{
return
handleNewGenericConnectionFromProxy
(
channelId
,
channel_extra1
,
extra1ServerPort_
,
"EXTRA1"
);
}
case
channel_extra2
:
{
return
handleNewGenericConnectionFromProxy
(
channelId
,
channel_extra2
,
extra2ServerPort_
,
"EXTRA2"
);
}
case
channel_extra3
:
{
return
handleNewGenericConnectionFromProxy
(
channelId
,
channel_extra3
,
extra3ServerPort_
,
"EXTRA3"
);
}
case
channel_slave
:
case
channel_slave
:
{
{
return
handleNewSlaveConnectionFromProxy
(
channelId
);
return
handleNewSlaveConnectionFromProxy
(
channelId
);
...
...
nxcomp/src/ServerProxy.h
View file @
4d3fb73f
...
@@ -56,7 +56,10 @@ class ServerProxy : public Proxy
...
@@ -56,7 +56,10 @@ class ServerProxy : public Proxy
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
smbServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
mediaServerPort
,
ChannelEndPoint
&
httpServerPort
,
ChannelEndPoint
&
httpServerPort
,
const
char
*
fontServerPort
);
const
char
*
fontServerPort
,
ChannelEndPoint
&
extra1ServerPort
,
ChannelEndPoint
&
extra2ServerPort
,
ChannelEndPoint
&
extra3ServerPort
);
protected
:
protected
:
...
@@ -141,6 +144,9 @@ class ServerProxy : public Proxy
...
@@ -141,6 +144,9 @@ class ServerProxy : public Proxy
ChannelEndPoint
smbServerPort_
;
ChannelEndPoint
smbServerPort_
;
ChannelEndPoint
mediaServerPort_
;
ChannelEndPoint
mediaServerPort_
;
ChannelEndPoint
httpServerPort_
;
ChannelEndPoint
httpServerPort_
;
ChannelEndPoint
extra1ServerPort_
;
ChannelEndPoint
extra2ServerPort_
;
ChannelEndPoint
extra3ServerPort_
;
//
//
// It will have to be passed to the channel
// It will have to be passed to the channel
...
...
nxcomp/src/Statistics.cpp
View file @
4d3fb73f
...
@@ -153,6 +153,18 @@ Statistics::Statistics(Proxy *proxy) : proxy_(proxy)
...
@@ -153,6 +153,18 @@ Statistics::Statistics(Proxy *proxy) : proxy_(proxy)
protocolPartial_
.
httpBitsIn_
=
0
;
protocolPartial_
.
httpBitsIn_
=
0
;
protocolPartial_
.
httpBitsOut_
=
0
;
protocolPartial_
.
httpBitsOut_
=
0
;
protocolPartial_
.
extra1Count_
=
0
;
protocolPartial_
.
extra1BitsIn_
=
0
;
protocolPartial_
.
extra1BitsOut_
=
0
;
protocolPartial_
.
extra2Count_
=
0
;
protocolPartial_
.
extra2BitsIn_
=
0
;
protocolPartial_
.
extra2BitsOut_
=
0
;
protocolPartial_
.
extra3Count_
=
0
;
protocolPartial_
.
extra3BitsIn_
=
0
;
protocolPartial_
.
extra3BitsOut_
=
0
;
protocolPartial_
.
fontCount_
=
0
;
protocolPartial_
.
fontCount_
=
0
;
protocolPartial_
.
fontBitsIn_
=
0
;
protocolPartial_
.
fontBitsIn_
=
0
;
protocolPartial_
.
fontBitsOut_
=
0
;
protocolPartial_
.
fontBitsOut_
=
0
;
...
@@ -177,6 +189,18 @@ Statistics::Statistics(Proxy *proxy) : proxy_(proxy)
...
@@ -177,6 +189,18 @@ Statistics::Statistics(Proxy *proxy) : proxy_(proxy)
protocolTotal_
.
httpBitsIn_
=
0
;
protocolTotal_
.
httpBitsIn_
=
0
;
protocolTotal_
.
httpBitsOut_
=
0
;
protocolTotal_
.
httpBitsOut_
=
0
;
protocolTotal_
.
extra1Count_
=
0
;
protocolTotal_
.
extra1BitsIn_
=
0
;
protocolTotal_
.
extra1BitsOut_
=
0
;
protocolTotal_
.
extra2Count_
=
0
;
protocolTotal_
.
extra2BitsIn_
=
0
;
protocolTotal_
.
extra2BitsOut_
=
0
;
protocolTotal_
.
extra3Count_
=
0
;
protocolTotal_
.
extra3BitsIn_
=
0
;
protocolTotal_
.
extra3BitsOut_
=
0
;
protocolTotal_
.
fontCount_
=
0
;
protocolTotal_
.
fontCount_
=
0
;
protocolTotal_
.
fontBitsIn_
=
0
;
protocolTotal_
.
fontBitsIn_
=
0
;
protocolTotal_
.
fontBitsOut_
=
0
;
protocolTotal_
.
fontBitsOut_
=
0
;
...
@@ -287,6 +311,18 @@ int Statistics::resetPartialStats()
...
@@ -287,6 +311,18 @@ int Statistics::resetPartialStats()
protocolPartial_
.
httpBitsIn_
=
0
;
protocolPartial_
.
httpBitsIn_
=
0
;
protocolPartial_
.
httpBitsOut_
=
0
;
protocolPartial_
.
httpBitsOut_
=
0
;
protocolPartial_
.
extra1Count_
=
0
;
protocolPartial_
.
extra1BitsIn_
=
0
;
protocolPartial_
.
extra1BitsOut_
=
0
;
protocolPartial_
.
extra2Count_
=
0
;
protocolPartial_
.
extra2BitsIn_
=
0
;
protocolPartial_
.
extra2BitsOut_
=
0
;
protocolPartial_
.
extra3Count_
=
0
;
protocolPartial_
.
extra3BitsIn_
=
0
;
protocolPartial_
.
extra3BitsOut_
=
0
;
protocolPartial_
.
fontCount_
=
0
;
protocolPartial_
.
fontCount_
=
0
;
protocolPartial_
.
fontBitsIn_
=
0
;
protocolPartial_
.
fontBitsIn_
=
0
;
protocolPartial_
.
fontBitsOut_
=
0
;
protocolPartial_
.
fontBitsOut_
=
0
;
...
@@ -957,6 +993,18 @@ int Statistics::getClientProtocolStats(int type, char *&buffer)
...
@@ -957,6 +993,18 @@ int Statistics::getClientProtocolStats(int type, char *&buffer)
countBitsIn
+=
protocolData
->
httpBitsIn_
;
countBitsIn
+=
protocolData
->
httpBitsIn_
;
countBitsOut
+=
protocolData
->
httpBitsOut_
;
countBitsOut
+=
protocolData
->
httpBitsOut_
;
countAnyIn
+=
protocolData
->
extra1Count_
;
countBitsIn
+=
protocolData
->
extra1BitsIn_
;
countBitsOut
+=
protocolData
->
extra1BitsOut_
;
countAnyIn
+=
protocolData
->
extra2Count_
;
countBitsIn
+=
protocolData
->
extra2BitsIn_
;
countBitsOut
+=
protocolData
->
extra2BitsOut_
;
countAnyIn
+=
protocolData
->
extra3Count_
;
countBitsIn
+=
protocolData
->
extra3BitsIn_
;
countBitsOut
+=
protocolData
->
extra3BitsOut_
;
countAnyIn
+=
protocolData
->
fontCount_
;
countAnyIn
+=
protocolData
->
fontCount_
;
countBitsIn
+=
protocolData
->
fontBitsIn_
;
countBitsIn
+=
protocolData
->
fontBitsIn_
;
countBitsOut
+=
protocolData
->
fontBitsOut_
;
countBitsOut
+=
protocolData
->
fontBitsOut_
;
...
@@ -1618,6 +1666,18 @@ int Statistics::getServerProtocolStats(int type, char *&buffer)
...
@@ -1618,6 +1666,18 @@ int Statistics::getServerProtocolStats(int type, char *&buffer)
countBitsIn
+=
protocolData
->
httpBitsIn_
;
countBitsIn
+=
protocolData
->
httpBitsIn_
;
countBitsOut
+=
protocolData
->
httpBitsOut_
;
countBitsOut
+=
protocolData
->
httpBitsOut_
;
countAnyIn
+=
protocolData
->
extra1Count_
;
countBitsIn
+=
protocolData
->
extra1BitsIn_
;
countBitsOut
+=
protocolData
->
extra1BitsOut_
;
countAnyIn
+=
protocolData
->
extra2Count_
;
countBitsIn
+=
protocolData
->
extra2BitsIn_
;
countBitsOut
+=
protocolData
->
extra2BitsOut_
;
countAnyIn
+=
protocolData
->
extra3Count_
;
countBitsIn
+=
protocolData
->
extra3BitsIn_
;
countBitsOut
+=
protocolData
->
extra3BitsOut_
;
countAnyIn
+=
protocolData
->
fontCount_
;
countAnyIn
+=
protocolData
->
fontCount_
;
countBitsIn
+=
protocolData
->
fontBitsIn_
;
countBitsIn
+=
protocolData
->
fontBitsIn_
;
countBitsOut
+=
protocolData
->
fontBitsOut_
;
countBitsOut
+=
protocolData
->
fontBitsOut_
;
...
@@ -1873,6 +1933,36 @@ int Statistics::getServicesStats(int type, char *&buffer)
...
@@ -1873,6 +1933,36 @@ int Statistics::getServicesStats(int type, char *&buffer)
strcat
(
buffer
,
format
);
strcat
(
buffer
,
format
);
}
}
if
(
protocolData
->
extra1BitsOut_
>
0
)
{
sprintf
(
format
,
" %.0f EXTRA1 messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.
\n\n
"
,
protocolData
->
extra1Count_
,
protocolData
->
extra1BitsIn_
/
8
,
protocolData
->
extra1BitsIn_
/
8192
,
protocolData
->
extra1BitsOut_
/
8
,
protocolData
->
extra1BitsOut_
/
8192
);
strcat
(
buffer
,
format
);
}
if
(
protocolData
->
extra2BitsOut_
>
0
)
{
sprintf
(
format
,
" %.0f EXTRA2 messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.
\n\n
"
,
protocolData
->
extra2Count_
,
protocolData
->
extra2BitsIn_
/
8
,
protocolData
->
extra2BitsIn_
/
8192
,
protocolData
->
extra2BitsOut_
/
8
,
protocolData
->
extra2BitsOut_
/
8192
);
strcat
(
buffer
,
format
);
}
if
(
protocolData
->
extra3BitsOut_
>
0
)
{
sprintf
(
format
,
" %.0f EXTRA3 messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.
\n\n
"
,
protocolData
->
extra3Count_
,
protocolData
->
extra3BitsIn_
/
8
,
protocolData
->
extra3BitsIn_
/
8192
,
protocolData
->
extra3BitsOut_
/
8
,
protocolData
->
extra3BitsOut_
/
8192
);
strcat
(
buffer
,
format
);
}
if
(
protocolData
->
fontBitsOut_
>
0
)
if
(
protocolData
->
fontBitsOut_
>
0
)
{
{
sprintf
(
format
,
" %.0f font server messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.
\n\n
"
,
sprintf
(
format
,
" %.0f font server messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.
\n\n
"
,
...
...
nxcomp/src/Statistics.h
View file @
4d3fb73f
...
@@ -346,6 +346,42 @@ class Statistics
...
@@ -346,6 +346,42 @@ class Statistics
protocolTotal_
.
httpBitsOut_
+=
bitsOut
;
protocolTotal_
.
httpBitsOut_
+=
bitsOut
;
}
}
void
addExtra1Bits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
protocolPartial_
.
extra1Count_
++
;
protocolTotal_
.
extra1Count_
++
;
protocolPartial_
.
extra1BitsIn_
+=
bitsIn
;
protocolTotal_
.
extra1BitsIn_
+=
bitsIn
;
protocolPartial_
.
extra1BitsOut_
+=
bitsOut
;
protocolTotal_
.
extra1BitsOut_
+=
bitsOut
;
}
void
addExtra2Bits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
protocolPartial_
.
extra2Count_
++
;
protocolTotal_
.
extra2Count_
++
;
protocolPartial_
.
extra2BitsIn_
+=
bitsIn
;
protocolTotal_
.
extra2BitsIn_
+=
bitsIn
;
protocolPartial_
.
extra2BitsOut_
+=
bitsOut
;
protocolTotal_
.
extra2BitsOut_
+=
bitsOut
;
}
void
addExtra3Bits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
protocolPartial_
.
extra3Count_
++
;
protocolTotal_
.
extra3Count_
++
;
protocolPartial_
.
extra3BitsIn_
+=
bitsIn
;
protocolTotal_
.
extra3BitsIn_
+=
bitsIn
;
protocolPartial_
.
extra3BitsOut_
+=
bitsOut
;
protocolTotal_
.
extra3BitsOut_
+=
bitsOut
;
}
void
addFontBits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
void
addFontBits
(
unsigned
int
bitsIn
,
unsigned
int
bitsOut
)
{
{
protocolPartial_
.
fontCount_
++
;
protocolPartial_
.
fontCount_
++
;
...
@@ -495,6 +531,9 @@ class Statistics
...
@@ -495,6 +531,9 @@ class Statistics
protocolTotal_
.
smbBitsOut_
+
protocolTotal_
.
smbBitsOut_
+
protocolTotal_
.
mediaBitsOut_
+
protocolTotal_
.
mediaBitsOut_
+
protocolTotal_
.
httpBitsOut_
+
protocolTotal_
.
httpBitsOut_
+
protocolTotal_
.
extra1BitsOut_
+
protocolTotal_
.
extra2BitsOut_
+
protocolTotal_
.
extra3BitsOut_
+
protocolTotal_
.
fontBitsOut_
+
protocolTotal_
.
fontBitsOut_
+
protocolTotal_
.
slaveBitsOut_
)
/
8
;
protocolTotal_
.
slaveBitsOut_
)
/
8
;
...
@@ -636,6 +675,18 @@ class Statistics
...
@@ -636,6 +675,18 @@ class Statistics
double
httpBitsIn_
;
double
httpBitsIn_
;
double
httpBitsOut_
;
double
httpBitsOut_
;
double
extra1Count_
;
double
extra1BitsIn_
;
double
extra1BitsOut_
;
double
extra2Count_
;
double
extra2BitsIn_
;
double
extra2BitsOut_
;
double
extra3Count_
;
double
extra3BitsIn_
;
double
extra3BitsOut_
;
double
fontCount_
;
double
fontCount_
;
double
fontBitsIn_
;
double
fontBitsIn_
;
double
fontBitsOut_
;
double
fontBitsOut_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment