wswrapper: update README, DO_MSG def for output.
Update README to mention wswrapper. Add DO_MSG define which controls whether wswrapper code generates basic output.
This commit is contained in:
parent
56d9aa816b
commit
71ba9a7a54
|
@ -1,7 +1,20 @@
|
||||||
## wsproxy: WebSockets to TCP Proxy
|
## WebSockets Utilities: wswrapper and wsproxy
|
||||||
|
|
||||||
|
|
||||||
### How it works
|
### wswrapper
|
||||||
|
|
||||||
|
wswrapper is an LD_PRELOAD library that converts a TCP listen socket
|
||||||
|
of an existing program to a be a WebSockets socket. The `wswrap`
|
||||||
|
script can be used to easily launch a program using wswrapper. Here is
|
||||||
|
an example of using wswrapper with vncserver. wswrapper will convert
|
||||||
|
the socket listening on port 5901 to be a WebSockets port:
|
||||||
|
|
||||||
|
`cd noVNC/utils`
|
||||||
|
|
||||||
|
`./wswrap 5901 vncserver -geometry 640x480 :1`
|
||||||
|
|
||||||
|
|
||||||
|
### wsproxy
|
||||||
|
|
||||||
At the most basic level, wsproxy just translates WebSockets traffic
|
At the most basic level, wsproxy just translates WebSockets traffic
|
||||||
to normal socket traffic. wsproxy accepts the WebSockets handshake,
|
to normal socket traffic. wsproxy accepts the WebSockets handshake,
|
||||||
|
@ -15,7 +28,7 @@ case the data from the client is not a full WebSockets frame (i.e.
|
||||||
does not end in 255).
|
does not end in 255).
|
||||||
|
|
||||||
|
|
||||||
### Additional features
|
#### Additional wsproxy features
|
||||||
|
|
||||||
These are not necessary for the basic operation.
|
These are not necessary for the basic operation.
|
||||||
|
|
||||||
|
@ -38,7 +51,7 @@ These are not necessary for the basic operation.
|
||||||
option.
|
option.
|
||||||
|
|
||||||
|
|
||||||
### Implementations
|
#### Implementations of wsproxy
|
||||||
|
|
||||||
There are three implementations of wsproxy included: python, C, and
|
There are three implementations of wsproxy included: python, C, and
|
||||||
Node (node.js).
|
Node (node.js).
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* - programs using ppoll or epoll will not work correctly
|
* - programs using ppoll or epoll will not work correctly
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DO_MSG 1
|
||||||
//#define DO_DEBUG 1
|
//#define DO_DEBUG 1
|
||||||
//#define DO_TRACE 1
|
//#define DO_TRACE 1
|
||||||
|
|
||||||
|
@ -828,6 +829,7 @@ int _WS_poll(int mode, struct pollfd *fds, nfds_t nfds, int timeout,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overload (LD_PRELOAD) standard library network routines
|
* Overload (LD_PRELOAD) standard library network routines
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,6 +7,14 @@
|
||||||
* wswrapper.so.
|
* wswrapper.so.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DO_MSG
|
||||||
|
#define MSG(...) \
|
||||||
|
fprintf(stderr, "wswrapper: "); \
|
||||||
|
fprintf(stderr, __VA_ARGS__);
|
||||||
|
#else
|
||||||
|
#define MSG(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DO_DEBUG
|
#ifdef DO_DEBUG
|
||||||
#define DEBUG(...) \
|
#define DEBUG(...) \
|
||||||
if (DO_DEBUG) { \
|
if (DO_DEBUG) { \
|
||||||
|
@ -27,10 +35,6 @@
|
||||||
#define TRACE(...)
|
#define TRACE(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MSG(...) \
|
|
||||||
fprintf(stderr, "wswrapper: "); \
|
|
||||||
fprintf(stderr, __VA_ARGS__);
|
|
||||||
|
|
||||||
#define RET_ERROR(eno, ...) \
|
#define RET_ERROR(eno, ...) \
|
||||||
fprintf(stderr, "wswrapper error: "); \
|
fprintf(stderr, "wswrapper error: "); \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
|
|
Loading…
Reference in New Issue