I have put some simple but interesting sample applications developed with RSSI. These samples may guide you to learn RSS and RSSI step by step. All of these sample applications are very simple. Most of them have less than 200 lines of code. Before testing these samples, make sure to unzip RSS package to a directory. For example, put RSS files into "/usr/rss-v2.0" on UNIX/LINUX, or "c:\rss-v2.0" on Windows. Although RSS can run on all brands of UNIX, Only libraries on LINUX and Windows are provided within current package.
If you want to test RSS in Linux, make sure to add the "lib" directory of RSS into environment variables such as "CLASSPATH" and "LD_LIBRARY_PATH". For example, if you put RSS into "/usr/rss-v2.0" directory, use following command to set environment variables:
If you want to test RSS in Windows, make sure to add the "lib" directory of RSS into environment variables such as "CLASSPATH" and "PATH". For example, if you put RSS into "/usr/rss-v2.0" directory, use following command to set environment variables:CLASSPATH=.:/usr/rss-v2.0/lib export CLASSPATH LD_LIBRARY_PATH=/usr/lib:/usr/rss-v2.0/lib export LD_LIBRARY_PATH
A sample application named "Xmler" needs jar file "xerces.jar" to be in the "CLASSPATH".set Path=c:\rss-v2.0\lib;%PATH% set CLASSPATH=.;c:\rss-v2.0\lib;%CLASSPATH% set include=c:\rss-v2.0\include;%include% set lib=c:\rss-v2.0\lib;%lib%
There are 4 samples in the current RSS version 1.1 package. Following
is the information:
Name | Description | Language | Platform |
Simple Command Shell | To build a simple command shell | Server: C; Client: C, Java | Linux/Windows |
Registry | To read/write information from/into different registries. | Server: C; Client: C, Java, VB | Linux/Windows |
Weeb | A simple Web server | Server: Java; Client: Java, C, VB | Linux/Windows |
Waiter | A sample can start MS Office applications | Server: VB; Client: VB, C, Java | Windows |
XMLer | To manipulate XML document | Server Java; Client: Java, C, VB | Linux/Windows |
For Linux:nmake -f cmdshell.win.mk
Use following commands to build the client program:make -f cmdshell.linux.mk
For Linux:nmake -f test.win.mk
Run the client program "test", use command "?" or "help" to see the help text, use "exit" or "quit" to exit the program. Following is the scenario:make -f test.linux.mk
You can use "prompt" command to change the "prompt string" of the command shell. Following is the scenario:[root@vmln cmdshell]# ./test ==================================================================== Simple Command Shell Test Program ==================================================================== => ? exit,quit - exit the command shell help,? - provide help information prompt <prompt string> Command RtCode = <10002> => exit Command RtCode = <10001>
You can test the command shell to parse commands. Following is the scenario:=> prompt $ Command RtCode = <10003> $prompt " # " Command RtCode = <10003> #
Let's see the Interface Definition Manual named "manual.txt". We can find 5 Actions defined in the file. Each Action has its own keys. If an input key is marked with "<Required>", it must be provided for the Action. If an input key is marked with "<Optional>", it is an optional key. Action "Print" and "ParseCommand" are static Actions which means that they can be taken at any time.# aaa bb cc d You have input a command with 3 argument(s) Command = aaa Argument No.1 = bb Argument No.2 = cc Argument No.3 = d # aaa bb "cc d" You have input a command with 2 argument(s) Command = aaa Argument No.1 = bb Argument No.2 = cc d
The server source file is "cmdshell.c". Its RSSI entry point is function "CmdShellRssi". This function is short but powerful. It can process 5 Actions requested by the client side. You can consult "manual.txt" file to know what the function will do. What I should explain is that I allocate a RSSI Handle in the Action "Activate". RSSI Handle can hold data for use at any time when in the lifecycle of the interface.
The client source file is "test.c". It invocates Actions defined in RSSI Manual.
Use following command to run Java client. You will get the similar scenario:
[root@vmln cmdshell]# Java Test
For Linux:nmake -f registry.win.mk
Use following commands to build the client program:make -f registry.linux.mk
For Linux:nmake -f test.win.mk
Run the client program "test", you can find the following scenario:make -f test.linux.mk
You can find a new created registry file named "myreg.ini" as following:[root@vmln registry]# ./test ---Write Registry File--- ---Read Registry File--- The phone number got from registry file is: 123-456-7890
The application has created a new "myreg.ini" and read one item from that registry file.[Profile] Name=Liu Rui Title=Mr. Phone=123-456-7890 [Products] Software=Regular Statement String (RSS)
Let's see the Interface Definition Manual named "manual.txt". We can find 5 Actions defined in the file. Each Action has its own keys. If an input key is marked with "<Required>", it must be provided for the Action. If an input key is marked with "<Optional>", it is an optional key.
The server source file is "registry.c". Its RSSI entry point is function "RegistryRssi". This function is short but powerful. It can process 5 Actions requested by the client side. You can consult "manual.txt" file to know what the function will do. What I should explain is that I allocate a RSSI Handle in the Action "Activate". RSSI Handle can hold data for use at any time when in the lifecycle of the interface.
The client source file is "test.c". It invocates Actions defined in RSSI.
You can also use Java or Visual Basic to invocate the interface easily. Before use this client, make sure you have set correct environment variables (CLASSPATH, LD_LIBRARY_PATH, PATH). You can use following command to run Java client. The Java client program need one command line argument to specify where to find the server library, you can find the following scenario:
on Linux:
on Windows:# java Test ./libregistry.so ---Write Registry File--- ---Read Registry File--- The phone number got from registry file is: 123-456-7890
There's also a VBScript client script file in the "dll" subdirectory. Before use this client, make sure you have registered the RSS COM server ("regsvr32 rsscom.dll"). Double click the VBScript file ("test.vbs"), you can get a Message Window showing the CLSID of the COM server as following:# java Test registry.dll ---Write Registry File--- ---Read Registry File--- The phone number got from registry file is: 123-456-7890
For Windows:
For Unix/Linux:javac weeb\*.java
Use following commands to build the client (The client is used to control Weeb, and can be called back from the server.):javac weeb/*.java
Use following command to start Weeb (The command argument specifies where to locate the root of the Web document.):javac Test.java
java Test .From a Web browser, you can visit Weeb with correct IP address and default port number (80). Proxy server is not supported.
Let's see the Interface Definition Manual named "manual.txt". We can find 54 Actions defined in the file. Each Action has its own keys. If an input key is marked with "<Required>", it must be provided for the Action. If an input key is marked with "<Optional>", it is an optional key.
The major server source file is "Weeb.java". Its RSSI entry point is function "WeebRssi". This function is short but powerful. It can process 4 Actions requested by the client side. You can consult "manual.txt" file to know what the function will do. What I should explain is that I allocate a RSSI Handle in the Action "Activate". RSSI Handle can hold data for use at any time when in the lifecycle of the interface. The client source file is "Test.java". It invocates Actions defined in RSSI.
There are also C and VB client source files inside the directory. Use
the following commands to compile and run C client:
For Windows:
For Linux:nmake -f test.win.mk test
nmake -f test.linux.mk ./test
I have test the program in many platforms. I found there may be some issue in old version Linux because the thread support of Linux is limited.You can also run a Visual Basic Script client in the comand window. It shows a message box when it launches the Web server. Use the following commands to run the VB client on Windows:
Use Visual Basic project file "test.vbp", you can build client written with Visual Basic.
Use following commands to build the client written with C:
Use following commands to build the client written with Javanmake -f test.win.mk
All of these clients prompt a task list. You can choose one task to invocate the service.javac Test.java
For Windows:
For Unix/Linux:javac xmlerj\*.java
Use following commands to build the client (The client is used to control Weeb, and can be called back from the server.):javac xmlerj/*.java
Use following command to start Weeb, the XML file to be parsed is named "gjobs.xml" inside the directory:javac Test.java
java TestThere are also C and VB client source files inside the directory. Use the following commands to compile and run C client:
For Linux:nmake -f test.win.mk test
I have test the program in many platforms. I found there may be some issue in old version Linux because the thread support of Linux is limited.nmake -f test.linux.mk ./test
You can also run a Visual Basic Script client in the comand window. Use the following commands to run the VB client on Windows:
test.vbs