Im planning to deploy a version for some IETF drafts and need some code references or guidance. Im familiar with basic TCP sockets but want to know how to translate requirements into code.
Example: Format for the Session Initiation Protocol (SIP) Common Log Format (CLF)
Would like to see how to translate:
0 7 8 15 16 23 24 31
+-----------+-----------+-----------+-----------+
| Version | Record Length | 0 - 3
+-----------+-----------+-----------+-----------+
Version (1 byte): 0x41 for this document; hexadecimal encoded.
Record Length (6 bytes): Hexadecimal encoded total length of this
log record, including "Flags" and "Record Length" fields, and
terminating line-feed.
into code.
How can I define Version?
Which type?
Int, char, etc?
Thanks
Instead of writing it from scratch, I would suggest to use applications like Jboss Netty , Apache Mina or Grizzly. They are specifically targeted for high performance protocol development.
Here is an example of Grizzly being used for Supporting SIP.