Background
There are a lot of protocol analysers (such as Ethereal, sniffer tools) in the software market, but it is still difficult to find a decoder which can support custom-defined package. Here, we provide a framework of such a software, hoping it will help you a lot.
Introduction
Protocol analyser is a protocol analyse tool for parsing and displaying received binary data package. With an easy-to-use interface and programmable kernel, it can support a variety of protocols such as IP based protocols (TCP, UDP, etc.), Telecommunication protocols (MTP3, ISUP, TUP, etc.), or you can define new custom decoders of non-standard or rare protocols.
Unlike other protocol analyzer tools, we create advanced features to meet future needs, not only for standard protocols, but also for user-defined protocols.
Instead of waiting long time for a new protocol decoder to be released, you can easily write a script to support new protocols in an incredibly short time by yourself.
It can be used as a message debug tool for protocol analyzers and program developers, especially for those who want to have a tool to support their own protocol or their own frame format, because no other software can be found to meet such specific requirement.
By understanding this project, you could create your own protocol decoders. Or, you could download the newest version of this software here.
Besides, this article gives a demonstration of how to compile a text script, and how to get the grammar elements. It might be useful in software development.
The Framework
Here, we give you a brief description of how to use the main class.
MsgTranslater Translater;
bRT=Translater.LoadScript(m_strFilePath.GetBuffer(0));
if (!bRT)
{
AfxMessageBox(Translater.m_strLastError.GetBuffer());
return;
}
...
bRT=Translater.Translate(true,buf,n);
if (!bRT)
{
strLastError=Translater.m_strLastError;
}
...
TVariableItem& VariableItem=Translater.GetResult();
...
VirtualList DataList;
VariableItem.DumpToList(DataList,Attr);
...
COneLogFile LogFile("Dump\\Tran.txt",true);
...
FILE *fp;
long len;
fp=fopen("Dump\\Tran.txt","rb");
fseek(fp,0L,2);
len=ftell(fp);
fseek(fp,0L,0);
char *buffer=new char[len+2];
buffer[len]='\0';
fread(buffer,len,1,fp);
GetDlgItem(IDC_MYEDIT)->SetWindowText(buffer);
delete buffer;
fclose(fp);
...
History
This is version 0.9, first workable version, and we are still improving it now, because it can become a very useful tool.
You can visit http://Aries-studio.vicp.net/soft/default.html to download the newest version, the help documents and get more information (website is not always open, but don't worry, try it later).