Contents |
[edit]
psycpp
Elmex's prototypical C++ implementation of PSYC according to Spec:Packet. The package also contains parsers in C and perl.
[edit]
Availability
[edit]
The Parser
psycpp comes with a C++ parser that uses the spirit library from boost, but recent changes in the packet made such a complicated parser unnecessary.
The parser has been (mostly) strictly written with Spec:Packet in mind, but the specification has changed somewhat since.
[edit]
How the parser works
- First the parser tries to read in a complete header, that is done by looking for the sequences ".\n" or "\n\n" which delimit the end of a routing header. In case ".\n" is found the packet will not contain any further data. In case "\n\n" was found the header is stripped from the input buffer (along with the second "\n") and the routing modifiers are parsed.
- If the routing modifiers contained a "_length" setting the parser tries to read that count of bytes and subsequently the packet end delimiter "\n.\n".
- If however the routing modifiers didn't contain any "_length" setting the parser looks for the packet end, which is delimited by "\n.\n". If found, the packet is stripped from the input buffer and parsed (along with "\n.\n").
- goto 1.
[edit]