APG
… an ABNF Parser Generator
|
The Session Initiation Protocol (SIP) is described in RFC 3261. From the abstract:
"... Session Initiation Protocol (SIP), [is] an application-layer control (signaling) protocol for creating, modifying, and terminating sessions with one or more participants. These sessions include Internet telephone calls, multimedia distribution, and multimedia conferences."
SIP has been chosen for this example because:
Full disclosure - I am not a SIP or telecom expert. All of the examples and discussion here deal strictly with the syntax and parsing of the ABNF grammar. The ABNF grammar used here has been slightly modified from the exact grammar extracted from RFC 3261 to work correctly with the disambiguation rules of APG;
The test messages* used here, the so-called "torture tests", have been extracted from RFC 4475 using the base64, gzip-compressed TAR archive of files included there. Those files have been separated into three directories, ./tests/valid
(section 3.1.1), ./tests/invalid
(section 3.1.2) and ./tests/semantics
(sections 3.2, 3.3 and 3.4). Additionally, for each of these data files a text file of the same base name has been created which contains a copy of the discussion of that message from the RFC as well as my own comments about the parsing of the message. For example,
./valid/dblreq.dat
./valid/dblreq.txt
.Again, my comments in the *.txt
files are directed strictly to the syntax. Nothing in them is intended to contradict or critique the authors.
Case 2 of this example reads all of the files from all three of the directories and collects them into a single JSON file, ./sip-tests.json
. This JSON file is then used as the data source for all of the remaining test cases.
* Note that these test message are copyrighted by The Internet Society (2006).
Timing Tests
Comparison of the timing* from the various configurations is shown in the table below.
App | PPPT | UDT | msec/msg | factor |
---|---|---|---|---|
APG 7.0 | no | no | 0.0281 | 1.00 |
APG 7.0 | no | yes | 0.0116 | 2.41 |
APG 7.0 | yes | no | 0.0151 | 1.86 |
APG 7.0 | yes | yes | 0.0117 | 2.40 |
APG 6.3 | no | no | 0.0713 | .394 |
* OS: Ubuntu 20.04, processor: Intel i7-10710U, 6 cores, RAM: 64GB
Statistics Tests
Comparison of the total number of parse tree node hits from the various configurations is shown in the table below. The hit total count is the cumulative total from parsing all 51 of the test messages.
App | PPPT | UDT | hits/msg | factor |
---|---|---|---|---|
APG 7.0 | no | no | 2953 | 1.00 |
APG 7.0 | no | yes | 1024 | 2.88 |
APG 7.0 | yes | no | 572 | 5.16 |
APG 7.0 | yes | yes | 557 | 5.30 |
Application Requirements
The compiled example will execute the following cases. Run the application with no arguments for application usage.