
Protocol plugin example for SDK 3.0

List of files
-------------

 - Protocol.c : Accept client requests and generate transaction state machines for each client request.
 - TxnSM.c    : Implementation of handling a transaction.

 - Protocol.h : Header file.
 - TxnSM.h    : Header file.

 - test/ProtocolServerTest.java : Synthetic server.
 - test/ProtocolClientTest.java : Synthetic client.
 - test/file_gen.sh : shell script to generate file list for testing.

Protocol
--------

 - Request  : [server_name][space][file_name][space][\r\n]
 - Response : File (if file is found)
              Nothing (if file is not found)

How to run proxy
----------------

 - Compile protocol.so and copy it under plugins directory.
 - In plugin.config: 
   protocol.so <accept_port> <server_port>
   accept_port is the port to listen to client requests.
   server_port is the port to connect to origin server.
 - Debug tag: -T"protocol".

How to run synthetic server
---------------------------

 - Compile ProtocolServerTest.java and get ProtocolServerTest.class.
 - Run: java ProtocolServerTest <server_port>
   server_port is the port synthetic server listens to requests.
   server_port should match "server_port" argument passed to the plugin.

How to run synthetic client
---------------------------
 - Compile ProtocolClientTest.java and get ProtocolClientTest.class.
 - Run: java ProtocolClientTest -options. 
 - Options include:
   "-P" : proxy name (e.g. npdev.inktomi.com)
   "-p" : proxy port (match "accept_port" argument passed to the plugin)
   "-s" : origin server name
   "-f" : file list name (generated by file_gen.sh)
   "-n" : number of pipelined client requests
   "-l" : how many times of looping