Introduction:
The Generic Protocol Framework aims to allow users to rapidly prototype
different emerging communications protocols. Implementations can be easily
"dropped in" and tested independant of a finished product. Testing on both the
end product, and the protocol itself can be easily accomplished. The tool aims
to provide the developer and end user with a robust solution which can track
the size of messages, how rapidly they will be generated, and how many of each
type can be seen.
Why the GPF:
There are many similar tools available. The problem with many of these tools
is that they are 1) closed source, 2) not easily adaptable to a specific
implementation (they use custom languages), 3) expensive. The advantages of the
GPF are its open source nature, the ease of which it can be adapted, and the
cost: free!
Basic Flow:
Modification of the GPF is fairly simple. Tool-opts.h contains the basic
options that will be applied to the packet while it is being built. To transmit
a packet, the system calls the tx_message() function, and passes the message ID
as well as the option block. This is then passed to the custom function:
tx_message_custom() in tx.c. From the message id, the system selects an
appropriate tx_* function (to be implemented by the user) and passes an
unsigned char **, where the buffer will be written, and the option block. In
turn, that function will make heavy use of the add_buf_tu*() functions, which
will allow the user to add a tubyte8, tuint16, or tuint32 number to the buffer.
In daemonize mode, the basic options are set, and the system then listens for
incomming packets. When a packet arrives, the system calls basic_parse() on the
packet. This function then calls basic_parse_custom(), found in parse.c. In
turn, this can call any appropriate parsing helpers, including the get_tu*()
functions, which allow the user to retrieve a tubyte8, tuint16, or tuint32
from the buffer.
CAVEAT: if the first two bytes of the buffer are zero'd, it will be treated as
an END message. However, recovery is available. In the
basic_parse_custom() message, you can set the end_signal_caught
variable of the option_block to 0. In this case, it will not stop the
daemon from running.
Download here