Network benchmark - header parsing

Hal Snyder hal@REDACTED
Tue Dec 23 20:38:05 CET 2003


Peter-Henry Mander <erlang@REDACTED> writes:

> Someone mention SIP parsing using bit-syntax?
>
> I'm currently writing a SIP message parser using pattern matching on
> lists. I was wondering if anyone would be kind enough to share their
> thoughts and experience about using binaries instead. How would I
> handle syntax such as:
>
> Timestamp = "Timestamp" HCOLON 1*( DIGIT ) ["." *( DIGIT )] [LWS delay]
> delay = *( DIGIT ) ["." *( DIGIT )]
> LWS = [*WSP CRLF] 1*WSP
>
> Doing this in list pattern matching is easy. I'm concerned that if I
> pattern-matched a binary, I would end up making many copies of the
> binary.

My efforts here so far are limited to thought experiments. :(

But, last time I looked at header parsing for HTTP in
erts/emulator/drivers/common/inet_drv.c I convinced myself SIP parsing
was doable with a similar hack.

> Or am I imagining false problems which don't exist?

I suspect you are imagining real problems.

> I notice that the Megaco stack uses a link-in C driver that is
> generated using lex.

That was news to me. Interesting!

> Would this be the most effective way of parsing SIP, instead on
> parsing a list?

No doubt. Will experiment with it if time allows.



More information about the erlang-questions mailing list